summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RenderSVGResourceGradient.cpp
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-07-15 12:03:35 +0100
committerLeon Clarke <leonclarke@google.com>2010-07-20 16:57:23 +0100
commite458d70a0d18538346f41b503114c9ebe6b2ce12 (patch)
tree86f1637deca2c524432a822e5fcedd4bef221091 /WebCore/rendering/RenderSVGResourceGradient.cpp
parentf43eabc081f7ce6af24b9df4953498a3cd6ca24d (diff)
downloadexternal_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.zip
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.gz
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.bz2
Merge WebKit at r63173 : Initial merge by git.
Change-Id: Ife5af0c7c6261fbbc8ae6bc08c390efa9ef10b44
Diffstat (limited to 'WebCore/rendering/RenderSVGResourceGradient.cpp')
-rw-r--r--WebCore/rendering/RenderSVGResourceGradient.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/WebCore/rendering/RenderSVGResourceGradient.cpp b/WebCore/rendering/RenderSVGResourceGradient.cpp
index 7ea70d2..74f5b13 100644
--- a/WebCore/rendering/RenderSVGResourceGradient.cpp
+++ b/WebCore/rendering/RenderSVGResourceGradient.cpp
@@ -73,17 +73,12 @@ void RenderSVGResourceGradient::invalidateClient(RenderObject* object)
}
#if PLATFORM(CG)
-static inline AffineTransform absoluteTransformForRenderer(const RenderObject* object)
+static inline AffineTransform absoluteTransformFromContext(GraphicsContext* context)
{
- AffineTransform absoluteTransform;
-
- const RenderObject* currentObject = object;
- while (currentObject) {
- absoluteTransform = currentObject->localToParentTransform() * absoluteTransform;
- currentObject = currentObject->parent();
- }
-
- return absoluteTransform;
+ // Extract current transformation matrix used in the original context. Note that this coordinate
+ // system is flipped compared to SVGs internal coordinate system, done in WebKit level. Fix
+ // this transformation by flipping the y component.
+ return context->getCTM() * AffineTransform().flipY();
}
static inline bool createMaskAndSwapContextForTextGradient(GraphicsContext*& context,
@@ -93,7 +88,7 @@ static inline bool createMaskAndSwapContextForTextGradient(GraphicsContext*& con
{
const RenderObject* textRootBlock = SVGRenderSupport::findTextRootObject(object);
- AffineTransform transform = absoluteTransformForRenderer(textRootBlock);
+ AffineTransform transform(absoluteTransformFromContext(context));
FloatRect maskAbsoluteBoundingBox = transform.mapRect(textRootBlock->repaintRectInLocalCoordinates());
IntRect maskImageRect = enclosingIntRect(maskAbsoluteBoundingBox);
@@ -111,7 +106,7 @@ static inline bool createMaskAndSwapContextForTextGradient(GraphicsContext*& con
maskImageContext->translate(-maskAbsoluteBoundingBox.x(), -maskAbsoluteBoundingBox.y());
maskImageContext->concatCTM(transform);
- imageBuffer.set(maskImage.release());
+ imageBuffer = maskImage.release();
savedContext = context;
context = maskImageContext;
@@ -124,7 +119,13 @@ static inline AffineTransform clipToTextMask(GraphicsContext* context,
GradientData* gradientData)
{
const RenderObject* textRootBlock = SVGRenderSupport::findTextRootObject(object);
- context->clipToImageBuffer(textRootBlock->repaintRectInLocalCoordinates(), imageBuffer.get());
+
+ // The mask image has been created in the device coordinate space, as the image should not be scaled.
+ // So the actual masking process has to be done in the device coordinate space as well.
+ AffineTransform transform(absoluteTransformFromContext(context));
+ context->concatCTM(transform.inverse());
+ context->clipToImageBuffer(transform.mapRect(textRootBlock->repaintRectInLocalCoordinates()), imageBuffer.get());
+ context->concatCTM(transform);
AffineTransform matrix;
if (gradientData->boundingBoxMode) {