WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
Patch (text/plain), 5.38 KB, created by
Yonggeol Jung
on 2013-08-27 02:30:17 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yonggeol Jung
Created:
2013-08-27 02:30:17 PDT
Size:
5.38 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e53bd1d..48c03d9 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2013-08-27 YongGeol Jung <yg48.jung@samsung.com> >+ >+ [cairo] ShadowBlur is extremely slow when canvas's scale is very small. >+ https://bugs.webkit.org/show_bug.cgi?id=120346 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ ShadowBlur drawing is too slow if scale of canvas is set to very small value such as 0.01. >+ The main reason is blurRadius gets huge value if scale is small. >+ If shadow value is 100 with 0.01 scale value, blurRadius will be 10000. >+ Almost time is consumed to make blurred-layer. >+ >+ * platform/graphics/ShadowBlur.cpp: >+ (WebCore::ShadowBlur::useScaledBlurLayer): >+ (WebCore::ShadowBlur::calculateLayerBoundingRect): >+ (WebCore::ShadowBlur::beginShadowLayer): >+ (WebCore::ShadowBlur::endShadowLayer): >+ * platform/graphics/ShadowBlur.h: >+ > 2013-08-26 Sam Weinig <sam@webkit.org> > > EditorInternalCommand should use Frame& where possible >diff --git a/Source/WebCore/platform/graphics/ShadowBlur.cpp b/Source/WebCore/platform/graphics/ShadowBlur.cpp >index 7458ea8..7130286 100644 >--- a/Source/WebCore/platform/graphics/ShadowBlur.cpp >+++ b/Source/WebCore/platform/graphics/ShadowBlur.cpp >@@ -397,7 +397,16 @@ IntSize ShadowBlur::blurredEdgeSize() const > return edgeSize; > } > >-IntRect ShadowBlur::calculateLayerBoundingRect(GraphicsContext* context, const FloatRect& shadowedRect, const IntRect& clipRect) >+bool ShadowBlur::useScaledBlurLayer(GraphicsContext* context) >+{ >+ const AffineTransform transform = context->getCTM(); >+ if (m_shadowsIgnoreTransforms && !transform.isIdentity() && transform.xScale() <= 1 && transform.yScale() <= 1) >+ return true; >+ >+ return false; >+} >+ >+IntRect ShadowBlur::calculateLayerBoundingRect(GraphicsContext* context, const FloatRect& shadowedRect, const IntRect& clipRect, const bool scaledBlurLayer) > { > IntSize edgeSize = blurredEdgeSize(); > >@@ -406,7 +415,7 @@ IntRect ShadowBlur::calculateLayerBoundingRect(GraphicsContext* context, const F > IntSize inflation; > > const AffineTransform transform = context->getCTM(); >- if (m_shadowsIgnoreTransforms && !transform.isIdentity()) { >+ if (m_shadowsIgnoreTransforms && !transform.isIdentity() && !scaledBlurLayer) { > FloatQuad transformedPolygon = transform.mapQuad(FloatQuad(shadowedRect)); > transformedPolygon.move(m_offset); > layerRect = transform.inverse().mapQuad(transformedPolygon).boundingBox(); >@@ -885,9 +894,15 @@ void ShadowBlur::blurAndColorShadowBuffer(const IntSize& templateSize) > > GraphicsContext* ShadowBlur::beginShadowLayer(GraphicsContext *context, const FloatRect& layerArea) > { >- adjustBlurRadius(context); >+ FloatRect scaledLayerArea = layerArea; >+ bool scaledBlurLayer = useScaledBlurLayer(context); >+ const AffineTransform transform = context->getCTM(); >+ if (scaledBlurLayer) >+ scaledLayerArea.scale(static_cast<float>(transform.xScale()), static_cast<float>(transform.yScale())); >+ else >+ adjustBlurRadius(context); > >- IntRect layerRect = calculateLayerBoundingRect(context, layerArea, context->clipBounds()); >+ IntRect layerRect = calculateLayerBoundingRect(context, scaledLayerArea, context->clipBounds(), scaledBlurLayer); > > if (layerRect.isEmpty()) > return 0; >@@ -904,6 +919,10 @@ GraphicsContext* ShadowBlur::beginShadowLayer(GraphicsContext *context, const Fl > shadowContext->clearRect(FloatRect(0, 0, m_layerSize.width() + 1, m_layerSize.height() + 1)); > > shadowContext->translate(m_layerContextTranslation); >+ >+ if (scaledBlurLayer) >+ shadowContext->scale(FloatSize(static_cast<float>(transform.xScale()), static_cast<float>(transform.yScale()))); >+ > return shadowContext; > } > >@@ -914,6 +933,10 @@ void ShadowBlur::endShadowLayer(GraphicsContext* context) > blurAndColorShadowBuffer(expandedIntSize(m_layerSize)); > GraphicsContextStateSaver stateSave(*context); > >+ if (useScaledBlurLayer(context)) { >+ AffineTransform transform = context->getCTM(); >+ context->scale(FloatSize(1 / static_cast<float>(transform.xScale()), 1 / static_cast<float>(transform.yScale()))); >+ } > context->clearShadow(); > context->drawImageBuffer(m_layerImage, ColorSpaceDeviceRGB, roundedIntPoint(m_layerOrigin), IntRect(0, 0, m_layerSize.width(), m_layerSize.height()), context->compositeOperation()); > >diff --git a/Source/WebCore/platform/graphics/ShadowBlur.h b/Source/WebCore/platform/graphics/ShadowBlur.h >index 32ff60b..8895ac4 100644 >--- a/Source/WebCore/platform/graphics/ShadowBlur.h >+++ b/Source/WebCore/platform/graphics/ShadowBlur.h >@@ -84,7 +84,7 @@ private: > InnerShadow > }; > >- IntRect calculateLayerBoundingRect(GraphicsContext*, const FloatRect& layerArea, const IntRect& clipRect); >+ IntRect calculateLayerBoundingRect(GraphicsContext*, const FloatRect& layerArea, const IntRect& clipRect, const bool scaledBlurLayer = false); > IntSize templateSize(const IntSize& blurredEdgeSize, const RoundedRect::Radii&) const; > > void drawRectShadowWithoutTiling(GraphicsContext*, const FloatRect&, const RoundedRect::Radii&, const IntRect& layerRect); >@@ -100,6 +100,7 @@ private: > > IntSize blurredEdgeSize() const; > >+ bool useScaledBlurLayer(GraphicsContext*); > > ShadowType m_type; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 120346
:
209729
|
209730
|
209733
|
209735
|
209736
|
209738
|
211396
|
214427