Merge SVGImageBufferTools to SVGRenderingContext
authorzherczeg@webkit.org <zherczeg@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Mar 2012 12:51:40 +0000 (12:51 +0000)
committerzherczeg@webkit.org <zherczeg@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Mar 2012 12:51:40 +0000 (12:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=81890

Reviewed by Nikolas Zimmermann.

Copy the code to SVGRenderingContext and delete
SVGImageBufferTools[.cpp.h]. Update build systems,
no functionality change. This is the first step
towards making SVGImageBufferTools stageful.

Existing tests cover this issue.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/filters/FETile.cpp:
(WebCore::FETile::platformApplySoftware):
* rendering/svg/RenderSVGAllInOne.cpp:
* rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::applyClippingToContext):
(WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):
* rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::applyResource):
* rendering/svg/RenderSVGResourceGradient.cpp:
(WebCore::createMaskAndSwapContextForTextGradient):
(WebCore::clipToTextMask):
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::applyResource):
(WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::applyResource):
(WebCore::RenderSVGResourcePattern::createTileImage):
* rendering/svg/SVGImageBufferTools.cpp: Removed.
* rendering/svg/SVGImageBufferTools.h: Removed.
* rendering/svg/SVGInlineTextBox.cpp:
* rendering/svg/SVGRenderingContext.cpp:
(WebCore::currentContentTransformation):
(WebCore):
(WebCore::SVGRenderingContext::calculateTransformationToOutermostSVGCoordinateSystem):
(WebCore::SVGRenderingContext::createImageBuffer):
(WebCore::SVGRenderingContext::createImageBufferForPattern):
(WebCore::SVGRenderingContext::renderSubtreeToImageBuffer):
(WebCore::SVGRenderingContext::clipToImageBuffer):
(WebCore::SVGRenderingContext::clampedAbsoluteTargetRect):
(WebCore::SVGRenderingContext::clampedAbsoluteSize):
(WebCore::SVGRenderingContext::clear2DRotation):
* rendering/svg/SVGRenderingContext.h:
(SVGRenderingContext):
(WebCore::SVGRenderingContext::calculateImageBufferRect):
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::platformApplySoftware):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111674 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/filters/FETile.cpp
Source/WebCore/rendering/svg/RenderSVGAllInOne.cpp
Source/WebCore/rendering/svg/RenderSVGInlineText.cpp
Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp
Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp
Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp
Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp
Source/WebCore/rendering/svg/SVGImageBufferTools.cpp [deleted file]
Source/WebCore/rendering/svg/SVGImageBufferTools.h [deleted file]
Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
Source/WebCore/rendering/svg/SVGRenderingContext.cpp
Source/WebCore/rendering/svg/SVGRenderingContext.h
Source/WebCore/svg/graphics/filters/SVGFEImage.cpp

index 55a2449..baf3112 100644 (file)
@@ -1728,7 +1728,6 @@ IF (ENABLE_SVG)
         rendering/svg/RenderSVGTextPath.cpp
         rendering/svg/RenderSVGTransformableContainer.cpp
         rendering/svg/RenderSVGViewportContainer.cpp
-        rendering/svg/SVGImageBufferTools.cpp
         rendering/svg/SVGInlineFlowBox.cpp
         rendering/svg/SVGInlineTextBox.cpp
         rendering/svg/SVGMarkerLayoutInfo.cpp
index 0daa38d..e26836c 100644 (file)
@@ -1,3 +1,61 @@
+2012-03-22  Zoltan Herczeg  <zherczeg@webkit.org>
+
+        Merge SVGImageBufferTools to SVGRenderingContext
+        https://bugs.webkit.org/show_bug.cgi?id=81890
+
+        Reviewed by Nikolas Zimmermann.
+
+        Copy the code to SVGRenderingContext and delete
+        SVGImageBufferTools[.cpp.h]. Update build systems,
+        no functionality change. This is the first step
+        towards making SVGImageBufferTools stageful.
+
+        Existing tests cover this issue.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/filters/FETile.cpp:
+        (WebCore::FETile::platformApplySoftware):
+        * rendering/svg/RenderSVGAllInOne.cpp:
+        * rendering/svg/RenderSVGInlineText.cpp:
+        (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
+        * rendering/svg/RenderSVGResourceClipper.cpp:
+        (WebCore::RenderSVGResourceClipper::applyClippingToContext):
+        (WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):
+        * rendering/svg/RenderSVGResourceFilter.cpp:
+        (WebCore::RenderSVGResourceFilter::applyResource):
+        * rendering/svg/RenderSVGResourceGradient.cpp:
+        (WebCore::createMaskAndSwapContextForTextGradient):
+        (WebCore::clipToTextMask):
+        * rendering/svg/RenderSVGResourceMasker.cpp:
+        (WebCore::RenderSVGResourceMasker::applyResource):
+        (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
+        * rendering/svg/RenderSVGResourcePattern.cpp:
+        (WebCore::RenderSVGResourcePattern::applyResource):
+        (WebCore::RenderSVGResourcePattern::createTileImage):
+        * rendering/svg/SVGImageBufferTools.cpp: Removed.
+        * rendering/svg/SVGImageBufferTools.h: Removed.
+        * rendering/svg/SVGInlineTextBox.cpp:
+        * rendering/svg/SVGRenderingContext.cpp:
+        (WebCore::currentContentTransformation):
+        (WebCore):
+        (WebCore::SVGRenderingContext::calculateTransformationToOutermostSVGCoordinateSystem):
+        (WebCore::SVGRenderingContext::createImageBuffer):
+        (WebCore::SVGRenderingContext::createImageBufferForPattern):
+        (WebCore::SVGRenderingContext::renderSubtreeToImageBuffer):
+        (WebCore::SVGRenderingContext::clipToImageBuffer):
+        (WebCore::SVGRenderingContext::clampedAbsoluteTargetRect):
+        (WebCore::SVGRenderingContext::clampedAbsoluteSize):
+        (WebCore::SVGRenderingContext::clear2DRotation):
+        * rendering/svg/SVGRenderingContext.h:
+        (SVGRenderingContext):
+        (WebCore::SVGRenderingContext::calculateImageBufferRect):
+        * svg/graphics/filters/SVGFEImage.cpp:
+        (WebCore::FEImage::platformApplySoftware):
+
 2012-03-22  Hyowon Kim  <hw1008.kim@samsung.com>
 
         [EFL] Add PageClientEfl to WebCoreSupport.
index 3a05792..8e26f26 100644 (file)
@@ -3958,8 +3958,6 @@ webcore_sources += \
        Source/WebCore/rendering/svg/RenderSVGTransformableContainer.h \
        Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp \
        Source/WebCore/rendering/svg/RenderSVGViewportContainer.h \
-       Source/WebCore/rendering/svg/SVGImageBufferTools.cpp \
-       Source/WebCore/rendering/svg/SVGImageBufferTools.h \
        Source/WebCore/rendering/svg/SVGInlineFlowBox.cpp \
        Source/WebCore/rendering/svg/SVGInlineFlowBox.h \
        Source/WebCore/rendering/svg/SVGInlineTextBox.cpp \
index ce744d4..0e2db6d 100644 (file)
@@ -2517,7 +2517,6 @@ HEADERS += \
     rendering/svg/RenderSVGTextPath.h \
     rendering/svg/RenderSVGTransformableContainer.h \
     rendering/svg/RenderSVGViewportContainer.h \
-    rendering/svg/SVGImageBufferTools.h \
     rendering/svg/SVGInlineFlowBox.h \
     rendering/svg/SVGInlineTextBox.h \
     rendering/svg/SVGMarkerData.h \
@@ -3462,7 +3461,6 @@ contains(DEFINES, ENABLE_SVG=1) {
               rendering/svg/RenderSVGTextPath.cpp \
               rendering/svg/RenderSVGTransformableContainer.cpp \
               rendering/svg/RenderSVGViewportContainer.cpp \
-              rendering/svg/SVGImageBufferTools.cpp \
               rendering/svg/SVGInlineFlowBox.cpp \
               rendering/svg/SVGInlineTextBox.cpp \
               rendering/svg/SVGMarkerLayoutInfo.cpp \
index f00140e..cd0851b 100644 (file)
             'rendering/style/StyleSurroundData.cpp',
             'rendering/style/StyleTransformData.cpp',
             'rendering/style/StyleVisualData.cpp',
-            'rendering/svg/SVGImageBufferTools.cpp',
-            'rendering/svg/SVGImageBufferTools.h',
             'rendering/svg/SVGInlineFlowBox.cpp',
             'rendering/svg/SVGInlineFlowBox.h',
             'rendering/svg/SVGInlineTextBox.cpp',
             'rendering/svg/RenderSVGTransformableContainer.h',
             'rendering/svg/RenderSVGViewportContainer.cpp',
             'rendering/svg/RenderSVGViewportContainer.h',
-            'rendering/svg/SVGImageBufferTools.cpp',
-            'rendering/svg/SVGImageBufferTools.h',
             'rendering/svg/SVGInlineFlowBox.cpp',
             'rendering/svg/SVGInlineFlowBox.h',
             'rendering/svg/SVGInlineTextBox.cpp',
index e60a79c..ff2a171 100644 (file)
                436708E512D9CA4B00044234 /* RenderSVGRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708A612D9CA4B00044234 /* RenderSVGRoot.h */; };
                436708E912D9CA4B00044234 /* RenderSVGTransformableContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AA12D9CA4B00044234 /* RenderSVGTransformableContainer.h */; };
                436708EB12D9CA4B00044234 /* RenderSVGViewportContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AC12D9CA4B00044234 /* RenderSVGViewportContainer.h */; };
-               436708ED12D9CA4B00044234 /* SVGImageBufferTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AE12D9CA4B00044234 /* SVGImageBufferTools.h */; };
                436708EE12D9CA4B00044234 /* SVGMarkerData.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708AF12D9CA4B00044234 /* SVGMarkerData.h */; };
                436708F012D9CA4B00044234 /* SVGMarkerLayoutInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B112D9CA4B00044234 /* SVGMarkerLayoutInfo.h */; };
                436708F212D9CA4B00044234 /* SVGRenderSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 436708B312D9CA4B00044234 /* SVGRenderSupport.h */; };
                436708AA12D9CA4B00044234 /* RenderSVGTransformableContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGTransformableContainer.h; sourceTree = "<group>"; };
                436708AB12D9CA4B00044234 /* RenderSVGViewportContainer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGViewportContainer.cpp; sourceTree = "<group>"; };
                436708AC12D9CA4B00044234 /* RenderSVGViewportContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGViewportContainer.h; sourceTree = "<group>"; };
-               436708AD12D9CA4B00044234 /* SVGImageBufferTools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGImageBufferTools.cpp; sourceTree = "<group>"; };
-               436708AE12D9CA4B00044234 /* SVGImageBufferTools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageBufferTools.h; sourceTree = "<group>"; };
                436708AF12D9CA4B00044234 /* SVGMarkerData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerData.h; sourceTree = "<group>"; };
                436708B012D9CA4B00044234 /* SVGMarkerLayoutInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGMarkerLayoutInfo.cpp; sourceTree = "<group>"; };
                436708B112D9CA4B00044234 /* SVGMarkerLayoutInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerLayoutInfo.h; sourceTree = "<group>"; };
                                0854B00B1255E4E600B9CDD0 /* RenderSVGTSpan.h */,
                                436708AB12D9CA4B00044234 /* RenderSVGViewportContainer.cpp */,
                                436708AC12D9CA4B00044234 /* RenderSVGViewportContainer.h */,
-                               436708AD12D9CA4B00044234 /* SVGImageBufferTools.cpp */,
-                               436708AE12D9CA4B00044234 /* SVGImageBufferTools.h */,
                                0854B00C1255E4E600B9CDD0 /* SVGInlineFlowBox.cpp */,
                                0854B00D1255E4E600B9CDD0 /* SVGInlineFlowBox.h */,
                                0854B00E1255E4E600B9CDD0 /* SVGInlineTextBox.cpp */,
                                B2227A2A0D00BF220071B782 /* SVGGradientElement.h in Headers */,
                                650FBF2B0D9AF047008FC292 /* SVGHKernElement.h in Headers */,
                                B25599A40D00D8BA00BB825C /* SVGImage.h in Headers */,
-                               436708ED12D9CA4B00044234 /* SVGImageBufferTools.h in Headers */,
                                08F859D51463F9CD0067D933 /* SVGImageCache.h in Headers */,
                                B2227A2D0D00BF220071B782 /* SVGImageElement.h in Headers */,
                                B28C6A2A0D00C44800334AA4 /* SVGImageLoader.h in Headers */,
index e4a9508..3db7a7c 100644 (file)
@@ -28,7 +28,7 @@
 #include "GraphicsContext.h"
 #include "Pattern.h"
 #include "RenderTreeAsText.h"
-#include "SVGImageBufferTools.h"
+#include "SVGRenderingContext.h"
 #include "TextStream.h"
 
 namespace WebCore {
@@ -67,7 +67,7 @@ void FETile::platformApplySoftware()
     }
 
     OwnPtr<ImageBuffer> tileImage;
-    if (!SVGImageBufferTools::createImageBufferForPattern(tileRect, tileRect, tileImage, ColorSpaceDeviceRGB, filter()->renderingMode()))
+    if (!SVGRenderingContext::createImageBufferForPattern(tileRect, tileRect, tileImage, ColorSpaceDeviceRGB, filter()->renderingMode()))
         return;
 
     GraphicsContext* tileImageContext = tileImage->context();
index 8f8c86e..b467c46 100644 (file)
@@ -55,7 +55,6 @@
 #include "RenderSVGTextPath.cpp"
 #include "RenderSVGTransformableContainer.cpp"
 #include "RenderSVGViewportContainer.cpp"
-#include "SVGImageBufferTools.cpp"
 #include "SVGInlineFlowBox.cpp"
 #include "SVGInlineTextBox.cpp"
 #include "SVGMarkerLayoutInfo.cpp"
index 5913162..df26f28 100644 (file)
@@ -34,8 +34,8 @@
 #include "RenderSVGRoot.h"
 #include "RenderSVGText.h"
 #include "Settings.h"
-#include "SVGImageBufferTools.h"
 #include "SVGInlineTextBox.h"
+#include "SVGRenderingContext.h"
 #include "SVGRootInlineBox.h"
 #include "VisiblePosition.h"
 
@@ -258,7 +258,7 @@ void RenderSVGInlineText::computeNewScaledFontForStyle(RenderObject* renderer, c
 
     // Alter font-size to the right on-screen value to avoid scaling the glyphs themselves, except when GeometricPrecision is specified
     AffineTransform ctm;
-    SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(renderer, ctm);
+    SVGRenderingContext::calculateTransformationToOutermostSVGCoordinateSystem(renderer, ctm);
     scalingFactor = narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(), 2)) / 2));
     if (scalingFactor == 1 || !scalingFactor || style->fontDescription().textRenderingMode() == GeometricPrecision) {
         scalingFactor = 1;
index 5742061..7339e28 100644 (file)
@@ -39,9 +39,9 @@
 #include "RenderStyle.h"
 #include "SVGClipPathElement.h"
 #include "SVGElement.h"
-#include "SVGImageBufferTools.h"
 #include "SVGNames.h"
 #include "SVGRenderSupport.h"
+#include "SVGRenderingContext.h"
 #include "SVGResources.h"
 #include "SVGResourcesCache.h"
 #include "SVGStyledElement.h"
@@ -169,10 +169,10 @@ bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* object, cons
     }
 
     AffineTransform absoluteTransform;
-    SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransform);
+    SVGRenderingContext::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransform);
 
     if (shouldCreateClipData && !repaintRect.isEmpty()) {
-        if (!SVGImageBufferTools::createImageBuffer(repaintRect, absoluteTransform, clipperData->clipMaskImage, ColorSpaceDeviceRGB, Unaccelerated))
+        if (!SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransform, clipperData->clipMaskImage, ColorSpaceDeviceRGB, Unaccelerated))
             return false;
 
         GraphicsContext* maskContext = clipperData->clipMaskImage->context();
@@ -202,7 +202,7 @@ bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* object, cons
     if (!clipperData->clipMaskImage)
         return false;
 
-    SVGImageBufferTools::clipToImageBuffer(context, absoluteTransform, repaintRect, clipperData->clipMaskImage, missingClipperData);
+    SVGRenderingContext::clipToImageBuffer(context, absoluteTransform, repaintRect, clipperData->clipMaskImage, missingClipperData);
     return true;
 }
 
@@ -264,7 +264,7 @@ bool RenderSVGResourceClipper::drawContentIntoMaskImage(ClipperData* clipperData
         // In the case of a <use> element, we obtained its renderere above, to retrieve its clipRule.
         // We have to pass the <use> renderer itself to renderSubtreeToImageBuffer() to apply it's x/y/transform/etc. values when rendering.
         // So if isUseElement is true, refetch the childNode->renderer(), as renderer got overriden above.
-        SVGImageBufferTools::renderSubtreeToImageBuffer(clipperData->clipMaskImage.get(), isUseElement ? childNode->renderer() : renderer, maskContentTransformation);
+        SVGRenderingContext::renderSubtreeToImageBuffer(clipperData->clipMaskImage.get(), isUseElement ? childNode->renderer() : renderer, maskContentTransformation);
     }
 
     frame()->view()->setPaintBehavior(oldBehavior);
index 43ebee2..d5d792d 100644 (file)
@@ -43,8 +43,8 @@
 #include "SVGFilter.h"
 #include "SVGFilterElement.h"
 #include "SVGFilterPrimitiveStandardAttributes.h"
-#include "SVGImageBufferTools.h"
 #include "SVGNames.h"
+#include "SVGRenderingContext.h"
 #include "SVGStyledElement.h"
 #include "SVGUnitTypes.h"
 
@@ -165,7 +165,7 @@ bool RenderSVGResourceFilter::applyResource(RenderObject* object, RenderStyle*,
 
     // Determine absolute transformation matrix for filter. 
     AffineTransform absoluteTransform;
-    SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransform);
+    SVGRenderingContext::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransform);
     if (!absoluteTransform.isInvertible())
         return false;
 
@@ -235,7 +235,7 @@ bool RenderSVGResourceFilter::applyResource(RenderObject* object, RenderStyle*,
 
     OwnPtr<ImageBuffer> sourceGraphic;
     RenderingMode renderingMode = object->document()->page()->settings()->acceleratedFiltersEnabled() ? Accelerated : Unaccelerated;
-    if (!SVGImageBufferTools::createImageBuffer(drawingRegion, effectiveTransform, sourceGraphic, ColorSpaceLinearRGB, renderingMode)) {
+    if (!SVGRenderingContext::createImageBuffer(drawingRegion, effectiveTransform, sourceGraphic, ColorSpaceLinearRGB, renderingMode)) {
         ASSERT(!m_filter.contains(object));
         filterData->savedContext = context;
         m_filter.set(object, filterData.leakPtr());
index 1a1d5a0..907fe16 100644 (file)
@@ -29,8 +29,8 @@
 #include "GraphicsContext.h"
 #include "RenderSVGShape.h"
 #include "RenderSVGText.h"
-#include "SVGImageBufferTools.h"
 #include "SVGRenderSupport.h"
+#include "SVGRenderingContext.h"
 #include <wtf/UnusedParam.h>
 
 namespace WebCore {
@@ -68,11 +68,11 @@ static inline bool createMaskAndSwapContextForTextGradient(GraphicsContext*& con
     ASSERT(textRootBlock);
 
     AffineTransform absoluteTransform;
-    SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(textRootBlock, absoluteTransform);
+    SVGRenderingContext::calculateTransformationToOutermostSVGCoordinateSystem(textRootBlock, absoluteTransform);
 
     FloatRect repaintRect = textRootBlock->repaintRectInLocalCoordinates();
     OwnPtr<ImageBuffer> maskImage;
-    if (!SVGImageBufferTools::createImageBuffer(repaintRect, absoluteTransform, maskImage, ColorSpaceDeviceRGB, Unaccelerated))
+    if (!SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransform, maskImage, ColorSpaceDeviceRGB, Unaccelerated))
         return false;
 
     GraphicsContext* maskImageContext = maskImage->context();
@@ -95,10 +95,10 @@ static inline AffineTransform clipToTextMask(GraphicsContext* context,
     ASSERT(textRootBlock);
 
     AffineTransform absoluteTransform;
-    SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(textRootBlock, absoluteTransform);
+    SVGRenderingContext::calculateTransformationToOutermostSVGCoordinateSystem(textRootBlock, absoluteTransform);
 
     targetRect = textRootBlock->repaintRectInLocalCoordinates();
-    SVGImageBufferTools::clipToImageBuffer(context, absoluteTransform, targetRect, imageBuffer, false);
+    SVGRenderingContext::clipToImageBuffer(context, absoluteTransform, targetRect, imageBuffer, false);
 
     AffineTransform matrix;
     if (boundingBoxMode) {
index f7a35e3..a527455 100644 (file)
@@ -32,8 +32,8 @@
 #include "IntRect.h"
 #include "RenderSVGResource.h"
 #include "SVGElement.h"
-#include "SVGImageBufferTools.h"
 #include "SVGMaskElement.h"
+#include "SVGRenderingContext.h"
 #include "SVGStyledElement.h"
 #include "SVGUnitTypes.h"
 
@@ -93,7 +93,7 @@ bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*,
     MaskerData* maskerData = m_masker.get(object);
 
     AffineTransform absoluteTransform;
-    SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransform);
+    SVGRenderingContext::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransform);
 
     FloatRect repaintRect = object->repaintRectInLocalCoordinates();
 
@@ -106,7 +106,7 @@ bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*,
         const SVGRenderStyle* svgStyle = style()->svgStyle();
         ASSERT(svgStyle);
         ColorSpace colorSpace = svgStyle->colorInterpolation() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB;
-        if (!SVGImageBufferTools::createImageBuffer(repaintRect, absoluteTransform, maskerData->maskImage, colorSpace, Unaccelerated))
+        if (!SVGRenderingContext::createImageBuffer(repaintRect, absoluteTransform, maskerData->maskImage, colorSpace, Unaccelerated))
             return false;
 
         if (!drawContentIntoMaskImage(maskerData, colorSpace, maskElement, object)) {
@@ -117,7 +117,7 @@ bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*,
     if (!maskerData->maskImage)
         return false;
 
-    SVGImageBufferTools::clipToImageBuffer(context, absoluteTransform, repaintRect, maskerData->maskImage, missingMaskerData);
+    SVGRenderingContext::clipToImageBuffer(context, absoluteTransform, repaintRect, maskerData->maskImage, missingMaskerData);
     return true;
 }
 
@@ -145,7 +145,7 @@ bool RenderSVGResourceMasker::drawContentIntoMaskImage(MaskerData* maskerData, C
         RenderStyle* style = renderer->style();
         if (!style || style->display() == NONE || style->visibility() != VISIBLE)
             continue;
-        SVGImageBufferTools::renderSubtreeToImageBuffer(maskerData->maskImage.get(), renderer, maskContentTransformation);
+        SVGRenderingContext::renderSubtreeToImageBuffer(maskerData->maskImage.get(), renderer, maskContentTransformation);
     }
 
 #if !USE(CG)
index f727bb0..bec0f33 100644 (file)
@@ -27,8 +27,8 @@
 #include "GraphicsContext.h"
 #include "PatternAttributes.h"
 #include "RenderSVGRoot.h"
-#include "SVGImageBufferTools.h"
 #include "SVGRenderSupport.h"
+#include "SVGRenderingContext.h"
 
 namespace WebCore {
 
@@ -99,10 +99,10 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
             return false;
 
         AffineTransform absoluteTransformIgnoringRotation;
-        SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransformIgnoringRotation);
+        SVGRenderingContext::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransformIgnoringRotation);
 
         // Ignore 2D rotation, as it doesn't affect the size of the tile.
-        SVGImageBufferTools::clear2DRotation(absoluteTransformIgnoringRotation);
+        SVGRenderingContext::clear2DRotation(absoluteTransformIgnoringRotation);
         FloatRect absoluteTileBoundaries = absoluteTransformIgnoringRotation.mapRect(tileBoundaries);
         FloatRect clampedAbsoluteTileBoundaries;
 
@@ -232,11 +232,11 @@ PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(const PatternA
                                                                   const AffineTransform& tileImageTransform,
                                                                   FloatRect& clampedAbsoluteTileBoundaries) const
 {
-    clampedAbsoluteTileBoundaries = SVGImageBufferTools::clampedAbsoluteTargetRect(absoluteTileBoundaries);
+    clampedAbsoluteTileBoundaries = SVGRenderingContext::clampedAbsoluteTargetRect(absoluteTileBoundaries);
 
     OwnPtr<ImageBuffer> tileImage;
 
-    if (!SVGImageBufferTools::createImageBufferForPattern(absoluteTileBoundaries, clampedAbsoluteTileBoundaries, tileImage, ColorSpaceDeviceRGB, Unaccelerated))
+    if (!SVGRenderingContext::createImageBufferForPattern(absoluteTileBoundaries, clampedAbsoluteTileBoundaries, tileImage, ColorSpaceDeviceRGB, Unaccelerated))
         return nullptr;
 
     GraphicsContext* tileImageContext = tileImage->context();
@@ -260,7 +260,7 @@ PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(const PatternA
             continue;
         if (node->renderer()->needsLayout())
             return nullptr;
-        SVGImageBufferTools::renderSubtreeToImageBuffer(tileImage.get(), node->renderer(), contentTransformation);
+        SVGRenderingContext::renderSubtreeToImageBuffer(tileImage.get(), node->renderer(), contentTransformation);
     }
 
     return tileImage.release();
diff --git a/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp b/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp
deleted file mode 100644 (file)
index 1294196..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (C) Research In Motion Limited 2010. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGImageBufferTools.h"
-
-#include "FrameView.h"
-#include "GraphicsContext.h"
-#include "RenderObject.h"
-#include "RenderSVGContainer.h"
-#include "RenderSVGRoot.h"
-
-static int kMaxImageBufferSize = 4096;
-
-namespace WebCore {
-
-static AffineTransform& currentContentTransformation()
-{
-    DEFINE_STATIC_LOCAL(AffineTransform, s_currentContentTransformation, ());
-    return s_currentContentTransformation;
-}
-
-void SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(const RenderObject* renderer, AffineTransform& absoluteTransform)
-{
-    const RenderObject* current = renderer;
-    ASSERT(current);
-
-    absoluteTransform = currentContentTransformation();
-    while (current) {
-        absoluteTransform = current->localToParentTransform() * absoluteTransform;
-        if (current->isSVGRoot())
-            break;
-        current = current->parent();
-    }
-}
-
-bool SVGImageBufferTools::createImageBuffer(const FloatRect& targetRect, const AffineTransform& absoluteTransform, OwnPtr<ImageBuffer>& imageBuffer, ColorSpace colorSpace, RenderingMode renderingMode)
-{
-    IntRect paintRect = calculateImageBufferRect(targetRect, absoluteTransform);
-    // Don't create empty ImageBuffers.
-    if (paintRect.isEmpty())
-        return false;
-
-    IntSize clampedSize = clampedAbsoluteSize(paintRect.size());
-    OwnPtr<ImageBuffer> image = ImageBuffer::create(clampedSize, 1, colorSpace, renderingMode);
-    if (!image)
-        return false;
-
-    GraphicsContext* imageContext = image->context();
-    ASSERT(imageContext);
-
-    // This is done in absolute coordinates.
-    imageContext->translate(-paintRect.x(), -paintRect.y());
-
-    imageContext->concatCTM(absoluteTransform);
-
-    // This happens in local coordinates.
-    imageContext->scale(FloatSize(static_cast<float>(clampedSize.width()) / paintRect.width(),
-                                  static_cast<float>(clampedSize.height()) / paintRect.height()));
-
-    imageBuffer = image.release();
-    return true;
-}
-
-bool SVGImageBufferTools::createImageBufferForPattern(const FloatRect& absoluteTargetRect, const FloatRect& clampedAbsoluteTargetRect, OwnPtr<ImageBuffer>& imageBuffer, ColorSpace colorSpace, RenderingMode renderingMode)
-{
-    IntSize imageSize(roundedIntSize(clampedAbsoluteTargetRect.size()));
-    IntSize unclampedImageSize(roundedIntSize(absoluteTargetRect.size()));
-
-    // Don't create empty ImageBuffers.
-    if (imageSize.isEmpty())
-        return false;
-
-    OwnPtr<ImageBuffer> image = ImageBuffer::create(imageSize, 1, colorSpace, renderingMode);
-    if (!image)
-        return false;
-
-    GraphicsContext* imageContext = image->context();
-    ASSERT(imageContext);
-
-    // Compensate rounding effects, as the absolute target rect is using floating-point numbers and the image buffer size is integer.
-    imageContext->scale(FloatSize(unclampedImageSize.width() / absoluteTargetRect.width(), unclampedImageSize.height() / absoluteTargetRect.height()));
-
-    imageBuffer = image.release();
-    return true;
-}
-
-void SVGImageBufferTools::renderSubtreeToImageBuffer(ImageBuffer* image, RenderObject* item, const AffineTransform& subtreeContentTransformation)
-{
-    ASSERT(item);
-    ASSERT(image);
-    ASSERT(image->context());
-
-    PaintInfo info(image->context(), PaintInfo::infiniteRect(), PaintPhaseForeground, 0, 0, 0, 0);
-
-    AffineTransform& contentTransformation = currentContentTransformation();
-    AffineTransform savedContentTransformation = contentTransformation;
-    contentTransformation = subtreeContentTransformation * contentTransformation;
-
-    ASSERT(!item->needsLayout());
-    item->paint(info, IntPoint());
-
-    contentTransformation = savedContentTransformation;
-}
-
-void SVGImageBufferTools::clipToImageBuffer(GraphicsContext* context, const AffineTransform& absoluteTransform, const FloatRect& targetRect, OwnPtr<ImageBuffer>& imageBuffer, bool safeToClear)
-{
-    ASSERT(context);
-    ASSERT(imageBuffer);
-
-    FloatRect absoluteTargetRect = calculateImageBufferRect(targetRect, absoluteTransform);
-
-    // The mask image has been created in the absolute coordinate space, as the image should not be scaled.
-    // So the actual masking process has to be done in the absolute coordinate space as well.
-    context->concatCTM(absoluteTransform.inverse());
-    context->clipToImageBuffer(imageBuffer.get(), absoluteTargetRect);
-    context->concatCTM(absoluteTransform);
-
-    // When nesting resources, with objectBoundingBox as content unit types, there's no use in caching the
-    // resulting image buffer as the parent resource already caches the result.
-    if (safeToClear && !currentContentTransformation().isIdentity())
-        imageBuffer.clear();
-}
-
-FloatRect SVGImageBufferTools::clampedAbsoluteTargetRect(const FloatRect& absoluteTargetRect)
-{
-    const FloatSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize);
-    return FloatRect(absoluteTargetRect.location(), absoluteTargetRect.size().shrunkTo(maxImageBufferSize));
-}
-
-IntSize SVGImageBufferTools::clampedAbsoluteSize(const IntSize& absoluteSize)
-{
-    const IntSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize);
-    return absoluteSize.shrunkTo(maxImageBufferSize);
-}
-
-void SVGImageBufferTools::clear2DRotation(AffineTransform& transform)
-{
-    AffineTransform::DecomposedType decomposition;
-    transform.decompose(decomposition);
-    decomposition.angle = 0;
-    transform.recompose(decomposition);
-}
-
-}
-
-#endif // ENABLE(SVG)
diff --git a/Source/WebCore/rendering/svg/SVGImageBufferTools.h b/Source/WebCore/rendering/svg/SVGImageBufferTools.h
deleted file mode 100644 (file)
index b71b10d..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) Research In Motion Limited 2010. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef SVGImageBufferTools_h
-#define SVGImageBufferTools_h
-
-#if ENABLE(SVG)
-#include "ImageBuffer.h"
-#include "IntRect.h"
-#include <wtf/Noncopyable.h>
-
-namespace WebCore {
-
-class AffineTransform;
-class FloatRect;
-class FloatSize;
-class GraphicsContext;
-class RenderObject;
-
-class SVGImageBufferTools {
-    WTF_MAKE_NONCOPYABLE(SVGImageBufferTools);
-
-public:
-    static bool createImageBuffer(const FloatRect& paintRect, const AffineTransform& absoluteTransform, OwnPtr<ImageBuffer>&, ColorSpace, RenderingMode);
-    // Patterns need a different float-to-integer coordinate mapping.
-    static bool createImageBufferForPattern(const FloatRect& absoluteTargetRect, const FloatRect& clampedAbsoluteTargetRect, OwnPtr<ImageBuffer>&, ColorSpace, RenderingMode);
-
-    static void renderSubtreeToImageBuffer(ImageBuffer*, RenderObject*, const AffineTransform&);
-    static void clipToImageBuffer(GraphicsContext*, const AffineTransform& absoluteTransform, const FloatRect& targetRect, OwnPtr<ImageBuffer>&, bool safeToClear);
-
-    static void calculateTransformationToOutermostSVGCoordinateSystem(const RenderObject*, AffineTransform& absoluteTransform);
-    static IntSize clampedAbsoluteSize(const IntSize&);
-    static FloatRect clampedAbsoluteTargetRect(const FloatRect& absoluteTargetRect);
-    static void clear2DRotation(AffineTransform&);
-
-    static IntRect calculateImageBufferRect(const FloatRect& targetRect, const AffineTransform& absoluteTransform)
-    {
-        return enclosingIntRect(absoluteTransform.mapRect(targetRect));
-    }
-
-private:
-    SVGImageBufferTools() { }
-    ~SVGImageBufferTools() { }
-};
-
-}
-
-#endif
-#endif
index 8967dda..6db9e0a 100644 (file)
@@ -35,7 +35,7 @@
 #include "RenderSVGInlineText.h"
 #include "RenderSVGResource.h"
 #include "RenderSVGResourceSolidColor.h"
-#include "SVGImageBufferTools.h"
+#include "SVGRenderingContext.h"
 #include "SVGResourcesCache.h"
 #include "SVGRootInlineBox.h"
 #include "SVGTextRunRenderingContext.h"
index 0f13dcf..80f53ef 100644 (file)
 #include "RenderSVGResourceClipper.h"
 #include "RenderSVGResourceFilter.h"
 #include "RenderSVGResourceMasker.h"
-#include "SVGImageBufferTools.h"
 #include "SVGResources.h"
 #include "SVGResourcesCache.h"
 
+static int kMaxImageBufferSize = 4096;
+
 namespace WebCore {
 
 static inline bool isRenderingMaskImage(RenderObject* object)
@@ -160,6 +161,134 @@ void SVGRenderingContext::prepareToRenderSVGContent(RenderObject* object, PaintI
     m_renderingFlags |= RenderingPrepared;
 }
 
+static AffineTransform& currentContentTransformation()
+{
+    DEFINE_STATIC_LOCAL(AffineTransform, s_currentContentTransformation, ());
+    return s_currentContentTransformation;
+}
+
+void SVGRenderingContext::calculateTransformationToOutermostSVGCoordinateSystem(const RenderObject* renderer, AffineTransform& absoluteTransform)
+{
+    const RenderObject* current = renderer;
+    ASSERT(current);
+
+    absoluteTransform = currentContentTransformation();
+    while (current) {
+        absoluteTransform = current->localToParentTransform() * absoluteTransform;
+        if (current->isSVGRoot())
+            break;
+        current = current->parent();
+    }
+}
+
+bool SVGRenderingContext::createImageBuffer(const FloatRect& targetRect, const AffineTransform& absoluteTransform, OwnPtr<ImageBuffer>& imageBuffer, ColorSpace colorSpace, RenderingMode renderingMode)
+{
+    IntRect paintRect = calculateImageBufferRect(targetRect, absoluteTransform);
+    // Don't create empty ImageBuffers.
+    if (paintRect.isEmpty())
+        return false;
+
+    IntSize clampedSize = clampedAbsoluteSize(paintRect.size());
+    OwnPtr<ImageBuffer> image = ImageBuffer::create(clampedSize, 1, colorSpace, renderingMode);
+    if (!image)
+        return false;
+
+    GraphicsContext* imageContext = image->context();
+    ASSERT(imageContext);
+
+    // This is done in absolute coordinates.
+    imageContext->translate(-paintRect.x(), -paintRect.y());
+
+    imageContext->concatCTM(absoluteTransform);
+
+    // This happens in local coordinates.
+    imageContext->scale(FloatSize(static_cast<float>(clampedSize.width()) / paintRect.width(),
+                                  static_cast<float>(clampedSize.height()) / paintRect.height()));
+
+    imageBuffer = image.release();
+    return true;
+}
+
+bool SVGRenderingContext::createImageBufferForPattern(const FloatRect& absoluteTargetRect, const FloatRect& clampedAbsoluteTargetRect, OwnPtr<ImageBuffer>& imageBuffer, ColorSpace colorSpace, RenderingMode renderingMode)
+{
+    IntSize imageSize(roundedIntSize(clampedAbsoluteTargetRect.size()));
+    IntSize unclampedImageSize(roundedIntSize(absoluteTargetRect.size()));
+
+    // Don't create empty ImageBuffers.
+    if (imageSize.isEmpty())
+        return false;
+
+    OwnPtr<ImageBuffer> image = ImageBuffer::create(imageSize, 1, colorSpace, renderingMode);
+    if (!image)
+        return false;
+
+    GraphicsContext* imageContext = image->context();
+    ASSERT(imageContext);
+
+    // Compensate rounding effects, as the absolute target rect is using floating-point numbers and the image buffer size is integer.
+    imageContext->scale(FloatSize(unclampedImageSize.width() / absoluteTargetRect.width(), unclampedImageSize.height() / absoluteTargetRect.height()));
+
+    imageBuffer = image.release();
+    return true;
+}
+
+void SVGRenderingContext::renderSubtreeToImageBuffer(ImageBuffer* image, RenderObject* item, const AffineTransform& subtreeContentTransformation)
+{
+    ASSERT(item);
+    ASSERT(image);
+    ASSERT(image->context());
+
+    PaintInfo info(image->context(), PaintInfo::infiniteRect(), PaintPhaseForeground, 0, 0, 0, 0);
+
+    AffineTransform& contentTransformation = currentContentTransformation();
+    AffineTransform savedContentTransformation = contentTransformation;
+    contentTransformation = subtreeContentTransformation * contentTransformation;
+
+    ASSERT(!item->needsLayout());
+    item->paint(info, IntPoint());
+
+    contentTransformation = savedContentTransformation;
+}
+
+void SVGRenderingContext::clipToImageBuffer(GraphicsContext* context, const AffineTransform& absoluteTransform, const FloatRect& targetRect, OwnPtr<ImageBuffer>& imageBuffer, bool safeToClear)
+{
+    ASSERT(context);
+    ASSERT(imageBuffer);
+
+    FloatRect absoluteTargetRect = calculateImageBufferRect(targetRect, absoluteTransform);
+
+    // The mask image has been created in the absolute coordinate space, as the image should not be scaled.
+    // So the actual masking process has to be done in the absolute coordinate space as well.
+    context->concatCTM(absoluteTransform.inverse());
+    context->clipToImageBuffer(imageBuffer.get(), absoluteTargetRect);
+    context->concatCTM(absoluteTransform);
+
+    // When nesting resources, with objectBoundingBox as content unit types, there's no use in caching the
+    // resulting image buffer as the parent resource already caches the result.
+    if (safeToClear && !currentContentTransformation().isIdentity())
+        imageBuffer.clear();
+}
+
+FloatRect SVGRenderingContext::clampedAbsoluteTargetRect(const FloatRect& absoluteTargetRect)
+{
+    const FloatSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize);
+    return FloatRect(absoluteTargetRect.location(), absoluteTargetRect.size().shrunkTo(maxImageBufferSize));
+}
+
+IntSize SVGRenderingContext::clampedAbsoluteSize(const IntSize& absoluteSize)
+{
+    const IntSize maxImageBufferSize(kMaxImageBufferSize, kMaxImageBufferSize);
+    return absoluteSize.shrunkTo(maxImageBufferSize);
+}
+
+void SVGRenderingContext::clear2DRotation(AffineTransform& transform)
+{
+    AffineTransform::DecomposedType decomposition;
+    transform.decompose(decomposition);
+    decomposition.angle = 0;
+    transform.recompose(decomposition);
+}
+
 }
 
 #endif
index 1dc3d62..4649d9a 100644 (file)
@@ -76,6 +76,23 @@ public:
     void prepareToRenderSVGContent(RenderObject*, PaintInfo&, NeedsGraphicsContextSave = DontSaveGraphicsContext);
     bool isRenderingPrepared() const { return m_renderingFlags & RenderingPrepared; }
 
+    static bool createImageBuffer(const FloatRect& paintRect, const AffineTransform& absoluteTransform, OwnPtr<ImageBuffer>&, ColorSpace, RenderingMode);
+    // Patterns need a different float-to-integer coordinate mapping.
+    static bool createImageBufferForPattern(const FloatRect& absoluteTargetRect, const FloatRect& clampedAbsoluteTargetRect, OwnPtr<ImageBuffer>&, ColorSpace, RenderingMode);
+
+    static void renderSubtreeToImageBuffer(ImageBuffer*, RenderObject*, const AffineTransform&);
+    static void clipToImageBuffer(GraphicsContext*, const AffineTransform& absoluteTransform, const FloatRect& targetRect, OwnPtr<ImageBuffer>&, bool safeToClear);
+
+    static void calculateTransformationToOutermostSVGCoordinateSystem(const RenderObject*, AffineTransform& absoluteTransform);
+    static IntSize clampedAbsoluteSize(const IntSize&);
+    static FloatRect clampedAbsoluteTargetRect(const FloatRect& absoluteTargetRect);
+    static void clear2DRotation(AffineTransform&);
+
+    static IntRect calculateImageBufferRect(const FloatRect& targetRect, const AffineTransform& absoluteTransform)
+    {
+        return enclosingIntRect(absoluteTransform.mapRect(targetRect));
+    }
+
 private:
     // To properly revert partially successful initializtions in the destructor, we record all successful steps.
     enum RenderingFlags {
index 439c66a..62a1af5 100644 (file)
@@ -31,8 +31,8 @@
 #include "RenderObject.h"
 #include "RenderTreeAsText.h"
 #include "SVGFilter.h"
-#include "SVGImageBufferTools.h"
 #include "SVGPreserveAspectRatio.h"
+#include "SVGRenderingContext.h"
 #include "SVGStyledElement.h"
 #include "SVGURIReference.h"
 #include "TextStream.h"
@@ -135,7 +135,7 @@ void FEImage::platformApplySoftware()
         }
 
         AffineTransform contentTransformation;
-        SVGImageBufferTools::renderSubtreeToImageBuffer(resultImage, renderer, contentTransformation);
+        SVGRenderingContext::renderSubtreeToImageBuffer(resultImage, renderer, contentTransformation);
         return;
     }