Reviewed by Oliver.
authorzimmermann <zimmermann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Nov 2006 12:22:27 +0000 (12:22 +0000)
committerzimmermann <zimmermann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Nov 2006 12:22:27 +0000 (12:22 +0000)
Fixes: http://bugs.webkit.org/show_bug.cgi?id=11658
Move KRenderingPaintServer* classes to the location
of all other resources (platform/graphics/svg).

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

64 files changed:
WebCore/CMakeLists.txt
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/kcanvas/device/KRenderingDevice.h
WebCore/kcanvas/device/KRenderingPaintServer.h [deleted file]
WebCore/kcanvas/device/KRenderingPaintServerGradient.cpp [deleted file]
WebCore/kcanvas/device/KRenderingPaintServerGradient.h [deleted file]
WebCore/kcanvas/device/KRenderingPaintServerPattern.cpp [deleted file]
WebCore/kcanvas/device/KRenderingPaintServerPattern.h [deleted file]
WebCore/kcanvas/device/KRenderingPaintServerSolid.cpp [deleted file]
WebCore/kcanvas/device/qt/KRenderingPaintServerGradientQt.cpp [deleted file]
WebCore/kcanvas/device/qt/KRenderingPaintServerGradientQt.h [deleted file]
WebCore/kcanvas/device/qt/KRenderingPaintServerPatternQt.h [deleted file]
WebCore/kcanvas/device/qt/KRenderingPaintServerQt.h [deleted file]
WebCore/kcanvas/device/qt/KRenderingPaintServerSolidQt.cpp [deleted file]
WebCore/kcanvas/device/qt/KRenderingPaintServerSolidQt.h [deleted file]
WebCore/kcanvas/device/quartz/KCanvasItemQuartz.h [deleted file]
WebCore/kcanvas/device/quartz/KRenderingDeviceQuartz.cpp
WebCore/kcanvas/device/quartz/KRenderingDeviceQuartz.h
WebCore/kcanvas/device/quartz/KRenderingPaintServerGradientQuartz.cpp [deleted file]
WebCore/kcanvas/device/quartz/KRenderingPaintServerQuartz.cpp [deleted file]
WebCore/kcanvas/device/quartz/KRenderingPaintServerQuartz.h [deleted file]
WebCore/ksvg2/misc/KCanvasRenderingStyle.cpp
WebCore/ksvg2/misc/KCanvasRenderingStyle.h
WebCore/ksvg2/svg/SVGFEGaussianBlurElement.cpp
WebCore/ksvg2/svg/SVGFEOffsetElement.cpp
WebCore/ksvg2/svg/SVGGradientElement.cpp
WebCore/ksvg2/svg/SVGGradientElement.h
WebCore/ksvg2/svg/SVGLinearGradientElement.cpp
WebCore/ksvg2/svg/SVGLinearGradientElement.h
WebCore/ksvg2/svg/SVGPatternElement.cpp
WebCore/ksvg2/svg/SVGPatternElement.h
WebCore/ksvg2/svg/SVGRadialGradientElement.cpp
WebCore/ksvg2/svg/SVGRadialGradientElement.h
WebCore/platform/graphics/svg/SVGPaintServer.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGPaintServer.h [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGPaintServerGradient.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGPaintServerGradient.h [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGPaintServerLinearGradient.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGPaintServerLinearGradient.h [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGPaintServerPattern.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGPaintServerPattern.h [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGPaintServerRadialGradient.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGPaintServerRadialGradient.h [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGPaintServerSolid.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGPaintServerSolid.h [new file with mode: 0644]
WebCore/platform/graphics/svg/SVGResource.cpp
WebCore/platform/graphics/svg/SVGResource.h
WebCore/platform/graphics/svg/SVGResourceClipper.cpp
WebCore/platform/graphics/svg/SVGResourceMarker.cpp
WebCore/platform/graphics/svg/SVGResourceMasker.cpp
WebCore/platform/graphics/svg/cg/SVGPaintServerCg.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/cg/SVGPaintServerGradientCg.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/cg/SVGPaintServerPatternCg.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/cg/SVGPaintServerSolidCg.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/qt/SVGPaintServerGradientQt.cpp [moved from WebCore/kcanvas/device/KRenderingPaintServerSolid.h with 58% similarity]
WebCore/platform/graphics/svg/qt/SVGPaintServerLinearGradientQt.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/qt/SVGPaintServerPatternQt.cpp [moved from WebCore/kcanvas/device/qt/KRenderingPaintServerPatternQt.cpp with 54% similarity]
WebCore/platform/graphics/svg/qt/SVGPaintServerQt.cpp [moved from WebCore/kcanvas/device/qt/KRenderingPaintServerQt.cpp with 53% similarity]
WebCore/platform/graphics/svg/qt/SVGPaintServerRadialGradientQt.cpp [new file with mode: 0644]
WebCore/platform/graphics/svg/qt/SVGPaintServerSolidQt.cpp [new file with mode: 0644]
WebCore/rendering/RenderPath.cpp
WebCore/rendering/SVGInlineFlowBox.cpp
WebCore/rendering/SVGRenderTreeAsText.cpp

index a50621f6aacec260c3fa4fc9d19c7cd84657b1bb..ae71bc36b71382024ef686ed3872e38ac8b94237 100644 (file)
@@ -535,16 +535,7 @@ set (SVG_SOURCES
     bindings/js/JSSVGRect.cpp
 
     kcanvas/device/KRenderingDevice.cpp
-    kcanvas/device/KRenderingPaintServerGradient.cpp
-    kcanvas/device/KRenderingPaintServerPattern.cpp
-    kcanvas/device/KRenderingPaintServerSolid.cpp
-#   kcanvas/device/qt/KCanvasFilterQt.cpp
-#   kcanvas/device/qt/KCanvasImageItemQt.cpp
     kcanvas/device/qt/KRenderingDeviceQt.cpp
-    kcanvas/device/qt/KRenderingPaintServerGradientQt.cpp
-    kcanvas/device/qt/KRenderingPaintServerPatternQt.cpp
-    kcanvas/device/qt/KRenderingPaintServerQt.cpp
-    kcanvas/device/qt/KRenderingPaintServerSolidQt.cpp
     kcanvas/device/qt/RenderPathQt.cpp
 
     ksvg2/css/SVGCSSParser.cpp
@@ -990,7 +981,7 @@ set(WebCore_SRCS
     page/Page.cpp
     page/PageState.cpp
 
-       page/qt/EventHandlerQt.cpp   
+    page/qt/EventHandlerQt.cpp   
 
     platform/Arena.cpp
     platform/ArrayImpl.cpp
@@ -1052,6 +1043,12 @@ set(WebCore_SRCS
     platform/graphics/qt/IntSizeQt.cpp
     platform/graphics/qt/PathQt.cpp
 
+    platform/graphics/svg/SVGPaintServer.cpp
+    platform/graphics/svg/SVGPaintServerGradient.cpp
+    platform/graphics/svg/SVGPaintServerLinearGradient.cpp
+    platform/graphics/svg/SVGPaintServerPattern.cpp
+    platform/graphics/svg/SVGPaintServerRadialGradient.cpp
+    platform/graphics/svg/SVGPaintServerSolid.cpp
     platform/graphics/svg/SVGResource.cpp
     platform/graphics/svg/SVGResourceClipper.cpp
     platform/graphics/svg/SVGResourceFilter.cpp
@@ -1076,6 +1073,12 @@ set(WebCore_SRCS
     platform/graphics/svg/filters/SVGFilterEffect.cpp
     platform/graphics/svg/filters/SVGLightSource.cpp
 
+    platform/graphics/svg/qt/SVGPaintServerGradientQt.cpp
+    platform/graphics/svg/qt/SVGPaintServerLinearGradientQt.cpp
+    platform/graphics/svg/qt/SVGPaintServerPatternQt.cpp
+    platform/graphics/svg/qt/SVGPaintServerQt.cpp
+    platform/graphics/svg/qt/SVGPaintServerRadialGradientQt.cpp
+    platform/graphics/svg/qt/SVGPaintServerSolidQt.cpp
     platform/graphics/svg/qt/SVGResourceClipperQt.cpp
     platform/graphics/svg/qt/SVGResourceImageQt.cpp
     platform/graphics/svg/qt/SVGResourceMaskerQt.cpp
index 16300ab9b50b920faa15ceedc3328e70bac7acd8..b03590f0f1dbedbbf81e4fcfa5a4bb2c6b0dcbbc 100644 (file)
@@ -1,3 +1,195 @@
+2006-11-21  Nikolas Zimmermann  <zimmermann@kde.org>
+
+        Reviewed by Oliver.
+
+        Fixes: http://bugs.webkit.org/show_bug.cgi?id=11658
+
+        Move KRenderingPaintServer* classes to the location
+        of all other resources (platform/graphics/svg).
+
+        Soon the whole platform/graphics/svg stuff will bemoved
+        into ksvg2/ itself, as discussed with Darin.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * kcanvas/device/KRenderingDevice.h:
+        * kcanvas/device/KRenderingPaintServer.h: Removed.
+        * kcanvas/device/KRenderingPaintServerGradient.cpp: Removed.
+        * kcanvas/device/KRenderingPaintServerGradient.h: Removed.
+        * kcanvas/device/KRenderingPaintServerPattern.cpp: Removed.
+        * kcanvas/device/KRenderingPaintServerPattern.h: Removed.
+        * kcanvas/device/KRenderingPaintServerSolid.cpp: Removed.
+        * kcanvas/device/KRenderingPaintServerSolid.h: Removed.
+        * kcanvas/device/qt/KRenderingPaintServerGradientQt.cpp: Removed.
+        * kcanvas/device/qt/KRenderingPaintServerGradientQt.h: Removed.
+        * kcanvas/device/qt/KRenderingPaintServerPatternQt.cpp: Removed.
+        * kcanvas/device/qt/KRenderingPaintServerPatternQt.h: Removed.
+        * kcanvas/device/qt/KRenderingPaintServerQt.cpp: Removed.
+        * kcanvas/device/qt/KRenderingPaintServerQt.h: Removed.
+        * kcanvas/device/qt/KRenderingPaintServerSolidQt.cpp: Removed.
+        * kcanvas/device/qt/KRenderingPaintServerSolidQt.h: Removed.
+        * kcanvas/device/quartz/KCanvasItemQuartz.h: Removed.
+        * kcanvas/device/quartz/KRenderingDeviceQuartz.cpp:
+        (WebCore::KRenderingDeviceQuartz::createPaintServer):
+        * kcanvas/device/quartz/KRenderingDeviceQuartz.h:
+        * kcanvas/device/quartz/KRenderingPaintServerGradientQuartz.cpp: Removed.
+        * kcanvas/device/quartz/KRenderingPaintServerQuartz.cpp: Removed.
+        * kcanvas/device/quartz/KRenderingPaintServerQuartz.h: Removed.
+        * ksvg2/misc/KCanvasRenderingStyle.cpp:
+        (WebCore::sharedSolidPaintServer):
+        (WebCore::KSVGPainterFactory::fillPaintServer):
+        (WebCore::KSVGPainterFactory::strokePaintServer):
+        * ksvg2/misc/KCanvasRenderingStyle.h:
+        * ksvg2/svg/SVGFEGaussianBlurElement.cpp:
+        * ksvg2/svg/SVGFEOffsetElement.cpp:
+        * ksvg2/svg/SVGGradientElement.cpp:
+        (WebCore::SVGGradientElement::canvasResource):
+        (WebCore::SVGGradientElement::resourceNotification):
+        (WebCore::SVGGradientElement::rebuildStops):
+        * ksvg2/svg/SVGGradientElement.h:
+        * ksvg2/svg/SVGLinearGradientElement.cpp:
+        (WebCore::SVGLinearGradientElement::buildGradient):
+        * ksvg2/svg/SVGLinearGradientElement.h:
+        (WebCore::SVGLinearGradientElement::gradientType):
+        * ksvg2/svg/SVGPatternElement.cpp:
+        (WebCore::SVGPatternElement::fillAttributesFromReferencePattern):
+        (WebCore::SVGPatternElement::canvasResource):
+        * ksvg2/svg/SVGPatternElement.h:
+        * ksvg2/svg/SVGRadialGradientElement.cpp:
+        (WebCore::SVGRadialGradientElement::buildGradient):
+        * ksvg2/svg/SVGRadialGradientElement.h:
+        (WebCore::SVGRadialGradientElement::gradientType):
+        * platform/graphics/svg/SVGPaintServer.cpp: Added.
+        (WebCore::SVGPaintServer::SVGPaintServer):
+        (WebCore::SVGPaintServer::~SVGPaintServer):
+        (WebCore::SVGPaintServer::activeClient):
+        (WebCore::SVGPaintServer::setActiveClient):
+        (WebCore::SVGPaintServer::isPaintingText):
+        (WebCore::SVGPaintServer::setPaintingText):
+        (WebCore::operator<<):
+        (WebCore::getPaintServerById):
+        * platform/graphics/svg/SVGPaintServer.h: Added.
+        (WebCore::):
+        (WebCore::SVGPaintServer::isPaintServer):
+        * platform/graphics/svg/SVGPaintServerGradient.cpp: Added.
+        (WebCore::compareStopOffset):
+        (WebCore::operator<<):
+        (WebCore::SVGPaintServerGradient::SVGPaintServerGradient):
+        (WebCore::SVGPaintServerGradient::~SVGPaintServerGradient):
+        (WebCore::SVGPaintServerGradient::gradientStops):
+        (WebCore::SVGPaintServerGradient::setGradientStops):
+        (WebCore::SVGPaintServerGradient::spreadMethod):
+        (WebCore::SVGPaintServerGradient::setGradientSpreadMethod):
+        (WebCore::SVGPaintServerGradient::boundingBoxMode):
+        (WebCore::SVGPaintServerGradient::setBoundingBoxMode):
+        (WebCore::SVGPaintServerGradient::gradientTransform):
+        (WebCore::SVGPaintServerGradient::setGradientTransform):
+        (WebCore::SVGPaintServerGradient::listener):
+        (WebCore::SVGPaintServerGradient::setListener):
+        (WebCore::SVGPaintServerGradient::externalRepresentation):
+        * platform/graphics/svg/SVGPaintServerGradient.h: Added.
+        (WebCore::):
+        (WebCore::SVGPaintServerGradient::):
+        (WebCore::makeGradientStop):
+        * platform/graphics/svg/SVGPaintServerLinearGradient.cpp: Added.
+        (WebCore::SVGPaintServerLinearGradient::SVGPaintServerLinearGradient):
+        (WebCore::SVGPaintServerLinearGradient::~SVGPaintServerLinearGradient):
+        (WebCore::SVGPaintServerLinearGradient::gradientStart):
+        (WebCore::SVGPaintServerLinearGradient::setGradientStart):
+        (WebCore::SVGPaintServerLinearGradient::gradientEnd):
+        (WebCore::SVGPaintServerLinearGradient::setGradientEnd):
+        (WebCore::SVGPaintServerLinearGradient::externalRepresentation):
+        * platform/graphics/svg/SVGPaintServerLinearGradient.h: Added.
+        (WebCore::SVGPaintServerLinearGradient::type):
+        * platform/graphics/svg/SVGPaintServerPattern.cpp: Added.
+        (WebCore::SVGPaintServerPattern::SVGPaintServerPattern):
+        (WebCore::SVGPaintServerPattern::~SVGPaintServerPattern):
+        (WebCore::SVGPaintServerPattern::bbox):
+        (WebCore::SVGPaintServerPattern::setBbox):
+        (WebCore::SVGPaintServerPattern::boundingBoxMode):
+        (WebCore::SVGPaintServerPattern::setBoundingBoxMode):
+        (WebCore::SVGPaintServerPattern::tile):
+        (WebCore::SVGPaintServerPattern::setTile):
+        (WebCore::SVGPaintServerPattern::patternTransform):
+        (WebCore::SVGPaintServerPattern::setPatternTransform):
+        (WebCore::SVGPaintServerPattern::listener):
+        (WebCore::SVGPaintServerPattern::setListener):
+        (WebCore::SVGPaintServerPattern::externalRepresentation):
+        * platform/graphics/svg/SVGPaintServerPattern.h: Added.
+        (WebCore::SVGPaintServerPattern::type):
+        * platform/graphics/svg/SVGPaintServerRadialGradient.cpp: Added.
+        (WebCore::SVGPaintServerRadialGradient::SVGPaintServerRadialGradient):
+        (WebCore::SVGPaintServerRadialGradient::~SVGPaintServerRadialGradient):
+        (WebCore::SVGPaintServerRadialGradient::gradientCenter):
+        (WebCore::SVGPaintServerRadialGradient::setGradientCenter):
+        (WebCore::SVGPaintServerRadialGradient::gradientFocal):
+        (WebCore::SVGPaintServerRadialGradient::setGradientFocal):
+        (WebCore::SVGPaintServerRadialGradient::gradientRadius):
+        (WebCore::SVGPaintServerRadialGradient::setGradientRadius):
+        (WebCore::SVGPaintServerRadialGradient::externalRepresentation):
+        * platform/graphics/svg/SVGPaintServerRadialGradient.h: Added.
+        (WebCore::SVGPaintServerRadialGradient::type):
+        * platform/graphics/svg/SVGPaintServerSolid.cpp: Added.
+        (WebCore::SVGPaintServerSolid::SVGPaintServerSolid):
+        (WebCore::SVGPaintServerSolid::~SVGPaintServerSolid):
+        (WebCore::SVGPaintServerSolid::color):
+        (WebCore::SVGPaintServerSolid::setColor):
+        (WebCore::SVGPaintServerSolid::externalRepresentation):
+        * platform/graphics/svg/SVGPaintServerSolid.h: Added.
+        (WebCore::SVGPaintServerSolid::type):
+        * platform/graphics/svg/SVGResource.cpp:
+        * platform/graphics/svg/SVGResource.h:
+        * platform/graphics/svg/SVGResourceClipper.cpp:
+        * platform/graphics/svg/SVGResourceMarker.cpp:
+        * platform/graphics/svg/SVGResourceMasker.cpp:
+        * platform/graphics/svg/cg/SVGPaintServerCg.cpp: Added.
+        (WebCore::SVGPaintServer::draw):
+        (WebCore::SVGPaintServer::teardown):
+        (WebCore::SVGPaintServer::renderPath):
+        (WebCore::SVGPaintServer::strokePath):
+        (WebCore::SVGPaintServer::clipToStrokePath):
+        (WebCore::SVGPaintServer::fillPath):
+        (WebCore::SVGPaintServer::clipToFillPath):
+        * platform/graphics/svg/cg/SVGPaintServerGradientCg.cpp: Added.
+        (WebCore::cgGradientCallback):
+        (WebCore::CGShadingRefForLinearGradient):
+        (WebCore::CGShadingRefForRadialGradient):
+        (WebCore::SVGPaintServerGradient::invalidateCaches):
+        (WebCore::SVGPaintServerGradient::updateQuartzGradientStopsCache):
+        (WebCore::SVGPaintServerGradient::updateQuartzGradientCache):
+        (WebCore::SVGPaintServerGradient::teardown):
+        (WebCore::SVGPaintServerGradient::renderPath):
+        (WebCore::SVGPaintServerGradient::setup):
+        (WebCore::SVGPaintServerGradient::invalidate):
+        * platform/graphics/svg/cg/SVGPaintServerPatternCg.cpp: Added.
+        (WebCore::patternCallback):
+        (WebCore::SVGPaintServerPattern::setup):
+        (WebCore::SVGPaintServerPattern::teardown):
+        * platform/graphics/svg/cg/SVGPaintServerSolidCg.cpp: Added.
+        (WebCore::SVGPaintServerSolid::setup):
+        * platform/graphics/svg/qt/SVGPaintServerGradientQt.cpp: Added.
+        (WebCore::SVGPaintServerGradient::fillColorArray):
+        * platform/graphics/svg/qt/SVGPaintServerLinearGradientQt.cpp: Added.
+        (WebCore::SVGPaintServerLinearGradient::setup):
+        * platform/graphics/svg/qt/SVGPaintServerPatternQt.cpp: Added.
+        (WebCore::SVGPaintServerPattern::setup):
+        * platform/graphics/svg/qt/SVGPaintServerQt.cpp: Added.
+        (WebCore::SVGPaintServer::setPenProperties):
+        (WebCore::SVGPaintServer::draw):
+        (WebCore::SVGPaintServer::teardown):
+        (WebCore::SVGPaintServer::renderPath):
+        * platform/graphics/svg/qt/SVGPaintServerRadialGradientQt.cpp: Added.
+        (WebCore::setup):
+        * platform/graphics/svg/qt/SVGPaintServerSolidQt.cpp: Added.
+        (WebCore::SVGPaintServerSolid::setup):
+        * rendering/RenderPath.cpp:
+        (WebCore::RenderPath::paint):
+        * rendering/SVGInlineFlowBox.cpp:
+        (WebCore::paintSVGInlineFlow):
+        * rendering/SVGRenderTreeAsText.cpp:
+        (WebCore::writeStyle):
+        (WebCore::writeRenderResources):
+
 2006-11-21  Alex Taylor  <darwin@techvisual.co.nz>
 
         Reviewed by Mitz.
index 516b3300c490e03441c3e662bb42248b54b0c04a..30d719b9164750312b3a85f750a724d532d472e5 100644 (file)
                A871DFE50A15376B00B12A68 /* RenderWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DFE10A15376B00B12A68 /* RenderWidget.cpp */; };
                A88AD3860952486D001DD196 /* KRenderingDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB54089701F700BA5114 /* KRenderingDevice.cpp */; };
                A88AD3870952486D001DD196 /* KRenderingDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0FB55089701F700BA5114 /* KRenderingDevice.h */; };
-               A88AD38A0952486D001DD196 /* KRenderingPaintServer.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0FB5B089701F700BA5114 /* KRenderingPaintServer.h */; };
-               A88AD38B0952486D001DD196 /* KRenderingPaintServerGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB5C089701F700BA5114 /* KRenderingPaintServerGradient.cpp */; };
-               A88AD38C0952486D001DD196 /* KRenderingPaintServerGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0FB5D089701F700BA5114 /* KRenderingPaintServerGradient.h */; };
-               A88AD38F0952486D001DD196 /* KRenderingPaintServerPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB60089701F700BA5114 /* KRenderingPaintServerPattern.cpp */; };
-               A88AD3900952486D001DD196 /* KRenderingPaintServerPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0FB61089701F700BA5114 /* KRenderingPaintServerPattern.h */; };
-               A88AD3910952486D001DD196 /* KRenderingPaintServerSolid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB62089701F700BA5114 /* KRenderingPaintServerSolid.cpp */; };
-               A88AD3920952486D001DD196 /* KRenderingPaintServerSolid.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0FB63089701F700BA5114 /* KRenderingPaintServerSolid.h */; };
                A88AD3AD0952486D001DD196 /* KCanvasItemQuartz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB6C089701F800BA5114 /* KCanvasItemQuartz.cpp */; };
                A88AD3B00952486E001DD196 /* KRenderingDeviceQuartz.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0FB71089701F800BA5114 /* KRenderingDeviceQuartz.h */; };
                A88AD3B10952486E001DD196 /* KRenderingDeviceQuartz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB72089701F800BA5114 /* KRenderingDeviceQuartz.cpp */; };
-               A88AD3B20952486E001DD196 /* KRenderingPaintServerGradientQuartz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB73089701F800BA5114 /* KRenderingPaintServerGradientQuartz.cpp */; };
-               A88AD3B30952486E001DD196 /* KRenderingPaintServerQuartz.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0FB74089701F800BA5114 /* KRenderingPaintServerQuartz.h */; };
-               A88AD3B40952486E001DD196 /* KRenderingPaintServerQuartz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB75089701F800BA5114 /* KRenderingPaintServerQuartz.cpp */; };
                A88AD3B50952486E001DD196 /* QuartzSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C0FB76089701F800BA5114 /* QuartzSupport.h */; };
                A88AD3B60952486E001DD196 /* QuartzSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0FB77089701F800BA5114 /* QuartzSupport.cpp */; };
                A88AD401095248F0001DD196 /* SVGRenderStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C0F6FF089701F100BA5114 /* SVGRenderStyle.cpp */; };
                B2A015BA0AF6CD53006BCE0E /* SVGResourceMasker.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A015A70AF6CD53006BCE0E /* SVGResourceMasker.h */; };
                B2CB41930AB75904004D9C45 /* SVGRenderingIntent.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CB414C0AB75904004D9C45 /* SVGRenderingIntent.h */; };
                B2CB41A60AB75904004D9C45 /* SVGUnitTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CB415F0AB75904004D9C45 /* SVGUnitTypes.h */; };
+               B2D87C770B124E7300B0DE1E /* SVGPaintServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D87C6B0B124E7300B0DE1E /* SVGPaintServer.cpp */; };
+               B2D87C780B124E7300B0DE1E /* SVGPaintServer.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D87C6C0B124E7300B0DE1E /* SVGPaintServer.h */; };
+               B2D87C790B124E7300B0DE1E /* SVGPaintServerGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D87C6D0B124E7300B0DE1E /* SVGPaintServerGradient.cpp */; };
+               B2D87C7A0B124E7300B0DE1E /* SVGPaintServerGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D87C6E0B124E7300B0DE1E /* SVGPaintServerGradient.h */; };
+               B2D87C7B0B124E7300B0DE1E /* SVGPaintServerLinearGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D87C6F0B124E7300B0DE1E /* SVGPaintServerLinearGradient.cpp */; };
+               B2D87C7C0B124E7300B0DE1E /* SVGPaintServerLinearGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D87C700B124E7300B0DE1E /* SVGPaintServerLinearGradient.h */; };
+               B2D87C7D0B124E7300B0DE1E /* SVGPaintServerPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D87C710B124E7300B0DE1E /* SVGPaintServerPattern.cpp */; };
+               B2D87C7E0B124E7300B0DE1E /* SVGPaintServerPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D87C720B124E7300B0DE1E /* SVGPaintServerPattern.h */; };
+               B2D87C7F0B124E7300B0DE1E /* SVGPaintServerRadialGradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D87C730B124E7300B0DE1E /* SVGPaintServerRadialGradient.cpp */; };
+               B2D87C800B124E7300B0DE1E /* SVGPaintServerRadialGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D87C740B124E7300B0DE1E /* SVGPaintServerRadialGradient.h */; };
+               B2D87C810B124E7300B0DE1E /* SVGPaintServerSolid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D87C750B124E7300B0DE1E /* SVGPaintServerSolid.cpp */; };
+               B2D87C820B124E7300B0DE1E /* SVGPaintServerSolid.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D87C760B124E7300B0DE1E /* SVGPaintServerSolid.h */; };
+               B2D87C870B124E9500B0DE1E /* SVGPaintServerCg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D87C830B124E9500B0DE1E /* SVGPaintServerCg.cpp */; };
+               B2D87C880B124E9500B0DE1E /* SVGPaintServerGradientCg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D87C840B124E9500B0DE1E /* SVGPaintServerGradientCg.cpp */; };
+               B2D87C890B124E9500B0DE1E /* SVGPaintServerPatternCg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D87C850B124E9500B0DE1E /* SVGPaintServerPatternCg.cpp */; };
+               B2D87C8A0B124E9500B0DE1E /* SVGPaintServerSolidCg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2D87C860B124E9500B0DE1E /* SVGPaintServerSolidCg.cpp */; };
                B2E27BD50B0F2A9500F17C7B /* SVGResourceFilterCg.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2E27BD30B0F2A9500F17C7B /* SVGResourceFilterCg.mm */; };
                B2E27BDA0B0F2AC800F17C7B /* SVGResourceFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2E27BD70B0F2AC800F17C7B /* SVGResourceFilter.cpp */; };
                B2E27BDB0B0F2AC800F17C7B /* SVGResourceFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E27BD80B0F2AC800F17C7B /* SVGResourceFilter.h */; };
                A8C0F8EC089701F400BA5114 /* SVGZoomAndPan.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = SVGZoomAndPan.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                A8C0FB54089701F700BA5114 /* KRenderingDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRenderingDevice.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                A8C0FB55089701F700BA5114 /* KRenderingDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KRenderingDevice.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               A8C0FB5B089701F700BA5114 /* KRenderingPaintServer.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KRenderingPaintServer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               A8C0FB5C089701F700BA5114 /* KRenderingPaintServerGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRenderingPaintServerGradient.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               A8C0FB5D089701F700BA5114 /* KRenderingPaintServerGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KRenderingPaintServerGradient.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               A8C0FB60089701F700BA5114 /* KRenderingPaintServerPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRenderingPaintServerPattern.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               A8C0FB61089701F700BA5114 /* KRenderingPaintServerPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KRenderingPaintServerPattern.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               A8C0FB62089701F700BA5114 /* KRenderingPaintServerSolid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRenderingPaintServerSolid.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               A8C0FB63089701F700BA5114 /* KRenderingPaintServerSolid.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KRenderingPaintServerSolid.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                A8C0FB6C089701F800BA5114 /* KCanvasItemQuartz.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KCanvasItemQuartz.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                A8C0FB71089701F800BA5114 /* KRenderingDeviceQuartz.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KRenderingDeviceQuartz.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                A8C0FB72089701F800BA5114 /* KRenderingDeviceQuartz.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRenderingDeviceQuartz.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               A8C0FB73089701F800BA5114 /* KRenderingPaintServerGradientQuartz.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRenderingPaintServerGradientQuartz.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               A8C0FB74089701F800BA5114 /* KRenderingPaintServerQuartz.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KRenderingPaintServerQuartz.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               A8C0FB75089701F800BA5114 /* KRenderingPaintServerQuartz.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KRenderingPaintServerQuartz.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                A8C0FB76089701F800BA5114 /* QuartzSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QuartzSupport.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                A8C0FB77089701F800BA5114 /* QuartzSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QuartzSupport.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                A8C3295C093BB7B2000B9CAC /* SVGFELightElement.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = SVGFELightElement.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                B2CB41620AB75904004D9C45 /* SVGUseElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SVGUseElement.idl; sourceTree = "<group>"; };
                B2CB41630AB75904004D9C45 /* SVGViewElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SVGViewElement.idl; sourceTree = "<group>"; };
                B2CB41640AB75904004D9C45 /* SVGZoomAndPan.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SVGZoomAndPan.idl; sourceTree = "<group>"; };
+               B2D87C6B0B124E7300B0DE1E /* SVGPaintServer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServer.cpp; sourceTree = "<group>"; };
+               B2D87C6C0B124E7300B0DE1E /* SVGPaintServer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServer.h; sourceTree = "<group>"; };
+               B2D87C6D0B124E7300B0DE1E /* SVGPaintServerGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerGradient.cpp; sourceTree = "<group>"; };
+               B2D87C6E0B124E7300B0DE1E /* SVGPaintServerGradient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServerGradient.h; sourceTree = "<group>"; };
+               B2D87C6F0B124E7300B0DE1E /* SVGPaintServerLinearGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerLinearGradient.cpp; sourceTree = "<group>"; };
+               B2D87C700B124E7300B0DE1E /* SVGPaintServerLinearGradient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServerLinearGradient.h; sourceTree = "<group>"; };
+               B2D87C710B124E7300B0DE1E /* SVGPaintServerPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerPattern.cpp; sourceTree = "<group>"; };
+               B2D87C720B124E7300B0DE1E /* SVGPaintServerPattern.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServerPattern.h; sourceTree = "<group>"; };
+               B2D87C730B124E7300B0DE1E /* SVGPaintServerRadialGradient.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerRadialGradient.cpp; sourceTree = "<group>"; };
+               B2D87C740B124E7300B0DE1E /* SVGPaintServerRadialGradient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServerRadialGradient.h; sourceTree = "<group>"; };
+               B2D87C750B124E7300B0DE1E /* SVGPaintServerSolid.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerSolid.cpp; sourceTree = "<group>"; };
+               B2D87C760B124E7300B0DE1E /* SVGPaintServerSolid.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGPaintServerSolid.h; sourceTree = "<group>"; };
+               B2D87C830B124E9500B0DE1E /* SVGPaintServerCg.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerCg.cpp; sourceTree = "<group>"; };
+               B2D87C840B124E9500B0DE1E /* SVGPaintServerGradientCg.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerGradientCg.cpp; sourceTree = "<group>"; };
+               B2D87C850B124E9500B0DE1E /* SVGPaintServerPatternCg.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerPatternCg.cpp; sourceTree = "<group>"; };
+               B2D87C860B124E9500B0DE1E /* SVGPaintServerSolidCg.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPaintServerSolidCg.cpp; sourceTree = "<group>"; };
                B2E27BD30B0F2A9500F17C7B /* SVGResourceFilterCg.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SVGResourceFilterCg.mm; sourceTree = "<group>"; };
                B2E27BD70B0F2AC800F17C7B /* SVGResourceFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGResourceFilter.cpp; sourceTree = "<group>"; };
                B2E27BD80B0F2AC800F17C7B /* SVGResourceFilter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGResourceFilter.h; sourceTree = "<group>"; };
                        children = (
                                A8C0FB54089701F700BA5114 /* KRenderingDevice.cpp */,
                                A8C0FB55089701F700BA5114 /* KRenderingDevice.h */,
-                               A8C0FB5B089701F700BA5114 /* KRenderingPaintServer.h */,
-                               A8C0FB5C089701F700BA5114 /* KRenderingPaintServerGradient.cpp */,
-                               A8C0FB5D089701F700BA5114 /* KRenderingPaintServerGradient.h */,
-                               A8C0FB60089701F700BA5114 /* KRenderingPaintServerPattern.cpp */,
-                               A8C0FB61089701F700BA5114 /* KRenderingPaintServerPattern.h */,
-                               A8C0FB62089701F700BA5114 /* KRenderingPaintServerSolid.cpp */,
-                               A8C0FB63089701F700BA5114 /* KRenderingPaintServerSolid.h */,
                                A8C0FB68089701F800BA5114 /* quartz */,
                        );
                        path = device;
                                A8C0FB6C089701F800BA5114 /* KCanvasItemQuartz.cpp */,
                                A8C0FB71089701F800BA5114 /* KRenderingDeviceQuartz.h */,
                                A8C0FB72089701F800BA5114 /* KRenderingDeviceQuartz.cpp */,
-                               A8C0FB73089701F800BA5114 /* KRenderingPaintServerGradientQuartz.cpp */,
-                               A8C0FB74089701F800BA5114 /* KRenderingPaintServerQuartz.h */,
-                               A8C0FB75089701F800BA5114 /* KRenderingPaintServerQuartz.cpp */,
                                A8C0FB76089701F800BA5114 /* QuartzSupport.h */,
                                A8C0FB77089701F800BA5114 /* QuartzSupport.cpp */,
                        );
                B2A015960AF6CD53006BCE0E /* svg */ = {
                        isa = PBXGroup;
                        children = (
-                               B2E27BDD0B0F2AE500F17C7B /* filters */,
                                B2A015970AF6CD53006BCE0E /* cg */,
+                               B2E27BDD0B0F2AE500F17C7B /* filters */,
+                               B2D87C6B0B124E7300B0DE1E /* SVGPaintServer.cpp */,
+                               B2D87C6C0B124E7300B0DE1E /* SVGPaintServer.h */,
+                               B2D87C6D0B124E7300B0DE1E /* SVGPaintServerGradient.cpp */,
+                               B2D87C6E0B124E7300B0DE1E /* SVGPaintServerGradient.h */,
+                               B2D87C6F0B124E7300B0DE1E /* SVGPaintServerLinearGradient.cpp */,
+                               B2D87C700B124E7300B0DE1E /* SVGPaintServerLinearGradient.h */,
+                               B2D87C710B124E7300B0DE1E /* SVGPaintServerPattern.cpp */,
+                               B2D87C720B124E7300B0DE1E /* SVGPaintServerPattern.h */,
+                               B2D87C730B124E7300B0DE1E /* SVGPaintServerRadialGradient.cpp */,
+                               B2D87C740B124E7300B0DE1E /* SVGPaintServerRadialGradient.h */,
+                               B2D87C750B124E7300B0DE1E /* SVGPaintServerSolid.cpp */,
+                               B2D87C760B124E7300B0DE1E /* SVGPaintServerSolid.h */,
                                B2A0159F0AF6CD53006BCE0E /* SVGResource.cpp */,
                                B2A015A00AF6CD53006BCE0E /* SVGResource.h */,
                                B2A015A10AF6CD53006BCE0E /* SVGResourceClipper.cpp */,
                B2A015970AF6CD53006BCE0E /* cg */ = {
                        isa = PBXGroup;
                        children = (
+                               B2D87C830B124E9500B0DE1E /* SVGPaintServerCg.cpp */,
+                               B2D87C840B124E9500B0DE1E /* SVGPaintServerGradientCg.cpp */,
+                               B2D87C850B124E9500B0DE1E /* SVGPaintServerPatternCg.cpp */,
+                               B2D87C860B124E9500B0DE1E /* SVGPaintServerSolidCg.cpp */,
                                B2E27BD30B0F2A9500F17C7B /* SVGResourceFilterCg.mm */,
                                B2A015980AF6CD53006BCE0E /* SVGResourceClipperCg.cpp */,
                                B2A015990AF6CD53006BCE0E /* SVGResourceImageCg.cpp */,
                                939885C408B7E3D100E707C4 /* EventNames.h in Headers */,
                                65C97AF308EA908800ACD273 /* config.h in Headers */,
                                A88AD3870952486D001DD196 /* KRenderingDevice.h in Headers */,
-                               A88AD38A0952486D001DD196 /* KRenderingPaintServer.h in Headers */,
-                               A88AD38C0952486D001DD196 /* KRenderingPaintServerGradient.h in Headers */,
-                               A88AD3900952486D001DD196 /* KRenderingPaintServerPattern.h in Headers */,
-                               A88AD3920952486D001DD196 /* KRenderingPaintServerSolid.h in Headers */,
                                A88AD3B00952486E001DD196 /* KRenderingDeviceQuartz.h in Headers */,
-                               A88AD3B30952486E001DD196 /* KRenderingPaintServerQuartz.h in Headers */,
                                A88AD3B50952486E001DD196 /* QuartzSupport.h in Headers */,
                                A88AD402095248F0001DD196 /* SVGRenderStyle.h in Headers */,
                                A88AD404095248F0001DD196 /* SVGRenderStyleDefs.h in Headers */,
                                B2E27C9C0B0F2AE600F17C7B /* SVGSpotLightSource.h in Headers */,
                                B2E27CA00B0F2B0900F17C7B /* FloatPoint3D.h in Headers */,
                                93FDAFCA0B11307400E2746F /* EditorInsertAction.h in Headers */,
+                               B2D87C780B124E7300B0DE1E /* SVGPaintServer.h in Headers */,
+                               B2D87C7A0B124E7300B0DE1E /* SVGPaintServerGradient.h in Headers */,
+                               B2D87C7C0B124E7300B0DE1E /* SVGPaintServerLinearGradient.h in Headers */,
+                               B2D87C7E0B124E7300B0DE1E /* SVGPaintServerPattern.h in Headers */,
+                               B2D87C800B124E7300B0DE1E /* SVGPaintServerRadialGradient.h in Headers */,
+                               B2D87C820B124E7300B0DE1E /* SVGPaintServerSolid.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                7E6FEED90898582300C44C3F /* WebCoreScriptDebugger.mm in Sources */,
                                939885C308B7E3D100E707C4 /* EventNames.cpp in Sources */,
                                A88AD3860952486D001DD196 /* KRenderingDevice.cpp in Sources */,
-                               A88AD38B0952486D001DD196 /* KRenderingPaintServerGradient.cpp in Sources */,
-                               A88AD38F0952486D001DD196 /* KRenderingPaintServerPattern.cpp in Sources */,
-                               A88AD3910952486D001DD196 /* KRenderingPaintServerSolid.cpp in Sources */,
                                A88AD3AD0952486D001DD196 /* KCanvasItemQuartz.cpp in Sources */,
                                A88AD3B10952486E001DD196 /* KRenderingDeviceQuartz.cpp in Sources */,
-                               A88AD3B20952486E001DD196 /* KRenderingPaintServerGradientQuartz.cpp in Sources */,
-                               A88AD3B40952486E001DD196 /* KRenderingPaintServerQuartz.cpp in Sources */,
                                A88AD3B60952486E001DD196 /* QuartzSupport.cpp in Sources */,
                                A88AD401095248F0001DD196 /* SVGRenderStyle.cpp in Sources */,
                                A88AD403095248F0001DD196 /* SVGRenderStyleDefs.cpp in Sources */,
                                B2E27C970B0F2AE600F17C7B /* SVGFilterEffect.cpp in Sources */,
                                B2E27C990B0F2AE600F17C7B /* SVGLightSource.cpp in Sources */,
                                B2E27C9F0B0F2B0900F17C7B /* FloatPoint3D.cpp in Sources */,
+                               B2D87C770B124E7300B0DE1E /* SVGPaintServer.cpp in Sources */,
+                               B2D87C790B124E7300B0DE1E /* SVGPaintServerGradient.cpp in Sources */,
+                               B2D87C7B0B124E7300B0DE1E /* SVGPaintServerLinearGradient.cpp in Sources */,
+                               B2D87C7D0B124E7300B0DE1E /* SVGPaintServerPattern.cpp in Sources */,
+                               B2D87C7F0B124E7300B0DE1E /* SVGPaintServerRadialGradient.cpp in Sources */,
+                               B2D87C810B124E7300B0DE1E /* SVGPaintServerSolid.cpp in Sources */,
+                               B2D87C870B124E9500B0DE1E /* SVGPaintServerCg.cpp in Sources */,
+                               B2D87C880B124E9500B0DE1E /* SVGPaintServerGradientCg.cpp in Sources */,
+                               B2D87C890B124E9500B0DE1E /* SVGPaintServerPatternCg.cpp in Sources */,
+                               B2D87C8A0B124E9500B0DE1E /* SVGPaintServerSolidCg.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 7349a05d166bfaa5b41d821a118f49949128c75a..7fd4fb905eb02fd92c6c73d4c1b7e44404f09060 100644 (file)
@@ -26,7 +26,7 @@
 #ifdef SVG_SUPPORT
 
 #include "SVGFilterEffect.h"
-#include "KRenderingPaintServer.h"
+#include "SVGPaintServer.h"
 
 namespace WebCore {
 
@@ -73,7 +73,7 @@ public:
     // Creation tools
     virtual PassRefPtr<SVGResource> createResource(const SVGResourceType&) const = 0;
     virtual SVGFilterEffect* createFilterEffect(const SVGFilterEffectType&) const = 0;
-    virtual PassRefPtr<KRenderingPaintServer> createPaintServer(const KCPaintServerType&) const = 0;
+    virtual PassRefPtr<SVGPaintServer> createPaintServer(const SVGPaintServerType&) const = 0;
 
 private:
     Vector<KRenderingDeviceContext*> m_contextStack;
diff --git a/WebCore/kcanvas/device/KRenderingPaintServer.h b/WebCore/kcanvas/device/KRenderingPaintServer.h
deleted file mode 100644 (file)
index 4176ccc..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005 Rob Buis <buis@kde.org>
-                  2006 Alexander Kellett <lypanov@kde.org>
-
-    This file is part of the KDE project
-
-    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
-    aint with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-    Boston, MA 02111-1307, USA.
-*/
-
-#ifndef KRenderingPaintServer_H
-#define KRenderingPaintServer_H
-#ifdef SVG_SUPPORT
-
-#include "SVGResource.h"
-
-namespace WebCore {
-
-class KRenderingDeviceContext;
-class RenderObject;
-class RenderPath;
-class RenderStyle;
-class TextStream;
-
-#ifdef PS_SOLID
-#undef PS_SOLID
-#endif
-
-// Enumerations
-enum KCPaintServerType {
-    // Painting mode
-    PS_SOLID = 0,
-    PS_PATTERN = 1,
-    PS_LINEAR_GRADIENT = 2,
-    PS_RADIAL_GRADIENT = 3
-};
-
-enum KCPaintTargetType {
-    // Target mode
-    APPLY_TO_FILL = 1,
-    APPLY_TO_STROKE = 2
-};
-
-class KRenderingPaintServer : public SVGResource
-{
-public:
-    KRenderingPaintServer()
-        : SVGResource()
-        , m_activeClient(0)
-        , m_paintingText(false)
-    { }
-    virtual ~KRenderingPaintServer() { }
-    
-    virtual bool isPaintServer() const { return true; }
-
-    const RenderPath* activeClient() const { return m_activeClient;}
-    void setActiveClient(const RenderPath* client) { m_activeClient = client; }
-
-    virtual KCPaintServerType type() const = 0;
-    
-    // Actual rendering function
-    virtual void draw(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const = 0;
-
-    virtual bool setup(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const = 0;
-    virtual void teardown(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const = 0;
-    
-    bool isPaintingText() const { return m_paintingText; }
-    void setPaintingText(bool paintingText) { m_paintingText = paintingText; }
-
-    virtual TextStream& externalRepresentation(TextStream&) const = 0;
-
-    virtual void renderPath(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const = 0;
-private:
-    const RenderPath* m_activeClient;
-    bool m_paintingText;
-};
-
-TextStream& operator<<(TextStream&, const KRenderingPaintServer&);
-
-}
-
-#endif // SVG_SUPPORT
-#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/kcanvas/device/KRenderingPaintServerGradient.cpp b/WebCore/kcanvas/device/KRenderingPaintServerGradient.cpp
deleted file mode 100644 (file)
index 7d45612..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
-    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005 Rob Buis <buis@kde.org>
-
-    This file is part of the KDE project
-
-    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
-    aint with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-    Boston, MA 02111-1307, USA.
-*/
-
-#include "config.h"
-#ifdef SVG_SUPPORT
-#include "IntPoint.h"
-
-#include "KRenderingPaintServerGradient.h"
-
-#include "AffineTransform.h"
-#include "SVGRenderTreeAsText.h"
-#include "TextStream.h"
-
-namespace WebCore {
-
-//KCGradientSpreadMethod
-TextStream& operator<<(TextStream& ts, KCGradientSpreadMethod m)
-{
-    switch (m) 
-    {
-    case SPREADMETHOD_PAD:
-        ts << "PAD"; break;
-    case SPREADMETHOD_REPEAT:
-        ts << "REPEAT"; break;
-    case SPREADMETHOD_REFLECT:
-        ts << "REFLECT"; break;
-    }
-    return ts;
-}
-
-TextStream& operator<<(TextStream& ts, const Vector<KCGradientStop>& l)
-{
-    ts << "[";
-    for (Vector<KCGradientStop>::const_iterator it = l.begin(); it != l.end(); ++it) { 
-        ts << "(" << it->first << "," << it->second << ")";
-        if (it + 1 != l.end())
-            ts << ", ";
-    }
-    ts << "]";
-    return ts;
-}
-
-// KRenderingPaintServerGradient
-KRenderingPaintServerGradient::KRenderingPaintServerGradient()
-    : KRenderingPaintServer()
-    , m_spreadMethod(SPREADMETHOD_PAD)
-    , m_boundingBoxMode(true)
-    , m_listener(0)
-{
-}
-
-KRenderingPaintServerGradient::~KRenderingPaintServerGradient()
-{
-}
-
-const Vector<KCGradientStop>& KRenderingPaintServerGradient::gradientStops() const
-{
-    return m_stops;
-}
-
-static inline bool compareStopOffset(const KCGradientStop& first, const KCGradientStop& second)
-{
-    return first.first < second.first;
-}
-
-void KRenderingPaintServerGradient::setGradientStops(const Vector<KCGradientStop>& stops)
-{
-    m_stops = stops;
-    std::sort(m_stops.begin(), m_stops.end(), compareStopOffset);
-} 
-
-void KRenderingPaintServerGradient::setGradientStops(KRenderingPaintServerGradient* server)
-{
-    m_stops = server->gradientStops();
-}
-
-KCGradientSpreadMethod KRenderingPaintServerGradient::spreadMethod() const
-{
-    return m_spreadMethod;
-}
-
-void KRenderingPaintServerGradient::setGradientSpreadMethod(const KCGradientSpreadMethod &method)
-{
-    m_spreadMethod = method;
-}
-
-bool KRenderingPaintServerGradient::boundingBoxMode() const
-{
-    return m_boundingBoxMode;
-}
-
-void KRenderingPaintServerGradient::setBoundingBoxMode(bool mode)
-{
-    m_boundingBoxMode = mode;
-}
-
-AffineTransform KRenderingPaintServerGradient::gradientTransform() const
-{
-    return m_gradientTransform;
-}
-
-void KRenderingPaintServerGradient::setGradientTransform(const AffineTransform& mat)
-{
-    m_gradientTransform = mat;
-}
-
-TextStream& KRenderingPaintServerGradient::externalRepresentation(TextStream& ts) const
-{
-    // abstract, don't stream type
-    ts  << "[stops=" << gradientStops() << "]";
-    if (spreadMethod() != SPREADMETHOD_PAD)
-        ts << "[method=" << spreadMethod() << "]";        
-    if (!boundingBoxMode())
-        ts << " [bounding box mode=" << boundingBoxMode() << "]";
-    if (!gradientTransform().isIdentity())
-        ts << " [transform=" << gradientTransform() << "]";
-    
-    return ts;
-}
-
-// KRenderingPaintServerLinearGradient
-KRenderingPaintServerLinearGradient::KRenderingPaintServerLinearGradient()
-    : KRenderingPaintServerGradient()
-{
-}
-
-KRenderingPaintServerLinearGradient::~KRenderingPaintServerLinearGradient()
-{
-}
-
-FloatPoint KRenderingPaintServerLinearGradient::gradientStart() const
-{
-    return m_start;
-}
-
-void KRenderingPaintServerLinearGradient::setGradientStart(const FloatPoint &start)
-{
-    m_start = start;
-}
-
-FloatPoint KRenderingPaintServerLinearGradient::gradientEnd() const
-{
-    return m_end;
-}
-
-void KRenderingPaintServerLinearGradient::setGradientEnd(const FloatPoint &end)
-{
-    m_end = end;
-}
-
-KCPaintServerType KRenderingPaintServerLinearGradient::type() const
-{
-    return PS_LINEAR_GRADIENT;
-}
-
-TextStream& KRenderingPaintServerLinearGradient::externalRepresentation(TextStream& ts) const
-{
-    ts << "[type=LINEAR-GRADIENT] ";    
-    KRenderingPaintServerGradient::externalRepresentation(ts);
-    ts  << " [start=" << gradientStart() << "]"
-        << " [end=" << gradientEnd() << "]";
-    return ts;
-}
-
-// KRenderingPaintServerRadialGradient
-KRenderingPaintServerRadialGradient::KRenderingPaintServerRadialGradient()
-    : KRenderingPaintServerGradient()
-{
-}
-
-KRenderingPaintServerRadialGradient::~KRenderingPaintServerRadialGradient()
-{
-}
-
-FloatPoint KRenderingPaintServerRadialGradient::gradientCenter() const
-{
-    return m_center;
-}
-
-void KRenderingPaintServerRadialGradient::setGradientCenter(const FloatPoint &center)
-{
-    m_center = center;
-}
-
-FloatPoint KRenderingPaintServerRadialGradient::gradientFocal() const
-{
-    return m_focal;
-}
-
-void KRenderingPaintServerRadialGradient::setGradientFocal(const FloatPoint &focal)
-{
-    m_focal = focal;
-}
-
-float KRenderingPaintServerRadialGradient::gradientRadius() const
-{
-    return m_radius;
-}
-
-void KRenderingPaintServerRadialGradient::setGradientRadius(float radius)
-{
-    m_radius = radius;
-}
-
-KCPaintServerType KRenderingPaintServerRadialGradient::type() const
-{
-    return PS_RADIAL_GRADIENT;
-}
-
-SVGResourceListener* KRenderingPaintServerGradient::listener() const
-{
-    return m_listener;
-}
-
-void KRenderingPaintServerGradient::setListener(SVGResourceListener* listener)
-{
-    m_listener = listener;
-}
-
-TextStream& KRenderingPaintServerRadialGradient::externalRepresentation(TextStream& ts) const
-{
-    ts << "[type=RADIAL-GRADIENT] "; 
-    KRenderingPaintServerGradient::externalRepresentation(ts);
-    ts << " [center=" << gradientCenter() << "]"
-        << " [focal=" << gradientFocal() << "]"
-        << " [radius=" << gradientRadius() << "]";
-    return ts;
-}
-
-}
-
-// vim:ts=4:noet
-#endif // SVG_SUPPORT
-
diff --git a/WebCore/kcanvas/device/KRenderingPaintServerGradient.h b/WebCore/kcanvas/device/KRenderingPaintServerGradient.h
deleted file mode 100644 (file)
index 6fa0492..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005 Rob Buis <buis@kde.org>
-
-    This file is part of the KDE project
-
-    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
-    aint with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-    Boston, MA 02111-1307, USA.
-*/
-
-#ifndef KRenderingPaintServerGradient_H
-#define KRenderingPaintServerGradient_H
-#ifdef SVG_SUPPORT
-
-#include "AffineTransform.h"
-#include "Color.h"
-#include "FloatPoint.h"
-#include "KRenderingPaintServer.h"
-
-namespace WebCore {
-
-enum KCGradientSpreadMethod {
-    SPREADMETHOD_PAD = 1,
-    SPREADMETHOD_REPEAT = 2,
-    SPREADMETHOD_REFLECT = 4
-};
-
-typedef std::pair<float, Color> KCGradientStop;
-inline KCGradientStop makeGradientStop(float offset, const Color& color) { return std::make_pair(offset, color); }
-
-TextStream& operator<<(TextStream&, KCGradientSpreadMethod);
-
-class KRenderingPaintServerGradient : public KRenderingPaintServer
-{
-public:
-    KRenderingPaintServerGradient();
-    virtual ~KRenderingPaintServerGradient();
-
-    // 'Gradient' interface
-    const Vector<KCGradientStop>& gradientStops() const;
-    void setGradientStops(const Vector<KCGradientStop>&);
-    void setGradientStops(KRenderingPaintServerGradient*);
-
-    KCGradientSpreadMethod spreadMethod() const;
-    void setGradientSpreadMethod(const KCGradientSpreadMethod&);
-
-    // Gradient start and end points are percentages when used in boundingBox mode.
-    // For instance start point with value (0,0) is top-left and end point with value (100, 100) is 
-    // bottom-right.
-    // BoundingBox mode is true by default.
-    bool boundingBoxMode() const;
-    void setBoundingBoxMode(bool mode = true);
-
-    AffineTransform gradientTransform() const;
-    void setGradientTransform(const AffineTransform&);
-    
-    SVGResourceListener* listener() const;
-    void setListener(SVGResourceListener*);
-
-    TextStream& externalRepresentation(TextStream&) const;
-private:
-    Vector<KCGradientStop> m_stops;
-    KCGradientSpreadMethod m_spreadMethod;
-    bool m_boundingBoxMode;
-    AffineTransform m_gradientTransform;
-    SVGResourceListener* m_listener;
-};
-
-class KRenderingPaintServerLinearGradient : public KRenderingPaintServerGradient
-{
-public:
-    KRenderingPaintServerLinearGradient();
-    virtual ~KRenderingPaintServerLinearGradient();
-
-    virtual KCPaintServerType type() const;
-
-    // 'Linear Gradient' interface
-    FloatPoint gradientStart() const;
-    void setGradientStart(const FloatPoint&);
-
-    FloatPoint gradientEnd() const;
-    void setGradientEnd(const FloatPoint&);
-
-    TextStream& externalRepresentation(TextStream&) const;
-private:
-    FloatPoint m_start;
-    FloatPoint m_end;
-};
-
-class KRenderingPaintServerRadialGradient : public KRenderingPaintServerGradient
-{
-public:
-    KRenderingPaintServerRadialGradient();
-    virtual ~KRenderingPaintServerRadialGradient();
-
-    virtual KCPaintServerType type() const;
-
-    // 'Radial Gradient' interface
-    FloatPoint gradientCenter() const;
-    void setGradientCenter(const FloatPoint&);
-
-    FloatPoint gradientFocal() const;
-    void setGradientFocal(const FloatPoint&);
-
-    float gradientRadius() const;
-    void setGradientRadius(float);
-
-    TextStream& externalRepresentation(TextStream&) const;
-private:
-    float m_radius;
-    FloatPoint m_center;
-    FloatPoint m_focal;
-};
-
-}
-
-#endif // SVG_SUPPORT
-#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/kcanvas/device/KRenderingPaintServerPattern.cpp b/WebCore/kcanvas/device/KRenderingPaintServerPattern.cpp
deleted file mode 100644 (file)
index 83a6baf..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005 Rob Buis <buis@kde.org>
-
-    This file is part of the KDE project
-
-    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
-    aint with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-    Boston, MA 02111-1307, USA.
-*/
-
-#include "config.h"
-#ifdef SVG_SUPPORT
-#include "SVGResourceImage.h"
-
-#include "AffineTransform.h"
-#include "KRenderingPaintServerPattern.h"
-#include "SVGRenderTreeAsText.h"
-#include "TextStream.h"
-
-namespace WebCore {
-
-KRenderingPaintServerPattern::KRenderingPaintServerPattern()
-    : KRenderingPaintServer()
-    , m_useBoundingBoxMode(true)
-    , m_listener(0)
-{
-}
-
-KRenderingPaintServerPattern::~KRenderingPaintServerPattern()
-{
-}
-
-void KRenderingPaintServerPattern::setBbox(const FloatRect& rect)
-{
-    m_bbox = rect;
-}
-
-FloatRect KRenderingPaintServerPattern::bbox() const
-{
-    return m_bbox;
-}
-
-bool KRenderingPaintServerPattern::boundingBoxMode() const
-{
-    return m_useBoundingBoxMode;
-}
-
-void KRenderingPaintServerPattern::setBoundingBoxMode(bool mode)
-{
-    m_useBoundingBoxMode = mode;
-}
-
-SVGResourceImage* KRenderingPaintServerPattern::tile() const
-{
-    return m_tile.get();
-}
-
-void KRenderingPaintServerPattern::setTile(const PassRefPtr<SVGResourceImage>& tile)
-{
-    m_tile = tile;
-}
-
-AffineTransform KRenderingPaintServerPattern::patternTransform() const
-{
-    return m_patternTransform;
-}
-
-void KRenderingPaintServerPattern::setPatternTransform(const AffineTransform& mat)
-{
-    m_patternTransform = mat;
-}
-
-KCPaintServerType KRenderingPaintServerPattern::type() const
-{
-    return PS_PATTERN;
-}
-
-SVGResourceListener* KRenderingPaintServerPattern::listener() const
-{
-    return m_listener;
-}
-
-void KRenderingPaintServerPattern::setListener(SVGResourceListener* listener)
-{
-    m_listener = listener;
-}
-
-TextStream& KRenderingPaintServerPattern::externalRepresentation(TextStream& ts) const
-{
-     ts << "[type=PATTERN]"
-        << " [bbox=" << bbox() << "]";
-    if (!boundingBoxMode())
-        ts << " [bounding box mode=" << boundingBoxMode() << "]";        
-    if (!patternTransform().isIdentity())
-        ts << " [pattern transform=" << patternTransform() << "]";
-    return ts;
-}
-
-}
-
-// vim:ts=4:noet
-#endif // SVG_SUPPORT
-
diff --git a/WebCore/kcanvas/device/KRenderingPaintServerPattern.h b/WebCore/kcanvas/device/KRenderingPaintServerPattern.h
deleted file mode 100644 (file)
index 59e8091..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005 Rob Buis <buis@kde.org>
-
-    This file is part of the KDE project
-
-    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
-    aint with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-    Boston, MA 02111-1307, USA.
-*/
-
-#ifndef KRenderingPaintServerPattern_H
-#define KRenderingPaintServerPattern_H
-#ifdef SVG_SUPPORT
-
-#include "AffineTransform.h"
-#include "FloatRect.h"
-#include "KRenderingPaintServer.h"
-
-namespace WebCore {
-
-class SVGResourceImage;
-
-class KRenderingPaintServerPattern : public KRenderingPaintServer
-{
-public:
-    KRenderingPaintServerPattern();
-    virtual ~KRenderingPaintServerPattern();
-
-    virtual KCPaintServerType type() const;
-
-    // Pattern bbox
-    void setBbox(const FloatRect&);
-    FloatRect bbox() const;
-    
-    // Pattern x,y phase points are relative when in boundingBoxMode
-    // BoundingBox mode is true by default.
-    bool boundingBoxMode() const;
-    void setBoundingBoxMode(bool mode = true);
-    
-    // 'Pattern' interface
-    SVGResourceImage* tile() const;
-    void setTile(const PassRefPtr<SVGResourceImage>&);
-
-    AffineTransform patternTransform() const;
-    void setPatternTransform(const AffineTransform&);
-
-    SVGResourceListener* listener() const;
-    void setListener(SVGResourceListener*);
-    TextStream& externalRepresentation(TextStream&) const;
-
-private:
-    RefPtr<SVGResourceImage> m_tile;
-    AffineTransform m_patternTransform;
-    FloatRect m_bbox;
-    bool m_useBoundingBoxMode;
-    SVGResourceListener* m_listener;
-
-};
-
-}
-
-#endif // SVG_SUPPORT
-#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/kcanvas/device/KRenderingPaintServerSolid.cpp b/WebCore/kcanvas/device/KRenderingPaintServerSolid.cpp
deleted file mode 100644 (file)
index b42c4e3..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005 Rob Buis <buis@kde.org>
-
-    This file is part of the KDE project
-
-    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
-    aint with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-    Boston, MA 02111-1307, USA.
-*/
-
-#include "config.h"
-
-#ifdef SVG_SUPPORT
-#include "KRenderingPaintServerSolid.h"
-
-#include "SVGRenderTreeAsText.h"
-#include "TextStream.h"
-
-namespace WebCore {
-
-KRenderingPaintServerSolid::KRenderingPaintServerSolid()
-    : KRenderingPaintServer()
-{
-}
-
-KRenderingPaintServerSolid::~KRenderingPaintServerSolid()
-{
-}
-
-Color KRenderingPaintServerSolid::color() const
-{
-    return m_color;
-}
-
-void KRenderingPaintServerSolid::setColor(const Color &color)
-{
-    m_color = color;
-}
-
-KCPaintServerType KRenderingPaintServerSolid::type() const
-{
-    return PS_SOLID;
-}
-
-TextStream& KRenderingPaintServerSolid::externalRepresentation(TextStream& ts) const
-{
-    ts << "[type=SOLID]"
-        << " [color="<< color() << "]";
-    return ts;
-}
-
-TextStream& operator<<(TextStream& ts, const KRenderingPaintServer& ps)
-{
-    return ps.externalRepresentation(ts);
-}
-
-}
-
-// vim:ts=4:noet
-#endif // SVG_SUPPORT
-
diff --git a/WebCore/kcanvas/device/qt/KRenderingPaintServerGradientQt.cpp b/WebCore/kcanvas/device/qt/KRenderingPaintServerGradientQt.cpp
deleted file mode 100644 (file)
index ca33376..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
-    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005, 2006 Rob Buis <buis@kde.org>
-
-    This file is part of the KDE project
-
-    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 General Public License
-    along with this program; 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"
-
-#include <math.h>
-#include <QPointF>
-
-#include "RenderPath.h"
-#include "RenderStyle.h"
-#include "AffineTransform.h"
-#include "KRenderingDeviceQt.h"
-#include "KCanvasRenderingStyle.h"
-#include "KRenderingPaintServerGradientQt.h"
-
-namespace WebCore {
-
-void fill_color_array(QGradient& gradient, const Vector<KCGradientStop>& stops, float opacity)
-{
-    for (unsigned i = 0; i < stops.size(); ++i) {
-        float offset = stops[i].first;
-        Color color = stops[i].second;
-        
-        QColor c(color.red(), color.green(), color.blue());
-        c.setAlpha(int(color.alpha() * opacity));
-
-        gradient.setColorAt(offset, c);
-    }
-}
-
-// KRenderingPaintServerLinearGradientQt
-KRenderingPaintServerLinearGradientQt::KRenderingPaintServerLinearGradientQt()
-    : KRenderingPaintServerLinearGradient()
-    , KRenderingPaintServerQt()
-{
-}
-
-void KRenderingPaintServerLinearGradientQt::renderPath(KRenderingDeviceContext* context, const RenderPath* path, KCPaintTargetType type) const
-{
-    RenderStyle* renderStyle = path->style();
-    KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
-
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill())
-        qtContext->fillPath();
-
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke())
-        qtContext->strokePath();
-}
-
-bool KRenderingPaintServerLinearGradientQt::setup(KRenderingDeviceContext* context, const RenderObject* object, KCPaintTargetType type) const
-{
-    KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
-    Q_ASSERT(qtContext != 0);
-
-    if (listener())
-        listener()->resourceNotification();
-
-    RenderStyle* renderStyle = object->style();
-
-    double x1, x2, y1, y2;
-    if (boundingBoxMode()) {
-        QRectF bbox = qtContext->pathBBox();
-        x1 = double(bbox.left()) + (double(gradientStart().x() / 100.0) * double(bbox.width()));
-        y1 = double(bbox.top()) + (double(gradientStart().y() / 100.0) * double(bbox.height()));
-        x2 = double(bbox.left()) + (double(gradientEnd().x() / 100.0)  * double(bbox.width()));
-        y2 = double(bbox.top()) + (double(gradientEnd().y() / 100.0) * double(bbox.height()));
-    } else {
-        x1 = gradientStart().x();
-        y1 = gradientStart().y();
-        x2 = gradientEnd().x();
-        y2 = gradientEnd().y();
-    }
-
-    qtContext->painter().setPen(Qt::NoPen);
-    qtContext->painter().setBrush(Qt::NoBrush);
-
-    QLinearGradient gradient(QPointF(x1, y1), QPointF(x2, y2));
-    if (spreadMethod() == SPREADMETHOD_REPEAT)
-        gradient.setSpread(QGradient::RepeatSpread);
-    else if (spreadMethod() == SPREADMETHOD_REFLECT)
-        gradient.setSpread(QGradient::ReflectSpread);
-    else
-        gradient.setSpread(QGradient::PadSpread);
-
-    double opacity = 1.0;
-
-    // TODO: Gradient transform + opacity fixes! 
-
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill()) {
-        fill_color_array(gradient, gradientStops(), opacity);
-
-        QBrush brush(gradient);
-
-        qtContext->painter().setBrush(brush);
-        qtContext->setFillRule(renderStyle->svgStyle()->fillRule());
-    }
-
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke()) {
-        fill_color_array(gradient, gradientStops(), opacity);
-
-        QPen pen;
-        QBrush brush(gradient);
-
-        setPenProperties(object, renderStyle, pen);
-        pen.setBrush(brush);
-
-        qtContext->painter().setPen(pen);
-    }
-
-    return true;
-}
-
-void KRenderingPaintServerLinearGradientQt::teardown(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const
-{
-}
-
-void KRenderingPaintServerLinearGradientQt::draw(KRenderingDeviceContext* context, const RenderPath* path, KCPaintTargetType type) const
-{
-    if (!setup(context, path, type))
-        return;
-
-    renderPath(context, path, type);
-    teardown(context, path, type);
-}
-
-// KRenderingPaintServerRadialGradientQt
-KRenderingPaintServerRadialGradientQt::KRenderingPaintServerRadialGradientQt()
-    : KRenderingPaintServerRadialGradient()
-    , KRenderingPaintServerQt()
-{
-}
-
-bool KRenderingPaintServerRadialGradientQt::setup(KRenderingDeviceContext* context, const RenderObject* object, KCPaintTargetType type) const
-{
-    KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
-    Q_ASSERT(qtContext != 0);
-
-    if (listener())
-        listener()->resourceNotification();
-
-    RenderStyle* renderStyle = object->style();
-
-    qtContext->painter().setPen(Qt::NoPen);
-    qtContext->painter().setBrush(Qt::NoBrush);
-    QMatrix mat = qtContext->ctm();
-
-    double cx, fx, cy, fy, r;
-    if (boundingBoxMode()) {
-        QRectF bbox = qtContext->pathBBox();
-        cx = double(bbox.left()) + (double(gradientCenter().x() / 100.0) * double(bbox.width()));
-        cy = double(bbox.top()) + (double(gradientCenter().y() / 100.0) * double(bbox.height()));
-        fx = double(bbox.left()) + (double(gradientFocal().x() / 100.0) * double(bbox.width())) - cx;
-        fy = double(bbox.top()) + (double(gradientFocal().y() / 100.0) * double(bbox.height())) - cy;
-        r = double(gradientRadius() / 100.0) * (sqrt(pow(bbox.width(), 2) + pow(bbox.height(), 2)));
-
-        float width = bbox.width();
-        float height = bbox.height();
-
-        int diff = int(width - height); // allow slight tolerance
-        if (!(diff > -2 && diff < 2)) {
-            // make elliptical or circular depending on bbox aspect ratio
-            float ratioX = (width / height);
-            float ratioY = (height / width);
-            mat.scale((width > height) ? 1 : ratioX, (width > height) ? ratioY : 1);
-        }
-    } else {
-        cx = gradientCenter().x();
-        cy = gradientCenter().y();
-
-        fx = gradientFocal().x();
-        fy = gradientFocal().y();
-
-        fx -= cx;
-        fy -= cy;
-
-        r = gradientRadius();
-    }
-
-    if (sqrt(fx * fx + fy * fy) > r) {
-        // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and r, set (fx, fy)
-        // to the point of intersection of the line through (fx, fy) and the circle.
-        double angle = atan2(fy, fx);
-        fx = int(cos(angle) * r) - 1;
-        fy = int(sin(angle) * r) - 1;
-    }
-
-    QRadialGradient gradient(QPointF(cx, cy), gradientRadius(), QPointF(fx + cx, fy + cy));
-    if (spreadMethod() == SPREADMETHOD_REPEAT)
-        gradient.setSpread(QGradient::RepeatSpread);
-    else if (spreadMethod() == SPREADMETHOD_REFLECT)
-        gradient.setSpread(QGradient::ReflectSpread);
-    else
-        gradient.setSpread(QGradient::PadSpread);
-
-    double opacity = 1.0;
-
-    // TODO: Gradient transform + opacity fixes! 
-
-    // AffineTransform gradientTrans = gradientTransform();
-    // gradientTrans.map(cx, cy, &cx, &cy);
-    // qtContext->painter().setMatrix(mat);
-
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill()) {
-        fill_color_array(gradient, gradientStops(), opacity);
-
-        QBrush brush(gradient);
-
-        qtContext->painter().setBrush(brush);
-        qtContext->setFillRule(renderStyle->svgStyle()->fillRule());
-        
-    }
-
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke()) {
-        fill_color_array(gradient, gradientStops(), opacity);
-
-        QPen pen;
-        QBrush brush(gradient);
-
-        setPenProperties(object, renderStyle, pen);
-        pen.setBrush(brush);
-
-        qtContext->painter().setPen(pen);
-    }
-
-    return true;
-}
-
-void KRenderingPaintServerRadialGradientQt::draw(KRenderingDeviceContext* context, const RenderPath* path, KCPaintTargetType type) const
-{
-    if (!setup(context, path, type))
-        return;
-
-    renderPath(context, path, type);
-    teardown(context, path, type);
-}
-
-void KRenderingPaintServerRadialGradientQt::teardown(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const
-{
-}
-
-void KRenderingPaintServerRadialGradientQt::renderPath(KRenderingDeviceContext* context, const RenderPath* path, KCPaintTargetType type) const
-{
-    RenderStyle* renderStyle = path->style();
-    KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
-
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill())
-        qtContext->fillPath();
-
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke())
-        qtContext->strokePath();
-}
-
-}
-
-// vim:ts=4:noet
diff --git a/WebCore/kcanvas/device/qt/KRenderingPaintServerGradientQt.h b/WebCore/kcanvas/device/qt/KRenderingPaintServerGradientQt.h
deleted file mode 100644 (file)
index a6898c9..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005, 2006 Rob Buis <buis@kde.org>
-
-    This file is part of the KDE project
-
-    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 General Public License
-    along with this program; 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 KRenderingPaintServerGradientQt_H
-#define KRenderingPaintServerGradientQt_H
-
-#include "KRenderingPaintServerQt.h"
-#include "KRenderingPaintServerGradient.h"
-
-namespace WebCore {
-
-class KRenderingPaintServerLinearGradientQt : public KRenderingPaintServerLinearGradient,
-                                              public KRenderingPaintServerQt
-{
-public:
-    KRenderingPaintServerLinearGradientQt();
-
-    virtual void draw(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-    virtual bool setup(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-    virtual void teardown(KRenderingDeviceContext* , const RenderObject*, KCPaintTargetType) const;
-
-protected:
-    virtual void renderPath(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-};
-
-class KRenderingPaintServerRadialGradientQt : public KRenderingPaintServerRadialGradient,
-                                              public KRenderingPaintServerQt
-{
-public:
-    KRenderingPaintServerRadialGradientQt();
-
-    virtual void draw(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-    virtual bool setup(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-    virtual void teardown(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-
-protected:
-    virtual void renderPath(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-};
-
-}
-
-#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/kcanvas/device/qt/KRenderingPaintServerPatternQt.h b/WebCore/kcanvas/device/qt/KRenderingPaintServerPatternQt.h
deleted file mode 100644 (file)
index 570d259..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005, 2006 Rob Buis <buis@kde.org>
-
-    This file is part of the KDE project
-
-    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 General Public License
-    along with this program; 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 KRenderingPaintServerPatternQt_H
-#define KRenderingPaintServerPatternQt_H
-
-#include "KRenderingPaintServerQt.h"
-#include "KRenderingPaintServerPattern.h"
-
-namespace WebCore {
-
-class KRenderingPaintServerPatternQt : public KRenderingPaintServerPattern,
-                                       public KRenderingPaintServerQt
-{
-public:
-    KRenderingPaintServerPatternQt();
-    virtual ~KRenderingPaintServerPatternQt();
-
-    virtual void draw(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-    virtual bool setup(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-    virtual void teardown(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-
-protected:
-    virtual void renderPath(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-};
-
-}
-
-#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/kcanvas/device/qt/KRenderingPaintServerQt.h b/WebCore/kcanvas/device/qt/KRenderingPaintServerQt.h
deleted file mode 100644 (file)
index 0f6ee9b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005, 2006 Rob Buis <buis@kde.org>
-
-    This file is part of the KDE project
-
-    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 General Public License
-    along with this program; 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 KRenderingPaintServerQt_H
-#define KRenderingPaintServerQt_H
-
-#include "KRenderingPaintServer.h"
-
-class QPen;
-
-namespace WebCore {
-
-class RenderStyle;
-class RenderObject;
-
-// This class is designed as an extension to
-// KRenderingPaintServer, it won't inherit from it.
-class KRenderingPaintServerQt
-{
-public:
-    KRenderingPaintServerQt();
-    ~KRenderingPaintServerQt();
-
-    void setPenProperties(const RenderObject*, const RenderStyle*, QPen&) const;
-};
-
-}
-
-#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/kcanvas/device/qt/KRenderingPaintServerSolidQt.cpp b/WebCore/kcanvas/device/qt/KRenderingPaintServerSolidQt.cpp
deleted file mode 100644 (file)
index bb866db..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005, 2006 Rob Buis <buis@kde.org>
-
-    This file is part of the KDE project
-
-    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 General Public License
-    along with this program; 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"
-
-#include <QPen>
-#include <QBrush>
-#include <QPainter>
-
-#include "RenderPath.h"
-#include "RenderStyle.h"
-#include "KRenderingDeviceQt.h"
-#include "KCanvasRenderingStyle.h"
-#include "KRenderingPaintServerSolidQt.h"
-
-namespace WebCore {
-
-KRenderingPaintServerSolidQt::KRenderingPaintServerSolidQt()
-    : KRenderingPaintServerSolid()
-    , KRenderingPaintServerQt()
-{
-}
-
-KRenderingPaintServerSolidQt::~KRenderingPaintServerSolidQt()
-{
-}
-
-// 'Solid' interface
-void KRenderingPaintServerSolidQt::draw(KRenderingDeviceContext* context, const RenderPath* path, KCPaintTargetType type) const
-{
-    if (!setup(context, path, type))
-        return;
-
-    renderPath(context, path, type);
-    teardown(context, path, type);
-}
-
-bool KRenderingPaintServerSolidQt::setup(KRenderingDeviceContext* context, const RenderObject* object, KCPaintTargetType type) const
-{
-    KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
-
-    RenderStyle* renderStyle = object->style();
-    // TODO? qtContext->painter().setOpacity(renderStyle->opacity());
-
-    QColor c = color();
-
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill()) {
-        c.setAlphaF(renderStyle->svgStyle()->fillOpacity());
-
-        QBrush brush(c);
-        qtContext->painter().setBrush(brush);
-        qtContext->setFillRule(renderStyle->svgStyle()->fillRule());
-
-        /* if(isPaintingText()) ... */
-    }
-
-    if((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke()) {
-        c.setAlphaF(renderStyle->svgStyle()->strokeOpacity());
-
-        QPen pen(c);
-        setPenProperties(object, renderStyle, pen);
-        qtContext->painter().setPen(pen);
-
-        /* if(isPaintingText()) ... */
-    }
-
-    return true;
-}
-
-void KRenderingPaintServerSolidQt::teardown(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const
-{
-}
-
-void KRenderingPaintServerSolidQt::renderPath(KRenderingDeviceContext* context, const RenderPath* path, KCPaintTargetType type) const
-{
-    RenderStyle* renderStyle = path->style();
-    KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
-
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill())
-        qtContext->fillPath();
-
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke())
-        qtContext->strokePath();
-}
-
-}
-
-// vim:ts=4:noet
diff --git a/WebCore/kcanvas/device/qt/KRenderingPaintServerSolidQt.h b/WebCore/kcanvas/device/qt/KRenderingPaintServerSolidQt.h
deleted file mode 100644 (file)
index ae72f7e..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005, 2006 Rob Buis <buis@kde.org>
-
-    This file is part of the KDE project
-
-    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 General Public License
-    along with this program; 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 KRenderingPaintServerSolidQt_H
-#define KRenderingPaintServerSolidQt_H
-
-#include "KRenderingPaintServerQt.h"
-#include "KRenderingPaintServerSolid.h"
-
-namespace WebCore {
-    
-class KRenderingPaintServerSolidQt : public KRenderingPaintServerSolid,
-                                     public KRenderingPaintServerQt
-{
-public:
-    KRenderingPaintServerSolidQt();
-    virtual ~KRenderingPaintServerSolidQt();
-
-    virtual void draw(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-    virtual bool setup(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-    virtual void teardown(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-
-protected:
-    virtual void renderPath(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-};
-
-}
-
-#endif
-
-// vim:ts=4:noet
diff --git a/WebCore/kcanvas/device/quartz/KCanvasItemQuartz.h b/WebCore/kcanvas/device/quartz/KCanvasItemQuartz.h
deleted file mode 100644 (file)
index e69de29..0000000
index 02124739642dff116d9d2c456d45b9a4b65e71dd..5b161ef9477fd57cb3b0537b37ecad4eba5a676b 100644 (file)
 #include "SVGResourceImage.h"
 #include "SVGResourceMarker.h"
 #include "SVGResourceMasker.h"
-#include "KRenderingPaintServerQuartz.h"
+#include "SVGPaintServerSolid.h"
+#include "SVGPaintServerLinearGradient.h"
+#include "SVGPaintServerRadialGradient.h"
+#include "SVGPaintServerPattern.h"
 #include "Logging.h"
 #include "QuartzSupport.h"
 #include "RenderView.h"
@@ -148,21 +151,21 @@ KRenderingDeviceContext* KRenderingDeviceQuartz::contextForImage(SVGResourceImag
 #pragma mark -
 #pragma mark Resource Creation
 
-PassRefPtr<KRenderingPaintServer> KRenderingDeviceQuartz::createPaintServer(const KCPaintServerType& type) const
+PassRefPtr<SVGPaintServer> KRenderingDeviceQuartz::createPaintServer(const SVGPaintServerType& type) const
 {
-    KRenderingPaintServer *newServer = NULL;
+    SVGPaintServer* newServer = NULL;
     switch(type) {
     case PS_SOLID:
-        newServer = new KRenderingPaintServerSolidQuartz();
+        newServer = new SVGPaintServerSolid();
         break;
     case PS_PATTERN:
-        newServer = new KRenderingPaintServerPatternQuartz();
+        newServer = new SVGPaintServerPattern();
         break;
     case PS_LINEAR_GRADIENT:
-        newServer = new KRenderingPaintServerLinearGradientQuartz();
+        newServer = new SVGPaintServerLinearGradient();
         break;
     case PS_RADIAL_GRADIENT:
-        newServer = new KRenderingPaintServerRadialGradientQuartz();
+        newServer = new SVGPaintServerRadialGradient();
         break;
     }
     return newServer;
index 2052635105752977721990052cc558f6a8e8572a..3a123ba19b7330b72fefe1700578f072a326ada5 100644 (file)
@@ -69,7 +69,7 @@ public:
 
     // Resource creation
     virtual PassRefPtr<SVGResource> createResource(const SVGResourceType&) const;
-    virtual PassRefPtr<KRenderingPaintServer> createPaintServer(const KCPaintServerType&) const;
+    virtual PassRefPtr<SVGPaintServer> createPaintServer(const SVGPaintServerType&) const;
     virtual SVGFilterEffect *createFilterEffect(const SVGFilterEffectType&) const;
     
     // filters (mostly debugging)
diff --git a/WebCore/kcanvas/device/quartz/KRenderingPaintServerGradientQuartz.cpp b/WebCore/kcanvas/device/quartz/KRenderingPaintServerGradientQuartz.cpp
deleted file mode 100644 (file)
index 1784e27..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
- *               2006 Alexander Kellett <lypanov@kde.org>
- *               2006 Rob Buis <buis@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-
-#include "config.h"
-
-#ifdef SVG_SUPPORT
-#include "KRenderingPaintServerQuartz.h"
-#include "SVGResourceImage.h"
-#include "KRenderingDeviceQuartz.h"
-#include "KRenderingPaintServer.h"
-#include "QuartzSupport.h"
-#include "RenderPath.h"
-#include <wtf/Assertions.h>
-
-namespace WebCore {
-    
-static void cgGradientCallback(void* info, const CGFloat* inValues, CGFloat* outColor)
-{
-    const KRenderingPaintServerGradientQuartz* server = (const KRenderingPaintServerGradientQuartz*)info;
-    QuartzGradientStop *stops = server->m_stopsCache;
-    int stopsCount = server->m_stopsCount;
-    
-    CGFloat inValue = inValues[0];
-    
-    if (!stopsCount) {
-        outColor[0] = 0;
-        outColor[1] = 0;
-        outColor[2] = 0;
-        outColor[3] = 1;
-        return;
-    } else if (stopsCount == 1) {
-        memcpy(outColor, stops[0].colorArray, 4 * sizeof(CGFloat));
-        return;
-    }
-    
-    if (!(inValue > stops[0].offset))
-        memcpy(outColor, stops[0].colorArray, 4 * sizeof(CGFloat));
-    else if (!(inValue < stops[stopsCount-1].offset))
-        memcpy(outColor, stops[stopsCount-1].colorArray, 4 * sizeof(CGFloat));
-    else {
-        int nextStopIndex = 0;
-        while ((nextStopIndex < stopsCount) && (stops[nextStopIndex].offset < inValue))
-            nextStopIndex++;
-        
-        //float nextOffset = stops[nextStopIndex].offset;
-        CGFloat *nextColorArray = stops[nextStopIndex].colorArray;
-        CGFloat *previousColorArray = stops[nextStopIndex-1].colorArray;
-        //float totalDelta = nextOffset - previousOffset;
-        CGFloat diffFromPrevious = inValue - stops[nextStopIndex-1].offset;
-        //float percent = diffFromPrevious / totalDelta;
-        CGFloat percent = diffFromPrevious * stops[nextStopIndex].previousDeltaInverse;
-        
-        outColor[0] = ((1.0 - percent) * previousColorArray[0] + percent * nextColorArray[0]);
-        outColor[1] = ((1.0 - percent) * previousColorArray[1] + percent * nextColorArray[1]);
-        outColor[2] = ((1.0 - percent) * previousColorArray[2] + percent * nextColorArray[2]);
-        outColor[3] = ((1.0 - percent) * previousColorArray[3] + percent * nextColorArray[3]);
-    }
-    // FIXME: have to handle the spreadMethod()s here SPREADMETHOD_REPEAT, etc.
-}
-
-static CGShadingRef CGShadingRefForLinearGradient(const KRenderingPaintServerLinearGradientQuartz* server)
-{
-    CGPoint start = CGPoint(server->gradientStart());
-    CGPoint end = CGPoint(server->gradientEnd());
-    
-    CGFunctionCallbacks callbacks = {0, cgGradientCallback, NULL};
-    CGFloat domainLimits[2] = {0, 1};
-    CGFloat rangeLimits[8] = {0, 1, 0, 1, 0, 1, 0, 1};
-    const KRenderingPaintServerGradientQuartz* castServer = static_cast<const KRenderingPaintServerGradientQuartz*>(server);
-    CGFunctionRef shadingFunction = CGFunctionCreate((void *)castServer, 1, domainLimits, 4, rangeLimits, &callbacks);
-    
-    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
-    CGShadingRef shading = CGShadingCreateAxial(colorSpace, start, end, shadingFunction, true, true);
-    CGColorSpaceRelease(colorSpace);
-    CGFunctionRelease(shadingFunction);
-    return shading;
-}
-
-static CGShadingRef CGShadingRefForRadialGradient(const KRenderingPaintServerRadialGradientQuartz* server)
-{
-    CGPoint center = CGPoint(server->gradientCenter());
-    CGPoint focus = CGPoint(server->gradientFocal());
-    double radius = server->gradientRadius();
-    
-    double fdx = focus.x - center.x;
-    double fdy = focus.y - center.y;
-    
-    // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and r, set (fx, fy)
-    // to the point of intersection of the line through (fx, fy) and the circle.
-    if (sqrt(fdx*fdx + fdy*fdy) > radius) {
-        double angle = atan2(focus.y, focus.x);
-        focus.x = int(cos(angle) * radius) - 1;
-        focus.y = int(sin(angle) * radius) - 1;
-    }
-    
-    CGFunctionCallbacks callbacks = {0, cgGradientCallback, NULL};
-    CGFloat domainLimits[2] = {0, 1};
-    CGFloat rangeLimits[8] = {0, 1, 0, 1, 0, 1, 0, 1};
-    const KRenderingPaintServerGradientQuartz* castServer = static_cast<const KRenderingPaintServerGradientQuartz*>(server);
-    CGFunctionRef shadingFunction = CGFunctionCreate((void *)castServer, 1, domainLimits, 4, rangeLimits, &callbacks);
-    
-    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
-    CGShadingRef shading = CGShadingCreateRadial(colorSpace, focus, 0, center, radius, shadingFunction, true, true);
-    CGColorSpaceRelease(colorSpace);
-    CGFunctionRelease(shadingFunction);
-    return shading;
-}
-
-KRenderingPaintServerGradientQuartz::KRenderingPaintServerGradientQuartz()
-    : m_stopsCache(0)
-    , m_stopsCount(0)
-    , m_shadingCache(0)
-{
-}
-
-KRenderingPaintServerGradientQuartz::~KRenderingPaintServerGradientQuartz()
-{
-    delete m_stopsCache;
-    CGShadingRelease(m_shadingCache);
-}
-
-void KRenderingPaintServerGradientQuartz::updateQuartzGradientCache(const KRenderingPaintServerGradient *server)
-{
-    // cache our own copy of the stops for faster access.
-    // this is legacy code, probably could be reworked.
-    if (!m_stopsCache)
-        updateQuartzGradientStopsCache(server->gradientStops());
-    
-    if (m_shadingCache)
-        CGShadingRelease(m_shadingCache);
-    if (server->type() == PS_RADIAL_GRADIENT) {
-        const KRenderingPaintServerRadialGradientQuartz* radial = static_cast<const KRenderingPaintServerRadialGradientQuartz*>(server);
-        m_shadingCache = CGShadingRefForRadialGradient(radial);
-    } else if (server->type() == PS_LINEAR_GRADIENT) {
-        const KRenderingPaintServerLinearGradientQuartz* linear = static_cast<const KRenderingPaintServerLinearGradientQuartz*>(server);
-        m_shadingCache = CGShadingRefForLinearGradient(linear);
-    }
-}
-
-void KRenderingPaintServerGradientQuartz::updateQuartzGradientStopsCache(const Vector<KCGradientStop>& stops)
-{
-    delete m_stopsCache;
-
-    m_stopsCount = stops.size();
-    m_stopsCache = new QuartzGradientStop[m_stopsCount];
-    
-    CGFloat previousOffset = 0.0;
-    for (unsigned i = 0; i < stops.size(); ++i) {
-        m_stopsCache[i].offset = stops[i].first;
-        m_stopsCache[i].previousDeltaInverse = 1.0 / (stops[i].first - previousOffset);
-        previousOffset = stops[i].first;
-        CGFloat *ca = m_stopsCache[i].colorArray;
-        stops[i].second.getRGBA(ca[0], ca[1], ca[2], ca[3]);
-    }
-}
-
-void KRenderingPaintServerGradientQuartz::invalidateCaches()
-{
-    delete m_stopsCache;
-    CGShadingRelease(m_shadingCache);
-    
-    m_stopsCache = 0;
-    m_shadingCache = 0;
-}
-
-void KRenderingPaintServerLinearGradientQuartz::invalidate()
-{
-    invalidateCaches();
-    KRenderingPaintServerLinearGradient::invalidate();
-}
-
-void KRenderingPaintServerRadialGradientQuartz::invalidate()
-{
-    invalidateCaches();
-    KRenderingPaintServerRadialGradient::invalidate();
-}
-
-void KRenderingPaintServerGradientQuartz::draw(const KRenderingPaintServerGradient* server, KRenderingDeviceContext* renderingContext, const RenderPath* path, KCPaintTargetType type) const
-{
-    if (!setup(server, renderingContext, path, type))
-        return;
-    renderPath(server, renderingContext, path, type);
-    teardown(server, renderingContext, path, type);
-}
-
-bool KRenderingPaintServerGradientQuartz::setup(const KRenderingPaintServerGradient* server, KRenderingDeviceContext* renderingContext, const RenderObject* renderObject, KCPaintTargetType type) const
-{
-    if (server->listener()) // this seems like bad design to me, should be in a common baseclass. -- ecs 8/6/05
-        server->listener()->resourceNotification();
-    
-    // FIXME: total const HACK!
-    // We need a hook to call this when the gradient gets updated, before drawn.
-    if (!m_shadingCache)
-        const_cast<KRenderingPaintServerGradientQuartz*>(this)->updateQuartzGradientCache(server);
-    
-    KRenderingDeviceQuartz* quartzDevice = static_cast<KRenderingDeviceQuartz*>(renderingDevice());
-    CGContextRef context = quartzDevice->currentCGContext();
-    RenderStyle* renderStyle = renderObject->style();
-    ASSERT(context != NULL);
-    
-    CGContextSaveGState(context);
-    CGContextSetAlpha(context, renderStyle->opacity());
-    
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill()) {
-        CGContextSaveGState(context);
-        if (server->isPaintingText())
-            CGContextSetTextDrawingMode(context, kCGTextClip);
-    }
-
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke()) {
-        CGContextSaveGState(context);
-        applyStrokeStyleToContext(context, renderStyle, renderObject); // FIXME: this seems like the wrong place for this.
-        if (server->isPaintingText()) {
-            m_maskImage = new SVGResourceImage();
-            int width  = 2048;
-            int height = 2048; // FIXME???
-            IntSize size = IntSize(width, height);
-            m_maskImage->init(size);
-            KRenderingDeviceContext* maskImageContext = quartzDevice->contextForImage(m_maskImage.get());
-            quartzDevice->pushContext(maskImageContext);
-            CGContextRef maskContext = static_cast<KRenderingDeviceContextQuartz*>(maskImageContext)->cgContext();
-            const_cast<RenderObject*>(renderObject)->style()->setColor(Color(255, 255, 255));
-            CGContextSetTextDrawingMode(maskContext, kCGTextStroke);
-        }
-    }
-    return true;
-}
-
-void KRenderingPaintServerGradientQuartz::renderPath(const KRenderingPaintServerGradient* server, KRenderingDeviceContext* renderingContext, const RenderPath* path, KCPaintTargetType type) const
-{    
-    KRenderingDeviceQuartz* quartzDevice = static_cast<KRenderingDeviceQuartz*>(renderingDevice());
-    CGContextRef context = quartzDevice->currentCGContext();
-    RenderStyle* renderStyle = path->style();
-    ASSERT(context != NULL);
-    
-    CGRect objectBBox;
-    if (server->boundingBoxMode())
-        objectBBox = CGContextGetPathBoundingBox(context);
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill())
-        KRenderingPaintServerQuartzHelper::clipToFillPath(context, path);
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke())
-        KRenderingPaintServerQuartzHelper::clipToStrokePath(context, path);
-    // make the gradient fit in the bbox if necessary.
-    if (server->boundingBoxMode()) { // no support for bounding boxes around text yet!
-        // get the object bbox
-        CGRect gradientBBox = CGRectMake(0,0,100,100); // FIXME - this is arbitrary no?
-        // generate a transform to map between the two.
-        CGAffineTransform gradientIntoObjectBBox = CGAffineTransformMakeMapBetweenRects(gradientBBox, objectBBox);
-        CGContextConcatCTM(context, gradientIntoObjectBBox);
-    }
-    
-    // apply the gradient's own transform
-    CGAffineTransform gradientTransform = server->gradientTransform();
-    CGContextConcatCTM(context, gradientTransform);
-}
-
-void KRenderingPaintServerGradientQuartz::teardown(const KRenderingPaintServerGradient *server, KRenderingDeviceContext* renderingContext, const RenderObject* renderObject, KCPaintTargetType type) const
-{ 
-    CGShadingRef shading = m_shadingCache;
-    KRenderingDeviceQuartz* quartzDevice = static_cast<KRenderingDeviceQuartz*>(renderingDevice());
-    CGContextRef context = quartzDevice->currentCGContext();
-    RenderStyle* renderStyle = renderObject->style();
-    ASSERT(context != NULL);
-    
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill()) {
-        // workaround for filling the entire screen with the shading in the case that no text was intersected with the clip
-        if (!server->isPaintingText() || (renderObject->width() > 0 && renderObject->height() > 0))
-            CGContextDrawShading(context, shading);
-        CGContextRestoreGState(context);
-    }
-    
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke()) {
-        if (server->isPaintingText()) {
-            int width  = 2048;
-            int height = 2048; // FIXME??? SEE ABOVE
-            delete quartzDevice->popContext();
-            context = quartzDevice->currentCGContext();
-            void* imageBuffer = fastMalloc(width * height);
-            CGColorSpaceRef grayColorSpace = CGColorSpaceCreateDeviceGray();
-            CGContextRef grayscaleContext = CGBitmapContextCreate(imageBuffer, width, height, 8, width, grayColorSpace, kCGImageAlphaNone);
-            CGColorSpaceRelease(grayColorSpace);
-            CGContextDrawLayerAtPoint(grayscaleContext, CGPointMake(0, 0), m_maskImage->cgLayer());
-            CGImageRef grayscaleImage = CGBitmapContextCreateImage(grayscaleContext);
-            CGContextClipToMask(context, CGRectMake(0, 0, width, height), grayscaleImage);
-            CGContextRelease(grayscaleContext);
-            CGImageRelease(grayscaleImage);
-        }
-        CGContextDrawShading(context, shading);
-        CGContextRestoreGState(context);
-    }
-    
-    CGContextRestoreGState(context);
-}
-
-}
-
-#endif // SVG_SUPPORT
diff --git a/WebCore/kcanvas/device/quartz/KRenderingPaintServerQuartz.cpp b/WebCore/kcanvas/device/quartz/KRenderingPaintServerQuartz.cpp
deleted file mode 100644 (file)
index 57c1462..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
- *               2006 Alexander Kellett <lypanov@kde.org>
- *               2006 Rob Buis <buis@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-
-#include "config.h"
-
-#ifdef SVG_SUPPORT
-#include "SVGResourceImage.h"
-#include "KRenderingPaintServerQuartz.h"
-#include "RenderPath.h"
-#include "QuartzSupport.h"
-#include "KRenderingDeviceQuartz.h"
-
-#include "KCanvasRenderingStyle.h"
-#include "KRenderingPaintServer.h"
-#include "KRenderingDevice.h"
-
-#include "Logging.h"
-
-namespace WebCore {
-
-void KRenderingPaintServerQuartzHelper::strokePath(CGContextRef context, const RenderPath* renderPath)
-{
-    CGContextStrokePath(context);
-}
-
-void KRenderingPaintServerQuartzHelper::clipToStrokePath(CGContextRef context, const RenderPath* renderPath)
-{
-    CGContextReplacePathWithStrokedPath(context);
-    CGContextClip(context);
-}    
-
-void KRenderingPaintServerQuartzHelper::fillPath(CGContextRef context, const RenderPath* renderPath)
-{
-    if (renderPath->style()->svgStyle()->fillRule() == RULE_EVENODD)
-        CGContextEOFillPath(context);
-    else
-        CGContextFillPath(context);
-}
-
-void KRenderingPaintServerQuartzHelper::clipToFillPath(CGContextRef context, const RenderPath* renderPath)
-{
-    if (renderPath->style()->svgStyle()->fillRule() == RULE_EVENODD)
-        CGContextEOClip(context);
-    else
-        CGContextClip(context);
-}    
-
-void KRenderingPaintServerSolidQuartz::draw(KRenderingDeviceContext* renderingContext, const RenderPath* path, KCPaintTargetType type) const
-{
-    if (!setup(renderingContext, path, type))
-        return;
-    renderPath(renderingContext, path, type);
-    teardown(renderingContext, path, type);
-}
-
-bool KRenderingPaintServerSolidQuartz::setup(KRenderingDeviceContext* renderingContext, const RenderObject* renderObject, KCPaintTargetType type) const
-{
-    KRenderingDeviceContextQuartz* quartzContext = static_cast<KRenderingDeviceContextQuartz*>(renderingContext);
-    CGContextRef context = quartzContext->cgContext();
-    RenderStyle* renderStyle = renderObject->style();
-
-    CGContextSetAlpha(context, renderStyle->opacity());
-    
-    static CGColorSpaceRef deviceRGBColorSpace = CGColorSpaceCreateDeviceRGB(); // This should be shared from GraphicsContext, or some other central location
-
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill()) {
-        CGFloat colorComponents[4];
-        color().getRGBA(colorComponents[0], colorComponents[1], colorComponents[2], colorComponents[3]);
-        ASSERT(!color().hasAlpha());
-        colorComponents[3] = renderStyle->svgStyle()->fillOpacity(); // SVG/CSS colors are not specified w/o alpha
-        CGContextSetFillColorSpace(context, deviceRGBColorSpace);
-        CGContextSetFillColor(context, colorComponents);
-        if (isPaintingText()) {
-            const_cast<RenderObject*>(renderObject)->style()->setColor(color());
-            CGContextSetTextDrawingMode(context, kCGTextFill);
-        }
-    }
-
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke()) {
-        CGFloat colorComponents[4];
-        color().getRGBA(colorComponents[0], colorComponents[1], colorComponents[2], colorComponents[3]);
-        ASSERT(!color().hasAlpha());
-        colorComponents[3] = renderStyle->svgStyle()->strokeOpacity(); // SVG/CSS colors are not specified w/o alpha
-        CGContextSetStrokeColorSpace(context, deviceRGBColorSpace);
-        CGContextSetStrokeColor(context, colorComponents);
-        applyStrokeStyleToContext(context, renderStyle, renderObject);
-        if (isPaintingText()) {
-            const_cast<RenderObject*>(renderObject)->style()->setColor(color());
-            CGContextSetTextDrawingMode(context, kCGTextStroke);
-        }
-    }
-    
-    return true;
-}
-
-void KRenderingPaintServerSolidQuartz::renderPath(KRenderingDeviceContext* renderingContext, const RenderPath* renderPath, KCPaintTargetType type) const
-{
-    RenderStyle* renderStyle = renderPath->style();
-    KRenderingDeviceContextQuartz* quartzContext = static_cast<KRenderingDeviceContextQuartz*>(renderingContext);
-    CGContextRef context = quartzContext->cgContext();    
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill())
-        KRenderingPaintServerQuartzHelper::fillPath(context, renderPath);
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke())
-        KRenderingPaintServerQuartzHelper::strokePath(context, renderPath);
-}
-
-void KRenderingPaintServerSolidQuartz::teardown(KRenderingDeviceContext* renderingContext, const RenderObject* renderObject, KCPaintTargetType type) const
-{
-}
-
-void patternCallback(void *info, CGContextRef context)
-{
-    CGLayerRef layer = reinterpret_cast<SVGResourceImage*>(info)->cgLayer();
-    CGContextDrawLayerAtPoint(context, CGPointZero, layer);
-}
-
-void KRenderingPaintServerPatternQuartz::draw(KRenderingDeviceContext* renderingContext, const RenderPath* path, KCPaintTargetType type) const
-{
-    if (!setup(renderingContext, path, type))
-        return;
-    renderPath(renderingContext, path, type);
-    teardown(renderingContext, path, type);
-}
-
-bool KRenderingPaintServerPatternQuartz::setup(KRenderingDeviceContext* renderingContext, const RenderObject* renderObject, KCPaintTargetType type) const
-{
-    if(listener()) // this seems like bad design to me, should be in a common baseclass. -- ecs 8/6/05
-        listener()->resourceNotification();
-
-    RenderStyle* renderStyle = renderObject->style();
-
-    KRenderingDeviceContextQuartz* quartzContext = static_cast<KRenderingDeviceContextQuartz*>(renderingContext);
-    CGContextRef context = quartzContext->cgContext();
-
-    RefPtr<SVGResourceImage> cell = tile();
-    if (!cell)
-        return false;
-
-    CGContextSaveGState(context);
-
-    CGSize cellSize = CGSize(cell->size());
-
-    CGFloat alpha = 1; // canvasStyle->opacity(); //which?
-            
-    // Patterns don't seem to resepect the CTM unless we make them...
-    CGAffineTransform ctm = CGContextGetCTM(context);
-    CGAffineTransform transform = patternTransform();
-    transform = CGAffineTransformConcat(transform, ctm);
-
-    CGSize phase = CGSizeMake(bbox().x(), -bbox().y()); // Pattern space seems to start in the lower-left, so we flip the Y here.
-    CGContextSetPatternPhase(context, phase);
-
-    CGPatternCallbacks callbacks = {0, patternCallback, NULL};
-    m_pattern = CGPatternCreate(
-        tile(),
-        CGRectMake(0, 0, cellSize.width, cellSize.height),
-        transform,
-        bbox().width(), //cellSize.width,
-        bbox().height(), //cellSize.height,
-        kCGPatternTilingConstantSpacing,  // FIXME: should ask CG guys.
-        true, // has color
-        &callbacks);
-
-    CGContextSetAlpha(context, renderStyle->opacity()); // or do I set the alpha above?
-
-    m_patternSpace = CGColorSpaceCreatePattern(NULL);
-
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill()) {
-        CGContextSetFillColorSpace(context, m_patternSpace);
-        CGContextSetFillPattern(context, m_pattern, &alpha);
-        if (isPaintingText()) {
-            const_cast<RenderObject*>(renderObject)->style()->setColor(Color());
-            CGContextSetTextDrawingMode(context, kCGTextFill);
-        }
-    }
-    
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke()) {
-        CGContextSetStrokeColorSpace(context, m_patternSpace);
-        CGContextSetStrokePattern(context, m_pattern, &alpha);
-        applyStrokeStyleToContext(context, renderStyle, renderObject);
-        if (isPaintingText()) {
-            const_cast<RenderObject*>(renderObject)->style()->setColor(Color());
-            CGContextSetTextDrawingMode(context, kCGTextStroke);
-        }
-    }
-    
-    return true;
-}
-
-void KRenderingPaintServerPatternQuartz::renderPath(KRenderingDeviceContext* renderingContext, const RenderPath* renderPath, KCPaintTargetType type) const
-{
-    RenderStyle* renderStyle = renderPath->style();
-
-    KRenderingDeviceContextQuartz* quartzContext = static_cast<KRenderingDeviceContextQuartz*>(renderingContext);
-    CGContextRef context = quartzContext->cgContext();
-
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill())
-        KRenderingPaintServerQuartzHelper::fillPath(context, renderPath);
-    
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke())
-        KRenderingPaintServerQuartzHelper::strokePath(context, renderPath);
-}
-
-void KRenderingPaintServerPatternQuartz::teardown(KRenderingDeviceContext* renderingContext, const RenderObject* renderObject, KCPaintTargetType type) const
-{
-    KRenderingDeviceContextQuartz* quartzContext = static_cast<KRenderingDeviceContextQuartz*>(renderingContext);
-    CGContextRef context = quartzContext->cgContext();
-    CGPatternRelease(m_pattern);
-    CGColorSpaceRelease(m_patternSpace);
-    CGContextRestoreGState(context);
-}
-
-}
-
-#endif // SVG_SUPPORT
diff --git a/WebCore/kcanvas/device/quartz/KRenderingPaintServerQuartz.h b/WebCore/kcanvas/device/quartz/KRenderingPaintServerQuartz.h
deleted file mode 100644 (file)
index 9ce3988..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved. 
- *               2006 Alexander Kellett <lypanov@kde.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-#ifndef KRenderingPaintServerQuartz_H
-#define KRenderingPaintServerQuartz_H
-
-#include "KRenderingDevice.h"
-#include "KRenderingPaintServerSolid.h"
-#include "KRenderingPaintServerPattern.h"
-#include "KRenderingPaintServerGradient.h"
-
-namespace WebCore {
-
-class SVGResourceImage;
-
-class KRenderingPaintServerQuartzHelper {
-public:
-    static void strokePath(CGContextRef, const RenderPath*);
-    static void clipToStrokePath(CGContextRef, const RenderPath*);
-    static void fillPath(CGContextRef, const RenderPath*);
-    static void clipToFillPath(CGContextRef, const RenderPath*);
-};
-
-class KRenderingPaintServerSolidQuartz : public KRenderingPaintServerSolid {
-public:
-    KRenderingPaintServerSolidQuartz() {};
-    virtual void draw(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-    virtual bool setup(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-    virtual void teardown(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-protected:
-    virtual void renderPath(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-};
-
-class KRenderingPaintServerPatternQuartz : public KRenderingPaintServerPattern {
-public:
-    KRenderingPaintServerPatternQuartz() {}
-    virtual void draw(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-    virtual bool setup(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-    virtual void teardown(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-protected:
-    virtual void renderPath(KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-private:
-    mutable CGColorSpaceRef m_patternSpace;
-    mutable CGPatternRef m_pattern;
-};
-
-typedef struct {
-    CGFloat colorArray[4];
-    CGFloat offset;
-    CGFloat previousDeltaInverse;
-} QuartzGradientStop;
-
-// Does not subclass from KRenderingPaintServerGradient intentionally.
-class KRenderingPaintServerGradientQuartz {
-
-public:
-    KRenderingPaintServerGradientQuartz();
-    virtual ~KRenderingPaintServerGradientQuartz();
-    
-    void updateQuartzGradientStopsCache(const Vector<KCGradientStop>& stops);
-    void updateQuartzGradientCache(const KRenderingPaintServerGradient* server);
-
-    void draw(const KRenderingPaintServerGradient* server, KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-    bool setup(const KRenderingPaintServerGradient* server, KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-    void teardown(const KRenderingPaintServerGradient* server, KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const;
-    void renderPath(const KRenderingPaintServerGradient* server, KRenderingDeviceContext*, const RenderPath*, KCPaintTargetType) const;
-
-public:
-    // due to c functions
-    QuartzGradientStop *m_stopsCache;
-    int                 m_stopsCount;
-
-protected:
-    void invalidateCaches();
-    CGShadingRef m_shadingCache;
-    mutable RefPtr<SVGResourceImage> m_maskImage;
-};
-
-class KRenderingPaintServerLinearGradientQuartz : public KRenderingPaintServerGradientQuartz,
-                                                  public KRenderingPaintServerLinearGradient {
-public:
-    KRenderingPaintServerLinearGradientQuartz() { }
-    virtual void invalidate();
-    virtual void draw(KRenderingDeviceContext* context, const RenderPath* renderPath, KCPaintTargetType type) const
-        { KRenderingPaintServerGradientQuartz::draw(this, context, renderPath, type); }
-    virtual bool setup(KRenderingDeviceContext* context, const RenderObject* renderObject, KCPaintTargetType type) const
-        { return KRenderingPaintServerGradientQuartz::setup(this, context, renderObject, type); }
-    virtual void teardown(KRenderingDeviceContext* context, const RenderObject* renderObject, KCPaintTargetType type) const
-        { KRenderingPaintServerGradientQuartz::teardown(this, context, renderObject, type); }
-    virtual void renderPath(KRenderingDeviceContext* context, const RenderPath* renderPath, KCPaintTargetType type) const
-        { KRenderingPaintServerGradientQuartz::renderPath(this, context, renderPath, type); }
-};
-
-class KRenderingPaintServerRadialGradientQuartz : public KRenderingPaintServerGradientQuartz,
-                                                  public KRenderingPaintServerRadialGradient {
-public:
-    KRenderingPaintServerRadialGradientQuartz() { }
-    virtual void invalidate();
-    virtual void draw(KRenderingDeviceContext* context, const RenderPath* renderPath, KCPaintTargetType type) const
-        { KRenderingPaintServerGradientQuartz::draw(this, context, renderPath, type); }
-    virtual bool setup(KRenderingDeviceContext* context, const RenderObject* renderObject, KCPaintTargetType type) const
-        { return KRenderingPaintServerGradientQuartz::setup(this, context, renderObject, type); }
-    virtual void teardown(KRenderingDeviceContext* context, const RenderObject* renderObject, KCPaintTargetType type) const
-        { KRenderingPaintServerGradientQuartz::teardown(this, context, renderObject, type); }
-    virtual void renderPath(KRenderingDeviceContext* context, const RenderPath* renderPath, KCPaintTargetType type) const
-        { KRenderingPaintServerGradientQuartz::renderPath(this, context, renderPath, type); }
-};
-
-}
-
-#endif // !KRenderingPaintServerQuartz_H
index bafc5df3d4f3d49371acb4d8c72a9dd19eac2aab..a41eee1f9535407a5e588ae099d55f9b452f1377 100644 (file)
@@ -28,8 +28,8 @@
 #include "CSSValueList.h"
 #include "Document.h"
 #include "KRenderingDevice.h"
-#include "KRenderingPaintServerGradient.h"
-#include "KRenderingPaintServerSolid.h"
+#include "SVGPaintServerGradient.h"
+#include "SVGPaintServerSolid.h"
 #include "RenderObject.h"
 #include "RenderPath.h"
 #include "SVGLength.h"
 
 namespace WebCore {
 
-static KRenderingPaintServerSolid* sharedSolidPaintServer()
+static SVGPaintServerSolid* sharedSolidPaintServer()
 {
-    static KRenderingPaintServerSolid* _sharedSolidPaintServer = 0;
+    static SVGPaintServerSolid* _sharedSolidPaintServer = 0;
     if (!_sharedSolidPaintServer)
-        _sharedSolidPaintServer = static_cast<KRenderingPaintServerSolid*>(renderingDevice()->createPaintServer(PS_SOLID).releaseRef());
+        _sharedSolidPaintServer = static_cast<SVGPaintServerSolid*>(renderingDevice()->createPaintServer(PS_SOLID).releaseRef());
     return _sharedSolidPaintServer;
 }
 
-KRenderingPaintServer* KSVGPainterFactory::fillPaintServer(const RenderStyle* style, const RenderObject* item)
+SVGPaintServer* KSVGPainterFactory::fillPaintServer(const RenderStyle* style, const RenderObject* item)
 {
     if (!style->svgStyle()->hasFill())
         return 0;
 
     SVGPaint* fill = style->svgStyle()->fillPaint();
 
-    KRenderingPaintServer* fillPaintServer = 0;
+    SVGPaintServer* fillPaintServer = 0;
     if (fill->paintType() == SVGPaint::SVG_PAINTTYPE_URI) {
         fillPaintServer = getPaintServerById(item->document(), AtomicString(fill->uri().substring(1)));
         if (fillPaintServer && item->isRenderPath())
@@ -63,11 +63,11 @@ KRenderingPaintServer* KSVGPainterFactory::fillPaintServer(const RenderStyle* st
         if (!fillPaintServer) {
             // default value (black), see bug 11017
             fillPaintServer = sharedSolidPaintServer();
-            static_cast<KRenderingPaintServerSolid*>(fillPaintServer)->setColor(Color::black);
+            static_cast<SVGPaintServerSolid*>(fillPaintServer)->setColor(Color::black);
         }
     } else {
         fillPaintServer = sharedSolidPaintServer();
-        KRenderingPaintServerSolid* fillPaintServerSolid = static_cast<KRenderingPaintServerSolid*>(fillPaintServer);
+        SVGPaintServerSolid* fillPaintServerSolid = static_cast<SVGPaintServerSolid*>(fillPaintServer);
         if (fill->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR)
             fillPaintServerSolid->setColor(style->color());
         else
@@ -76,21 +76,21 @@ KRenderingPaintServer* KSVGPainterFactory::fillPaintServer(const RenderStyle* st
     return fillPaintServer;
 }
 
-KRenderingPaintServer* KSVGPainterFactory::strokePaintServer(const RenderStyle* style, const RenderObject* item)
+SVGPaintServer* KSVGPainterFactory::strokePaintServer(const RenderStyle* style, const RenderObject* item)
 {
     if (!style->svgStyle()->hasStroke())
         return 0;
 
     SVGPaint* stroke = style->svgStyle()->strokePaint();
 
-    KRenderingPaintServer* strokePaintServer = 0;
+    SVGPaintServer* strokePaintServer = 0;
     if (stroke->paintType() == SVGPaint::SVG_PAINTTYPE_URI) {
         strokePaintServer = getPaintServerById(item->document(), AtomicString(stroke->uri().substring(1)));
         if (item && strokePaintServer && item->isRenderPath())
             strokePaintServer->addClient(static_cast<const RenderPath*>(item));
     } else {
         strokePaintServer = sharedSolidPaintServer();
-        KRenderingPaintServerSolid* strokePaintServerSolid = static_cast<KRenderingPaintServerSolid*>(strokePaintServer);
+        SVGPaintServerSolid* strokePaintServerSolid = static_cast<SVGPaintServerSolid*>(strokePaintServer);
         if (stroke->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR)
             strokePaintServerSolid->setColor(style->color());
         else
index e7986e9b9a89683de1e43877e67ac27905017f16..153bd274974c0d951b4068a242d3b2c84621b316 100644 (file)
@@ -41,14 +41,14 @@ typedef Vector<float> KCDashArray;
 #endif
 
     class CSSValue;
-    class KRenderingPaintServer;
+    class SVGPaintServer;
     class RenderStyle;
     class RenderObject;
 
     class KSVGPainterFactory {
     public:
-        static KRenderingPaintServer* strokePaintServer(const RenderStyle*, const RenderObject*);
-        static KRenderingPaintServer* fillPaintServer(const RenderStyle*, const RenderObject*);
+        static SVGPaintServer* strokePaintServer(const RenderStyle*, const RenderObject*);
+        static SVGPaintServer* fillPaintServer(const RenderStyle*, const RenderObject*);
 
         // Helpers
         static double cssPrimitiveToLength(const RenderObject*, CSSValue*, double defaultValue = 0.0);
index 461fb4d3c07541092d31ee03765b4ff9b0c79ec4..8722c266cc56c2693c8b32565a8e4ecee8a1a083 100644 (file)
@@ -25,7 +25,6 @@
 #include "SVGFEGaussianBlurElement.h"
 
 #include "KRenderingDevice.h"
-#include "KRenderingPaintServerGradient.h"
 #include "SVGHelper.h"
 #include "SVGNames.h"
 
index 0bbf211fa076fe13378b5be62c2936a70834600f..3637ca305194780993c186d0db0bc91cf2e520d5 100644 (file)
@@ -25,7 +25,6 @@
 #include "Attr.h"
 
 #include "KRenderingDevice.h"
-#include "KRenderingPaintServerGradient.h"
 
 #include "SVGHelper.h"
 #include "SVGRenderStyle.h"
index 38440f4318eae14b46a26452b0947e9f68898814..f24d65bb8a2b12a439a5b7c88cb8e22813f3fe14 100644 (file)
@@ -106,7 +106,7 @@ void SVGGradientElement::notifyAttributeChange() const
 SVGResource* SVGGradientElement::canvasResource()
 {
     if (!m_resource) {
-        m_resource = WTF::static_pointer_cast<KRenderingPaintServerGradient>(renderingDevice()->createPaintServer(gradientType()));
+        m_resource = WTF::static_pointer_cast<SVGPaintServerGradient>(renderingDevice()->createPaintServer(gradientType()));
         m_resource->setListener(this);
         buildGradient(m_resource);
     }
@@ -116,13 +116,13 @@ SVGResource* SVGGradientElement::canvasResource()
 void SVGGradientElement::resourceNotification() const
 {
     // We're referenced by a "client", build the gradient now...
-    buildGradient(static_cast<KRenderingPaintServerGradient*>(const_cast<SVGGradientElement*>(this)->canvasResource()));
+    buildGradient(static_cast<SVGPaintServerGradient*>(const_cast<SVGGradientElement*>(this)->canvasResource()));
 }
 
 void SVGGradientElement::rebuildStops() const
 {
     if (m_resource && !ownerDocument()->parsing()) {
-        Vector<KCGradientStop> stops;
+        Vector<SVGGradientStop> stops;
          // FIXME: Manual style resolution is a hack
         RenderStyle* gradientStyle = const_cast<SVGGradientElement*>(this)->styleForRenderer(parent()->renderer());
         for (Node* n = firstChild(); n; n = n->nextSibling()) {
index 2caf59f4cae93c11516050badf6542cb4ce7ea41..1972d3abb9c7f0335fd4fb3c03a2e163938e846e 100644 (file)
@@ -24,7 +24,7 @@
 #define KSVG_SVGGradientElementImpl_H
 #ifdef SVG_SUPPORT
 
-#include "KRenderingPaintServerGradient.h"
+#include "SVGPaintServerGradient.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGStyledElement.h"
 #include "SVGURIReference.h"
@@ -57,8 +57,8 @@ namespace WebCore {
         virtual void resourceNotification() const;
 
     protected:
-        virtual void buildGradient(PassRefPtr<KRenderingPaintServerGradient>) const = 0;
-        virtual KCPaintServerType gradientType() const = 0;
+        virtual void buildGradient(PassRefPtr<SVGPaintServerGradient>) const = 0;
+        virtual SVGPaintServerType gradientType() const = 0;
         void rebuildStops() const;
 
     protected:
@@ -69,7 +69,7 @@ namespace WebCore {
         ANIMATED_PROPERTY_DECLARATIONS(SVGGradientElement, int, int, GradientUnits, gradientUnits)
         ANIMATED_PROPERTY_DECLARATIONS(SVGGradientElement, SVGTransformList*, RefPtr<SVGTransformList>, GradientTransform, gradientTransform)
 
-        mutable RefPtr<KRenderingPaintServerGradient> m_resource;
+        mutable RefPtr<SVGPaintServerGradient> m_resource;
     };
 
 } // namespace WebCore
index 1015d7448230aa580b5fe6970e72a867b8d5d143..c8eb1ac680ae7706953cd6dd8903a409043e8bb8 100644 (file)
@@ -25,7 +25,7 @@
 #include "SVGLinearGradientElement.h"
 
 #include "KRenderingDevice.h"
-#include "KRenderingPaintServerGradient.h"
+#include "SVGPaintServerLinearGradient.h"
 #include "SVGHelper.h"
 #include "SVGLength.h"
 #include "SVGMatrix.h"
@@ -71,7 +71,7 @@ void SVGLinearGradientElement::parseMappedAttribute(MappedAttribute* attr)
         SVGGradientElement::parseMappedAttribute(attr);
 }
 
-void SVGLinearGradientElement::buildGradient(PassRefPtr<KRenderingPaintServerGradient> _grad) const
+void SVGLinearGradientElement::buildGradient(PassRefPtr<SVGPaintServerGradient> _grad) const
 {
     rebuildStops(); // rebuild stops before possibly importing them from any referenced gradient.
 
@@ -85,23 +85,23 @@ void SVGLinearGradientElement::buildGradient(PassRefPtr<KRenderingPaintServerGra
     float _x1 = x1()->value(), _y1 = y1()->value();
     float _x2 = x2()->value(), _y2 = y2()->value();
 
-    RefPtr<KRenderingPaintServerLinearGradient> grad = WTF::static_pointer_cast<KRenderingPaintServerLinearGradient>(_grad);
+    RefPtr<SVGPaintServerLinearGradient> grad = WTF::static_pointer_cast<SVGPaintServerLinearGradient>(_grad);
     AffineTransform mat;
     if (gradientTransform()->numberOfItems() > 0)
         mat = gradientTransform()->consolidate()->matrix()->matrix();
 
     DeprecatedString ref = href().deprecatedString();
-    RefPtr<KRenderingPaintServer> pserver = getPaintServerById(document(), ref.mid(1));
+    RefPtr<SVGPaintServer> pserver = getPaintServerById(document(), ref.mid(1));
     
     if (pserver && (pserver->type() == PS_RADIAL_GRADIENT || pserver->type() == PS_LINEAR_GRADIENT)) {
         bool isLinear = pserver->type() == PS_LINEAR_GRADIENT;
-        KRenderingPaintServerGradient* gradient = static_cast<KRenderingPaintServerGradient*>(pserver.get());
+        SVGPaintServerGradient* gradient = static_cast<SVGPaintServerGradient*>(pserver.get());
 
         if (!hasAttribute(SVGNames::gradientUnitsAttr))
             bbox = gradient->boundingBoxMode();
             
         if (isLinear) {
-            KRenderingPaintServerLinearGradient* linear = static_cast<KRenderingPaintServerLinearGradient*>(pserver.get());
+            SVGPaintServerLinearGradient* linear = static_cast<SVGPaintServerLinearGradient*>(pserver.get());
             if (!hasAttribute(SVGNames::x1Attr))
                 _x1 = linear->gradientStart().x();
             else if (bbox)
index deb6297f6fc8bcb56c39606fa19c1fbc70f92db8..1c4d1c335ef12dd75e86aa11cf818879fde19718 100644 (file)
@@ -39,8 +39,8 @@ namespace WebCore
         virtual void parseMappedAttribute(MappedAttribute*);
 
     protected:
-        virtual void buildGradient(PassRefPtr<KRenderingPaintServerGradient>) const;
-        virtual KCPaintServerType gradientType() const { return PS_LINEAR_GRADIENT; }
+        virtual void buildGradient(PassRefPtr<SVGPaintServerGradient>) const;
+        virtual SVGPaintServerType gradientType() const { return PS_LINEAR_GRADIENT; }
 
     protected:
         virtual const SVGElement* contextElement() const { return this; }
index 38084ec01ad92d682fed2a958714cc62e559c4c4..c26c7cbfc1a0361a707493898d66e33082bfd038 100644 (file)
@@ -28,7 +28,7 @@
 #include "GraphicsContext.h"
 #include "SVGResourceImage.h"
 #include "KRenderingDevice.h"
-#include "KRenderingPaintServerPattern.h"
+#include "SVGPaintServerPattern.h"
 #include "RenderSVGContainer.h"
 #include "SVGHelper.h"
 #include "SVGLength.h"
@@ -137,12 +137,12 @@ void SVGPatternElement::resourceNotification() const
 void SVGPatternElement::fillAttributesFromReferencePattern(const SVGPatternElement* target, AffineTransform& patternTransformMatrix)
 {
     DeprecatedString ref = href().deprecatedString();
-    RefPtr<KRenderingPaintServer> refServer = getPaintServerById(document(), ref.mid(1));
+    RefPtr<SVGPaintServer> refServer = getPaintServerById(document(), ref.mid(1));
 
     if (!refServer || refServer->type() != PS_PATTERN)
         return;
     
-    RefPtr<KRenderingPaintServerPattern> refPattern = WTF::static_pointer_cast<KRenderingPaintServerPattern>(refServer);
+    RefPtr<SVGPaintServerPattern> refPattern = WTF::static_pointer_cast<SVGPaintServerPattern>(refServer);
     
     if (!hasAttribute(SVGNames::patternUnitsAttr)) {
         const AtomicString& value = target->getAttribute(SVGNames::patternUnitsAttr);
@@ -326,7 +326,7 @@ RenderObject* SVGPatternElement::createRenderer(RenderArena* arena, RenderStyle*
 SVGResource* SVGPatternElement::canvasResource()
 {
     if (!m_paintServer) {
-        m_paintServer = WTF::static_pointer_cast<KRenderingPaintServerPattern>(renderingDevice()->createPaintServer(KCPaintServerType(PS_PATTERN)));
+        m_paintServer = WTF::static_pointer_cast<SVGPaintServerPattern>(renderingDevice()->createPaintServer(SVGPaintServerType(PS_PATTERN)));
         m_paintServer->setListener(const_cast<SVGPatternElement*>(this));
     }
     return m_paintServer.get();
index d699920e30dd8a5116e91312dbb0895c5cc81ea5..50fbef5663b31de725a026ea0bd840bc7d23af4a 100644 (file)
@@ -24,7 +24,7 @@
 #define KSVG_SVGPatternElementImpl_H
 #ifdef SVG_SUPPORT
 
-#include "KRenderingPaintServerPattern.h"
+#include "SVGPaintServerPattern.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGFitToViewBox.h"
 #include "SVGLangSpace.h"
@@ -84,7 +84,7 @@ namespace WebCore
 
         mutable RefPtr<SVGResourceImage> m_tile;
         mutable bool m_ignoreAttributeChanges;
-        mutable RefPtr<KRenderingPaintServerPattern> m_paintServer;
+        mutable RefPtr<SVGPaintServerPattern> m_paintServer;
         
         virtual const SVGElement* contextElement() const { return this; }
 
index 6b2ec6f9cc48d1dac71766c353d53fd001bc2d38..08b5323736ac77baf875b11ed8d70f887a85c71a 100644 (file)
@@ -24,7 +24,7 @@
 #ifdef SVG_SUPPORT
 #include "SVGRadialGradientElement.h"
 
-#include "KRenderingPaintServerGradient.h"
+#include "SVGPaintServerRadialGradient.h"
 #include "SVGHelper.h"
 #include "SVGLength.h"
 #include "SVGMatrix.h"
@@ -77,7 +77,7 @@ void SVGRadialGradientElement::parseMappedAttribute(MappedAttribute* attr)
         SVGGradientElement::parseMappedAttribute(attr);
 }
 
-void SVGRadialGradientElement::buildGradient(PassRefPtr<KRenderingPaintServerGradient> _grad) const
+void SVGRadialGradientElement::buildGradient(PassRefPtr<SVGPaintServerGradient> _grad) const
 {
     rebuildStops(); // rebuild stops before possibly importing them from any referenced gradient.
 
@@ -94,23 +94,23 @@ void SVGRadialGradientElement::buildGradient(PassRefPtr<KRenderingPaintServerGra
     float _fx = fxSet ? fx()->value() : _cx;
     float _fy = fySet ? fy()->value() : _cy;
 
-    RefPtr<KRenderingPaintServerRadialGradient> grad = WTF::static_pointer_cast<KRenderingPaintServerRadialGradient>(_grad);
+    RefPtr<SVGPaintServerRadialGradient> grad = WTF::static_pointer_cast<SVGPaintServerRadialGradient>(_grad);
     AffineTransform mat;
     if (gradientTransform()->numberOfItems() > 0)
         mat = gradientTransform()->consolidate()->matrix()->matrix();
 
     DeprecatedString ref = href().deprecatedString();
-    RefPtr<KRenderingPaintServer> pserver = getPaintServerById(document(), ref.mid(1));
+    RefPtr<SVGPaintServer> pserver = getPaintServerById(document(), ref.mid(1));
 
     if (pserver && (pserver->type() == PS_RADIAL_GRADIENT || pserver->type() == PS_LINEAR_GRADIENT)) {
         bool isRadial = pserver->type() == PS_RADIAL_GRADIENT;
-        RefPtr<KRenderingPaintServerGradient> gradient = WTF::static_pointer_cast<KRenderingPaintServerGradient>(pserver);
+        RefPtr<SVGPaintServerGradient> gradient = WTF::static_pointer_cast<SVGPaintServerGradient>(pserver);
 
         if (!hasAttribute(SVGNames::gradientUnitsAttr))
             bbox = gradient->boundingBoxMode();
 
         if (isRadial) {
-            RefPtr<KRenderingPaintServerRadialGradient> radial = WTF::static_pointer_cast<KRenderingPaintServerRadialGradient>(pserver);
+            RefPtr<SVGPaintServerRadialGradient> radial = WTF::static_pointer_cast<SVGPaintServerRadialGradient>(pserver);
             if (!hasAttribute(SVGNames::cxAttr))
                 _cx = radial->gradientCenter().x();
             else if (bbox)
index fda2d05097049e5c5cecf8df97da402e7680a209..4ebb42b41954aacadeae29a1f074a50571a3bfe0 100644 (file)
@@ -39,8 +39,8 @@ namespace WebCore
         virtual void parseMappedAttribute(MappedAttribute*);
 
     protected:
-        virtual void buildGradient(PassRefPtr<KRenderingPaintServerGradient>) const;
-        virtual KCPaintServerType gradientType() const { return PS_RADIAL_GRADIENT; }
+        virtual void buildGradient(PassRefPtr<SVGPaintServerGradient>) const;
+        virtual SVGPaintServerType gradientType() const { return PS_RADIAL_GRADIENT; }
 
     protected:
         virtual const SVGElement* contextElement() const { return this; }
diff --git a/WebCore/platform/graphics/svg/SVGPaintServer.cpp b/WebCore/platform/graphics/svg/SVGPaintServer.cpp
new file mode 100644 (file)
index 0000000..0d35e43
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServer.h"
+
+namespace WebCore {
+
+SVGPaintServer::SVGPaintServer()
+    : m_activeClient(0)
+    , m_paintingText(false)
+{
+}
+
+SVGPaintServer::~SVGPaintServer()
+{
+}
+
+const RenderPath* SVGPaintServer::activeClient() const
+{
+    return m_activeClient;
+}
+
+void SVGPaintServer::setActiveClient(const RenderPath* client)
+{
+    m_activeClient = client;
+}
+
+bool SVGPaintServer::isPaintingText() const
+{
+    return m_paintingText;
+}
+
+void SVGPaintServer::setPaintingText(bool paintingText)
+{
+    m_paintingText = paintingText;
+}
+
+TextStream& operator<<(TextStream& ts, const SVGPaintServer& paintServer)
+{
+    return paintServer.externalRepresentation(ts);
+}
+
+SVGPaintServer* getPaintServerById(Document* document, const AtomicString& id)
+{
+    SVGResource* resource = getResourceById(document, id);
+    if (resource && resource->isPaintServer())
+        return static_cast<SVGPaintServer*>(resource);
+
+    return 0;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/platform/graphics/svg/SVGPaintServer.h b/WebCore/platform/graphics/svg/SVGPaintServer.h
new file mode 100644 (file)
index 0000000..487b3fe
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef SVGPaintServer_H
+#define SVGPaintServer_H
+
+#ifdef SVG_SUPPORT
+
+#include "SVGResource.h"
+
+#if PLATFORM(MAC)
+#include <ApplicationServices/ApplicationServices.h>
+#endif
+
+#if PLATFORM(QT)
+class QPen;
+#endif
+    
+namespace WebCore {
+    
+    enum SVGPaintServerType {
+        // Painting mode
+        PS_SOLID = 0,
+        PS_PATTERN = 1,
+        PS_LINEAR_GRADIENT = 2,
+        PS_RADIAL_GRADIENT = 3
+    };
+
+    enum SVGPaintTargetType {
+        // Target mode
+        APPLY_TO_FILL = 1,
+        APPLY_TO_STROKE = 2
+    };
+
+    class RenderObject;
+    class RenderPath;
+    class RenderStyle;
+    class KRenderingDeviceContext; // FIXME: This is gone soon!
+
+    class SVGPaintServer : public SVGResource {
+    public:
+        SVGPaintServer();
+        virtual ~SVGPaintServer();
+
+        virtual bool isPaintServer() const { return true; }
+
+        const RenderPath* activeClient() const;
+        void setActiveClient(const RenderPath*);
+
+        bool isPaintingText() const;
+        void setPaintingText(bool);
+
+        virtual SVGPaintServerType type() const = 0;
+        virtual TextStream& externalRepresentation(TextStream&) const = 0;
+
+        // To be implemented in platform specific code.
+        virtual void draw(KRenderingDeviceContext*, const RenderPath*, SVGPaintTargetType) const;
+        virtual void teardown(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const;
+        virtual void renderPath(KRenderingDeviceContext*, const RenderPath*, SVGPaintTargetType) const;
+
+        virtual bool setup(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const = 0;
+
+    protected:
+#if PLATFORM(MAC)
+        void strokePath(CGContextRef, const RenderPath*) const;
+        void clipToStrokePath(CGContextRef, const RenderPath*) const;
+        void fillPath(CGContextRef, const RenderPath*) const;
+        void clipToFillPath(CGContextRef, const RenderPath*) const;
+#endif
+
+#if PLATFORM(QT)
+        void setPenProperties(const RenderObject*, const RenderStyle*, QPen&) const;
+#endif
+
+    private:
+        const RenderPath* m_activeClient;
+        bool m_paintingText;
+    };
+
+    TextStream& operator<<(TextStream&, const SVGPaintServer&);
+
+    SVGPaintServer* getPaintServerById(Document*, const AtomicString&);
+
+} // namespace WebCore
+
+#endif
+
+#endif // SVGPaintServer_H
diff --git a/WebCore/platform/graphics/svg/SVGPaintServerGradient.cpp b/WebCore/platform/graphics/svg/SVGPaintServerGradient.cpp
new file mode 100644 (file)
index 0000000..85b5dd6
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerGradient.h"
+#include "SVGRenderTreeAsText.h"
+
+namespace WebCore {
+
+// Helpers
+static inline bool compareStopOffset(const SVGGradientStop& first, const SVGGradientStop& second)
+{
+    return first.first < second.first;
+}
+
+TextStream& operator<<(TextStream& ts, SVGGradientSpreadMethod m)
+{
+    switch (m) {
+        case SPREADMETHOD_PAD:
+            ts << "PAD"; break;
+        case SPREADMETHOD_REPEAT:
+            ts << "REPEAT"; break;
+        case SPREADMETHOD_REFLECT:
+            ts << "REFLECT"; break;
+    }
+
+    return ts;
+}
+
+TextStream& operator<<(TextStream& ts, const Vector<SVGGradientStop>& l)
+{
+    ts << "[";
+    for (Vector<SVGGradientStop>::const_iterator it = l.begin(); it != l.end(); ++it) {
+        ts << "(" << it->first << "," << it->second << ")";
+        if (it + 1 != l.end())
+            ts << ", ";
+    }
+    ts << "]";
+    return ts;
+}
+
+SVGPaintServerGradient::SVGPaintServerGradient()
+    : m_spreadMethod(SPREADMETHOD_PAD)
+    , m_boundingBoxMode(true)
+    , m_listener(0)
+
+#if PLATFORM(MAC)
+    , m_stopsCache(0)
+    , m_stopsCount(0)
+    , m_shadingCache(0)
+#endif
+{
+}
+
+SVGPaintServerGradient::~SVGPaintServerGradient()
+{
+#if PLATFORM(MAC)
+    delete m_stopsCache;
+    CGShadingRelease(m_shadingCache);
+#endif
+}
+
+const Vector<SVGGradientStop>& SVGPaintServerGradient::gradientStops() const
+{
+    return m_stops;
+}
+
+void SVGPaintServerGradient::setGradientStops(const Vector<SVGGradientStop>& stops)
+{
+    m_stops = stops;
+    std::sort(m_stops.begin(), m_stops.end(), compareStopOffset);
+}
+
+void SVGPaintServerGradient::setGradientStops(SVGPaintServerGradient* server)
+{
+    m_stops = server->gradientStops();
+}
+
+SVGGradientSpreadMethod SVGPaintServerGradient::spreadMethod() const
+{
+    return m_spreadMethod;
+}
+
+void SVGPaintServerGradient::setGradientSpreadMethod(const SVGGradientSpreadMethod& method)
+{
+    m_spreadMethod = method;
+}
+
+bool SVGPaintServerGradient::boundingBoxMode() const
+{
+    return m_boundingBoxMode;
+}
+
+void SVGPaintServerGradient::setBoundingBoxMode(bool mode)
+{
+    m_boundingBoxMode = mode;
+}
+
+AffineTransform SVGPaintServerGradient::gradientTransform() const
+{
+    return m_gradientTransform;
+}
+
+void SVGPaintServerGradient::setGradientTransform(const AffineTransform& transform)
+{
+    m_gradientTransform = transform;
+}
+
+SVGResourceListener* SVGPaintServerGradient::listener() const
+{
+    return m_listener;
+}
+
+void SVGPaintServerGradient::setListener(SVGResourceListener* listener)
+{
+    m_listener = listener;
+}
+
+TextStream& SVGPaintServerGradient::externalRepresentation(TextStream& ts) const
+{
+    // abstract, don't stream type
+    ts  << "[stops=" << gradientStops() << "]";
+    if (spreadMethod() != SPREADMETHOD_PAD)
+        ts << "[method=" << spreadMethod() << "]";
+    if (!boundingBoxMode())
+        ts << " [bounding box mode=" << boundingBoxMode() << "]";
+    if (!gradientTransform().isIdentity())
+        ts << " [transform=" << gradientTransform() << "]";
+
+    return ts;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/platform/graphics/svg/SVGPaintServerGradient.h b/WebCore/platform/graphics/svg/SVGPaintServerGradient.h
new file mode 100644 (file)
index 0000000..0f8a6f0
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef SVGPaintServerGradient_H
+#define SVGPaintServerGradient_H
+
+#ifdef SVG_SUPPORT
+
+#include "AffineTransform.h"
+#include "Color.h"
+#include "SVGPaintServer.h"
+
+#if PLATFORM(MAC)
+#include "SVGResourceImage.h"
+#endif
+
+#if PLATFORM(QT)
+class QGradient;
+#endif
+
+namespace WebCore {
+
+    enum SVGGradientSpreadMethod {
+        SPREADMETHOD_PAD = 1,
+        SPREADMETHOD_REPEAT = 2,
+        SPREADMETHOD_REFLECT = 4
+    };
+
+    typedef std::pair<float, Color> SVGGradientStop;
+
+    class SVGPaintServerGradient : public SVGPaintServer {
+    public:
+        SVGPaintServerGradient();
+        virtual ~SVGPaintServerGradient();
+
+        const Vector<SVGGradientStop>& gradientStops() const;
+        void setGradientStops(const Vector<SVGGradientStop>&);
+        void setGradientStops(SVGPaintServerGradient*);
+
+        SVGGradientSpreadMethod spreadMethod() const;
+        void setGradientSpreadMethod(const SVGGradientSpreadMethod&);
+
+        // Gradient start and end points are percentages when used in boundingBox mode.
+        // For instance start point with value (0,0) is top-left and end point with
+        // value (100, 100) is bottom-right. BoundingBox mode is enabled by default.
+        bool boundingBoxMode() const;
+        void setBoundingBoxMode(bool mode = true);
+
+        AffineTransform gradientTransform() const;
+        void setGradientTransform(const AffineTransform&);
+
+        SVGResourceListener* listener() const;
+        void setListener(SVGResourceListener*);
+
+        virtual TextStream& externalRepresentation(TextStream&) const;
+
+#if PLATFORM(MAC)
+        virtual void teardown(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const;
+        virtual void renderPath(KRenderingDeviceContext*, const RenderPath*, SVGPaintTargetType) const;
+
+        virtual bool setup(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const;
+
+        virtual void invalidate();
+
+        // Helpers
+        void invalidateCaches();
+        void updateQuartzGradientStopsCache(const Vector<SVGGradientStop>&);
+        void updateQuartzGradientCache(const SVGPaintServerGradient*);
+#endif
+
+#if PLATFORM(QT)
+    protected:
+        void fillColorArray(QGradient&, const Vector<SVGGradientStop>&, float opacity) const;
+#endif
+
+    private:
+        Vector<SVGGradientStop> m_stops;
+        SVGGradientSpreadMethod m_spreadMethod;
+        bool m_boundingBoxMode;
+        AffineTransform m_gradientTransform;
+        SVGResourceListener* m_listener;
+
+#if PLATFORM(MAC)
+    public:
+        typedef struct {
+            CGFloat colorArray[4];
+            CGFloat offset;
+            CGFloat previousDeltaInverse;
+        } QuartzGradientStop;
+
+        QuartzGradientStop* m_stopsCache;
+        int m_stopsCount;
+
+        CGShadingRef m_shadingCache;
+        mutable RefPtr<SVGResourceImage> m_maskImage;
+#endif
+    };
+
+    inline SVGGradientStop makeGradientStop(float offset, const Color& color)
+    {
+        return std::make_pair(offset, color);
+    }
+
+} // namespace WebCore
+
+#endif
+
+#endif // SVGPaintServerGradient_H
diff --git a/WebCore/platform/graphics/svg/SVGPaintServerLinearGradient.cpp b/WebCore/platform/graphics/svg/SVGPaintServerLinearGradient.cpp
new file mode 100644 (file)
index 0000000..7f5b978
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerLinearGradient.h"
+#include "SVGRenderTreeAsText.h"
+
+namespace WebCore {
+
+SVGPaintServerLinearGradient::SVGPaintServerLinearGradient()
+{
+}
+
+SVGPaintServerLinearGradient::~SVGPaintServerLinearGradient()
+{
+}
+
+FloatPoint SVGPaintServerLinearGradient::gradientStart() const
+{
+    return m_start;
+}
+
+void SVGPaintServerLinearGradient::setGradientStart(const FloatPoint& start)
+{
+    m_start = start;
+}
+
+FloatPoint SVGPaintServerLinearGradient::gradientEnd() const
+{
+    return m_end;
+}
+
+void SVGPaintServerLinearGradient::setGradientEnd(const FloatPoint& end)
+{
+    m_end = end;
+}
+
+TextStream& SVGPaintServerLinearGradient::externalRepresentation(TextStream& ts) const
+{
+    ts << "[type=LINEAR-GRADIENT] ";
+    SVGPaintServerGradient::externalRepresentation(ts);
+    ts  << " [start=" << gradientStart() << "]"
+        << " [end=" << gradientEnd() << "]";
+    return ts;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/platform/graphics/svg/SVGPaintServerLinearGradient.h b/WebCore/platform/graphics/svg/SVGPaintServerLinearGradient.h
new file mode 100644 (file)
index 0000000..a32e504
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef SVGPaintServerLinearGradient_H
+#define SVGPaintServerLinearGradient_H
+
+#ifdef SVG_SUPPORT
+
+#include "FloatPoint.h"
+#include "SVGPaintServerGradient.h"
+
+namespace WebCore {
+
+    class SVGPaintServerLinearGradient : public SVGPaintServerGradient {
+    public:
+        SVGPaintServerLinearGradient();
+        virtual ~SVGPaintServerLinearGradient();
+
+        virtual SVGPaintServerType type() const { return PS_LINEAR_GRADIENT; }
+
+        FloatPoint gradientStart() const;
+        void setGradientStart(const FloatPoint&);
+
+        FloatPoint gradientEnd() const;
+        void setGradientEnd(const FloatPoint&);
+
+        virtual TextStream& externalRepresentation(TextStream&) const;
+
+#if PLATFORM(QT)
+        virtual bool setup(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const;
+#endif
+
+    private:
+        FloatPoint m_start;
+        FloatPoint m_end;
+    };
+
+} // namespace WebCore
+
+#endif
+
+#endif // SVGPaintServerLinearGradient_H
diff --git a/WebCore/platform/graphics/svg/SVGPaintServerPattern.cpp b/WebCore/platform/graphics/svg/SVGPaintServerPattern.cpp
new file mode 100644 (file)
index 0000000..b1a00a3
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerPattern.h"
+#include "SVGRenderTreeAsText.h"
+#include "SVGResourceImage.h"
+
+namespace WebCore {
+
+SVGPaintServerPattern::SVGPaintServerPattern()
+    : m_boundingBoxMode(true)
+    , m_listener(0)
+{
+}
+
+SVGPaintServerPattern::~SVGPaintServerPattern()
+{
+}
+
+FloatRect SVGPaintServerPattern::bbox() const
+{
+    return m_bbox;
+}
+
+void SVGPaintServerPattern::setBbox(const FloatRect& rect)
+{
+    m_bbox = rect;
+}
+
+bool SVGPaintServerPattern::boundingBoxMode() const
+{
+    return m_boundingBoxMode;
+}
+
+void SVGPaintServerPattern::setBoundingBoxMode(bool mode)
+{
+    m_boundingBoxMode = mode;
+}
+
+SVGResourceImage* SVGPaintServerPattern::tile() const
+{
+    return m_tile.get();
+}
+
+void SVGPaintServerPattern::setTile(const PassRefPtr<SVGResourceImage>& tile)
+{
+    m_tile = tile;
+}
+
+AffineTransform SVGPaintServerPattern::patternTransform() const
+{
+    return m_patternTransform;
+}
+
+void SVGPaintServerPattern::setPatternTransform(const AffineTransform& transform)
+{
+    m_patternTransform = transform;
+}
+
+SVGResourceListener* SVGPaintServerPattern::listener() const
+{
+    return m_listener;
+}
+
+void SVGPaintServerPattern::setListener(SVGResourceListener* listener)
+{
+    m_listener = listener;
+}
+
+TextStream& SVGPaintServerPattern::externalRepresentation(TextStream& ts) const
+{
+    ts << "[type=PATTERN]"
+        << " [bbox=" << bbox() << "]";
+    if (!boundingBoxMode())
+        ts << " [bounding box mode=" << boundingBoxMode() << "]";
+    if (!patternTransform().isIdentity())
+        ts << " [pattern transform=" << patternTransform() << "]";
+    return ts;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/platform/graphics/svg/SVGPaintServerPattern.h b/WebCore/platform/graphics/svg/SVGPaintServerPattern.h
new file mode 100644 (file)
index 0000000..0432eb2
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef SVGPaintServerPattern_H
+#define SVGPaintServerPattern_H
+
+#ifdef SVG_SUPPORT
+
+#include "AffineTransform.h"
+#include "FloatRect.h"
+#include "SVGPaintServer.h"
+
+namespace WebCore {
+
+    class SVGResourceImage;
+
+    class SVGPaintServerPattern : public SVGPaintServer {
+    public:
+        SVGPaintServerPattern();
+        virtual ~SVGPaintServerPattern();
+
+        virtual SVGPaintServerType type() const { return PS_PATTERN; }
+
+        // Pattern bounding box
+        void setBbox(const FloatRect&);
+        FloatRect bbox() const;
+
+        // Pattern x, y phase points are relative when in boundingBoxMode
+        // BoundingBox mode is enabled by default.
+        bool boundingBoxMode() const;
+        void setBoundingBoxMode(bool mode = true);
+
+        SVGResourceImage* tile() const;
+        void setTile(const PassRefPtr<SVGResourceImage>&);
+
+        AffineTransform patternTransform() const;
+        void setPatternTransform(const AffineTransform&);
+
+        SVGResourceListener* listener() const;
+        void setListener(SVGResourceListener*);
+
+        virtual TextStream& externalRepresentation(TextStream&) const;
+
+#if PLATFORM(MAC)
+        virtual bool setup(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const;
+        virtual void teardown(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const; 
+#endif
+
+#if PLATFORM(QT)
+        virtual bool setup(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const;
+#endif
+
+    private:
+        RefPtr<SVGResourceImage> m_tile;
+        AffineTransform m_patternTransform;
+        FloatRect m_bbox;
+        bool m_boundingBoxMode;
+        SVGResourceListener* m_listener;
+
+#if PLATFORM(MAC)
+        mutable CGColorSpaceRef m_patternSpace;
+        mutable CGPatternRef m_pattern;
+#endif                
+    };
+
+} // namespace WebCore
+
+#endif
+
+#endif // SVGPaintServerPattern_H
diff --git a/WebCore/platform/graphics/svg/SVGPaintServerRadialGradient.cpp b/WebCore/platform/graphics/svg/SVGPaintServerRadialGradient.cpp
new file mode 100644 (file)
index 0000000..b7d3c21
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerRadialGradient.h"
+#include "SVGRenderTreeAsText.h"
+
+namespace WebCore {
+
+SVGPaintServerRadialGradient::SVGPaintServerRadialGradient()
+    : m_radius(0.0)
+{
+}
+
+SVGPaintServerRadialGradient::~SVGPaintServerRadialGradient()
+{
+}
+
+
+FloatPoint SVGPaintServerRadialGradient::gradientCenter() const
+{
+    return m_center;
+}
+
+void SVGPaintServerRadialGradient::setGradientCenter(const FloatPoint& center)
+{
+    m_center = center;
+}
+
+FloatPoint SVGPaintServerRadialGradient::gradientFocal() const
+{
+    return m_focal;
+}
+
+void SVGPaintServerRadialGradient::setGradientFocal(const FloatPoint& focal)
+{
+    m_focal = focal;
+}
+
+float SVGPaintServerRadialGradient::gradientRadius() const
+{
+    return m_radius;
+}
+
+void SVGPaintServerRadialGradient::setGradientRadius(float radius)
+{
+    m_radius = radius;
+}
+
+TextStream& SVGPaintServerRadialGradient::externalRepresentation(TextStream& ts) const
+{
+    ts << "[type=RADIAL-GRADIENT] ";
+    SVGPaintServerGradient::externalRepresentation(ts);
+    ts << " [center=" << gradientCenter() << "]"
+        << " [focal=" << gradientFocal() << "]"
+        << " [radius=" << gradientRadius() << "]";
+    return ts;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/platform/graphics/svg/SVGPaintServerRadialGradient.h b/WebCore/platform/graphics/svg/SVGPaintServerRadialGradient.h
new file mode 100644 (file)
index 0000000..6d049d1
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef SVGPaintServerRadialGradient_H
+#define SVGPaintServerRadialGradient_H
+
+#ifdef SVG_SUPPORT
+
+#include "FloatPoint.h"
+#include "SVGPaintServerGradient.h"
+
+namespace WebCore {
+
+    class SVGPaintServerRadialGradient : public SVGPaintServerGradient {
+    public:
+        SVGPaintServerRadialGradient();
+        virtual ~SVGPaintServerRadialGradient();
+
+        virtual SVGPaintServerType type() const { return PS_RADIAL_GRADIENT; }
+
+        FloatPoint gradientCenter() const;
+        void setGradientCenter(const FloatPoint&);
+
+        FloatPoint gradientFocal() const;
+        void setGradientFocal(const FloatPoint&);
+
+        float gradientRadius() const;
+        void setGradientRadius(float);
+
+        virtual TextStream& externalRepresentation(TextStream&) const;
+
+#if PLATFORM(QT)
+        virtual bool setup(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const;
+#endif
+
+    private:
+        float m_radius;
+        FloatPoint m_center;
+        FloatPoint m_focal;
+    };
+
+} // namespace WebCore
+
+#endif
+
+#endif // SVGPaintServerRadialGradient_H
diff --git a/WebCore/platform/graphics/svg/SVGPaintServerSolid.cpp b/WebCore/platform/graphics/svg/SVGPaintServerSolid.cpp
new file mode 100644 (file)
index 0000000..b585fda
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerSolid.h"
+#include "SVGRenderTreeAsText.h"
+
+namespace WebCore {
+
+SVGPaintServerSolid::SVGPaintServerSolid()
+{
+}
+
+SVGPaintServerSolid::~SVGPaintServerSolid()
+{
+}
+
+Color SVGPaintServerSolid::color() const
+{
+    return m_color;
+}
+
+void SVGPaintServerSolid::setColor(const Color& color)
+{
+    m_color = color;
+}
+
+TextStream& SVGPaintServerSolid::externalRepresentation(TextStream& ts) const
+{
+    ts << "[type=SOLID]"
+        << " [color="<< color() << "]";
+    return ts;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/platform/graphics/svg/SVGPaintServerSolid.h b/WebCore/platform/graphics/svg/SVGPaintServerSolid.h
new file mode 100644 (file)
index 0000000..066a517
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef SVGPaintServerSolid_H
+#define SVGPaintServerSolid_H
+
+#ifdef SVG_SUPPORT
+
+#include "Color.h"
+#include "SVGPaintServer.h"
+
+namespace WebCore {
+
+    class SVGPaintServerSolid : public SVGPaintServer {
+    public:
+        SVGPaintServerSolid();
+        virtual ~SVGPaintServerSolid();
+
+        virtual SVGPaintServerType type() const { return PS_SOLID; }
+
+        Color color() const;
+        void setColor(const Color&);
+
+        virtual TextStream& externalRepresentation(TextStream&) const;
+
+#if PLATFORM(MAC) || PLATFORM(QT)
+        virtual bool setup(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const;
+#endif
+
+    private:
+        Color m_color;
+    };
+
+} // namespace WebCore
+
+#endif
+
+#endif // SVGPaintServerSolid_H
index 8513e76e5b80fe641339475deb7c87ed2ec66655..14f23e310c69aaae750bf8b59a66aee97bcf4624 100644 (file)
  */
 
 #include "config.h"
-#include "SVGResource.h"
 
 #ifdef SVG_SUPPORT
+#include "SVGResource.h"
 
-#include "KRenderingPaintServer.h"
 #include "RenderPath.h"
 #include "SVGElement.h"
 #include "SVGStyledElement.h"
@@ -96,16 +95,6 @@ SVGResource* getResourceById(Document* document, const AtomicString& id)
     return 0;
 }
 
-KRenderingPaintServer* getPaintServerById(Document* document, const AtomicString& id)
-{
-    SVGResource* resource = getResourceById(document, id);
-    if (resource && resource->isPaintServer())
-        return static_cast<KRenderingPaintServer*>(resource);
-
-    return 0;
-}
-
-
 TextStream& operator<<(TextStream& ts, const SVGResource& r)
 {
     return r.externalRepresentation(ts);
index 13b32e5426d4dc3b7228d0295a944050e2a08608..44becae89c4bc8a227dbc9cd10edb6687cc64ab0 100644 (file)
@@ -37,7 +37,6 @@ namespace WebCore {
     class RenderPath;
     class TextStream;
     class AtomicString;
-    class KRenderingPaintServer;
 
     typedef Vector<const RenderPath*> RenderPathList;
 
@@ -95,7 +94,6 @@ namespace WebCore {
     };
 
     SVGResource* getResourceById(Document*, const AtomicString&);
-    KRenderingPaintServer* getPaintServerById(Document*, const AtomicString&);
 
     TextStream& operator<<(TextStream&, const SVGResource&);
 
index 3a946b462420cc652a89042f75cef626bab34703..7cf5be72862267167c82dc8c94f6dfd4d82a5bcb 100644 (file)
@@ -24,9 +24,9 @@
  */
 
 #include "config.h"
-#include "SVGResourceClipper.h"
 
 #ifdef SVG_SUPPORT
+#include "SVGResourceClipper.h"
 
 #include "SVGRenderTreeAsText.h"
 #include "TextStream.h"
index 2eea7a30f7f611306644314b139f5dfd53f2b70f..4d7587d65efdbe60cb090bedc23f995c0b0de564 100644 (file)
@@ -24,9 +24,9 @@
  */
 
 #include "config.h"
-#include "SVGResourceMarker.h"
 
 #ifdef SVG_SUPPORT
+#include "SVGResourceMarker.h"
 
 #include "AffineTransform.h"
 #include "GraphicsContext.h"
index 12d85f4f8f610fee91d5d2b04bb07784b7f38679..bff44aed7e747591f860337411ea8dca54b9f7a7 100644 (file)
@@ -24,9 +24,9 @@
  */
 
 #include "config.h"
-#include "SVGResourceMasker.h"
 
 #ifdef SVG_SUPPORT
+#include "SVGResourceMasker.h"
 
 #include "TextStream.h"
 #include "SVGResourceImage.h"
diff --git a/WebCore/platform/graphics/svg/cg/SVGPaintServerCg.cpp b/WebCore/platform/graphics/svg/cg/SVGPaintServerCg.cpp
new file mode 100644 (file)
index 0000000..4c026fd
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+    Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
+
+    This file is part of the KDE project
+
+    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
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+*/
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServer.h"
+
+#include "KRenderingDeviceQuartz.h"
+#include "RenderPath.h"
+
+namespace WebCore {
+
+void SVGPaintServer::draw(KRenderingDeviceContext* context, const RenderPath* path, SVGPaintTargetType type) const
+{
+    if (!setup(context, path, type))
+        return;
+
+    renderPath(context, path, type);
+    teardown(context, path, type);
+}
+
+void SVGPaintServer::teardown(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const
+{
+    // no-op
+}
+
+void SVGPaintServer::renderPath(KRenderingDeviceContext* context, const RenderPath* path, SVGPaintTargetType type) const
+{
+    RenderStyle* style = path->style();
+
+    KRenderingDeviceContextQuartz* quartzContext = static_cast<KRenderingDeviceContextQuartz*>(context);
+    CGContextRef contextRef = quartzContext->cgContext();
+
+    if ((type & APPLY_TO_FILL) && style->svgStyle()->hasFill())
+        fillPath(contextRef, path);
+
+    if ((type & APPLY_TO_STROKE) && style->svgStyle()->hasStroke())
+        strokePath(contextRef, path);
+}
+
+void SVGPaintServer::strokePath(CGContextRef context, const RenderPath*) const
+{
+    CGContextStrokePath(context);
+}
+
+void SVGPaintServer::clipToStrokePath(CGContextRef context, const RenderPath*) const
+{
+    CGContextReplacePathWithStrokedPath(context);
+    CGContextClip(context);
+}
+
+void SVGPaintServer::fillPath(CGContextRef context, const RenderPath* path) const
+{
+    if (path->style()->svgStyle()->fillRule() == RULE_EVENODD)
+        CGContextEOFillPath(context);
+    else
+        CGContextFillPath(context);
+}
+
+void SVGPaintServer::clipToFillPath(CGContextRef context, const RenderPath* path) const
+{
+    if (path->style()->svgStyle()->fillRule() == RULE_EVENODD)
+        CGContextEOClip(context);
+    else
+        CGContextClip(context);
+}
+
+} // namespace WebCore
+
+#endif
+
+// vim:ts=4:noet
diff --git a/WebCore/platform/graphics/svg/cg/SVGPaintServerGradientCg.cpp b/WebCore/platform/graphics/svg/cg/SVGPaintServerGradientCg.cpp
new file mode 100644 (file)
index 0000000..1571b61
--- /dev/null
@@ -0,0 +1,289 @@
+/*
+    Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
+
+    This file is part of the KDE project
+
+    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
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+*/
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerGradient.h"
+
+#include "KRenderingDeviceQuartz.h"
+#include "SVGPaintServerLinearGradient.h"
+#include "SVGPaintServerRadialGradient.h"
+#include "RenderPath.h"
+#include "QuartzSupport.h"
+
+namespace WebCore {
+
+static void cgGradientCallback(void* info, const CGFloat* inValues, CGFloat* outColor)
+{
+    const SVGPaintServerGradient* server = (const SVGPaintServerGradient*)info;
+    SVGPaintServerGradient::QuartzGradientStop* stops = server->m_stopsCache;
+    int stopsCount = server->m_stopsCount;
+
+    CGFloat inValue = inValues[0];
+
+    if (!stopsCount) {
+        outColor[0] = 0;
+        outColor[1] = 0;
+        outColor[2] = 0;
+        outColor[3] = 1;
+        return;
+    } else if (stopsCount == 1) {
+        memcpy(outColor, stops[0].colorArray, 4 * sizeof(CGFloat));
+        return;
+    }
+
+    if (!(inValue > stops[0].offset))
+        memcpy(outColor, stops[0].colorArray, 4 * sizeof(CGFloat));
+    else if (!(inValue < stops[stopsCount-1].offset))
+        memcpy(outColor, stops[stopsCount-1].colorArray, 4 * sizeof(CGFloat));
+    else {
+        int nextStopIndex = 0;
+        while ((nextStopIndex < stopsCount) && (stops[nextStopIndex].offset < inValue))
+            nextStopIndex++;
+
+        //float nextOffset = stops[nextStopIndex].offset;
+        CGFloat *nextColorArray = stops[nextStopIndex].colorArray;
+        CGFloat *previousColorArray = stops[nextStopIndex-1].colorArray;
+        //float totalDelta = nextOffset - previousOffset;
+        CGFloat diffFromPrevious = inValue - stops[nextStopIndex-1].offset;
+        //float percent = diffFromPrevious / totalDelta;
+        CGFloat percent = diffFromPrevious * stops[nextStopIndex].previousDeltaInverse;
+
+        outColor[0] = ((1.0 - percent) * previousColorArray[0] + percent * nextColorArray[0]);
+        outColor[1] = ((1.0 - percent) * previousColorArray[1] + percent * nextColorArray[1]);
+        outColor[2] = ((1.0 - percent) * previousColorArray[2] + percent * nextColorArray[2]);
+        outColor[3] = ((1.0 - percent) * previousColorArray[3] + percent * nextColorArray[3]);
+    }
+    // FIXME: have to handle the spreadMethod()s here SPREADMETHOD_REPEAT, etc.
+}
+
+static CGShadingRef CGShadingRefForLinearGradient(const SVGPaintServerLinearGradient* server)
+{
+    CGPoint start = CGPoint(server->gradientStart());
+    CGPoint end = CGPoint(server->gradientEnd());
+
+    CGFunctionCallbacks callbacks = {0, cgGradientCallback, NULL};
+    CGFloat domainLimits[2] = {0, 1};
+    CGFloat rangeLimits[8] = {0, 1, 0, 1, 0, 1, 0, 1};
+    CGFunctionRef shadingFunction = CGFunctionCreate((void *)server, 1, domainLimits, 4, rangeLimits, &callbacks);
+
+    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+    CGShadingRef shading = CGShadingCreateAxial(colorSpace, start, end, shadingFunction, true, true);
+    CGColorSpaceRelease(colorSpace);
+    CGFunctionRelease(shadingFunction);
+    return shading;
+}
+
+static CGShadingRef CGShadingRefForRadialGradient(const SVGPaintServerRadialGradient* server)
+{
+    CGPoint center = CGPoint(server->gradientCenter());
+    CGPoint focus = CGPoint(server->gradientFocal());
+    double radius = server->gradientRadius();
+
+    double fdx = focus.x - center.x;
+    double fdy = focus.y - center.y;
+
+    // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and r, set (fx, fy)
+    // to the point of intersection of the line through (fx, fy) and the circle.
+    if (sqrt(fdx*fdx + fdy*fdy) > radius) {
+        double angle = atan2(focus.y, focus.x);
+        focus.x = int(cos(angle) * radius) - 1;
+        focus.y = int(sin(angle) * radius) - 1;
+    }
+
+    CGFunctionCallbacks callbacks = {0, cgGradientCallback, NULL};
+    CGFloat domainLimits[2] = {0, 1};
+    CGFloat rangeLimits[8] = {0, 1, 0, 1, 0, 1, 0, 1};
+    CGFunctionRef shadingFunction = CGFunctionCreate((void *)server, 1, domainLimits, 4, rangeLimits, &callbacks);
+
+    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+    CGShadingRef shading = CGShadingCreateRadial(colorSpace, focus, 0, center, radius, shadingFunction, true, true);
+    CGColorSpaceRelease(colorSpace);
+    CGFunctionRelease(shadingFunction);
+    return shading;
+}
+
+void SVGPaintServerGradient::invalidateCaches()
+{
+    delete m_stopsCache;
+    CGShadingRelease(m_shadingCache);
+
+    m_stopsCache = 0;
+    m_shadingCache = 0;
+}
+
+void SVGPaintServerGradient::updateQuartzGradientStopsCache(const Vector<SVGGradientStop>& stops)
+{
+    delete m_stopsCache;
+
+    m_stopsCount = stops.size();
+    m_stopsCache = new SVGPaintServerGradient::QuartzGradientStop[m_stopsCount];
+
+    CGFloat previousOffset = 0.0;
+    for (unsigned i = 0; i < stops.size(); ++i) {
+        m_stopsCache[i].offset = stops[i].first;
+        m_stopsCache[i].previousDeltaInverse = 1.0 / (stops[i].first - previousOffset);
+        previousOffset = stops[i].first;
+        CGFloat *ca = m_stopsCache[i].colorArray;
+        stops[i].second.getRGBA(ca[0], ca[1], ca[2], ca[3]);
+    }
+}
+
+void SVGPaintServerGradient::updateQuartzGradientCache(const SVGPaintServerGradient* server)
+{
+    // cache our own copy of the stops for faster access.
+    // this is legacy code, probably could be reworked.
+    if (!m_stopsCache)
+        updateQuartzGradientStopsCache(gradientStops());
+
+    if (m_shadingCache)
+        CGShadingRelease(m_shadingCache);
+
+    if (type() == PS_RADIAL_GRADIENT) {
+        const SVGPaintServerRadialGradient* radial = static_cast<const SVGPaintServerRadialGradient*>(server);
+        m_shadingCache = CGShadingRefForRadialGradient(radial);
+    } else if (type() == PS_LINEAR_GRADIENT) {
+        const SVGPaintServerLinearGradient* linear = static_cast<const SVGPaintServerLinearGradient*>(server);
+        m_shadingCache = CGShadingRefForLinearGradient(linear);
+    }
+}
+
+void SVGPaintServerGradient::teardown(KRenderingDeviceContext* context, const RenderObject* object, SVGPaintTargetType type) const
+{
+    CGShadingRef shading = m_shadingCache;
+    KRenderingDeviceQuartz* quartzDevice = static_cast<KRenderingDeviceQuartz*>(renderingDevice());
+    CGContextRef contextRef = quartzDevice->currentCGContext();
+    RenderStyle* style = object->style();
+    ASSERT(contextRef != NULL);
+
+    if ((type & APPLY_TO_FILL) && style->svgStyle()->hasFill()) {
+        // workaround for filling the entire screen with the shading in the case that no text was intersected with the clip
+        if (!isPaintingText() || (object->width() > 0 && object->height() > 0))
+            CGContextDrawShading(contextRef, shading);
+        CGContextRestoreGState(contextRef);
+    }
+
+    if ((type & APPLY_TO_STROKE) && style->svgStyle()->hasStroke()) {
+        if (isPaintingText()) {
+            int width  = 2048;
+            int height = 2048; // FIXME??? SEE ABOVE
+            delete quartzDevice->popContext();
+            contextRef = quartzDevice->currentCGContext();
+            void* imageBuffer = fastMalloc(width * height);
+            CGColorSpaceRef grayColorSpace = CGColorSpaceCreateDeviceGray();
+            CGContextRef grayscaleContext = CGBitmapContextCreate(imageBuffer, width, height, 8, width, grayColorSpace, kCGImageAlphaNone);
+            CGColorSpaceRelease(grayColorSpace);
+            CGContextDrawLayerAtPoint(grayscaleContext, CGPointMake(0, 0), m_maskImage->cgLayer());
+            CGImageRef grayscaleImage = CGBitmapContextCreateImage(grayscaleContext);
+            CGContextClipToMask(contextRef, CGRectMake(0, 0, width, height), grayscaleImage);
+            CGContextRelease(grayscaleContext);
+            CGImageRelease(grayscaleImage);
+        }
+        CGContextDrawShading(contextRef, shading);
+        CGContextRestoreGState(contextRef);
+    }
+
+    CGContextRestoreGState(contextRef);
+}
+
+void SVGPaintServerGradient::renderPath(KRenderingDeviceContext* context, const RenderPath* path, SVGPaintTargetType type) const
+{
+    KRenderingDeviceQuartz* quartzDevice = static_cast<KRenderingDeviceQuartz*>(renderingDevice());
+    CGContextRef contextRef = quartzDevice->currentCGContext();
+    RenderStyle* style = path->style();
+    ASSERT(contextRef != NULL);
+
+    CGRect objectBBox;
+    if (boundingBoxMode())
+        objectBBox = CGContextGetPathBoundingBox(contextRef);
+    if ((type & APPLY_TO_FILL) && style->svgStyle()->hasFill())
+        clipToFillPath(contextRef, path);
+    if ((type & APPLY_TO_STROKE) && style->svgStyle()->hasStroke())
+        clipToStrokePath(contextRef, path);
+    // make the gradient fit in the bbox if necessary.
+    if (boundingBoxMode()) { // no support for bounding boxes around text yet!
+        // get the object bbox
+        CGRect gradientBBox = CGRectMake(0,0,100,100); // FIXME - this is arbitrary no?
+        // generate a transform to map between the two.
+        CGAffineTransform gradientIntoObjectBBox = CGAffineTransformMakeMapBetweenRects(gradientBBox, objectBBox);
+        CGContextConcatCTM(contextRef, gradientIntoObjectBBox);
+    }
+
+    // apply the gradient's own transform
+    CGAffineTransform transform = gradientTransform();
+    CGContextConcatCTM(contextRef, transform);
+}
+
+bool SVGPaintServerGradient::setup(KRenderingDeviceContext* context, const RenderObject* object, SVGPaintTargetType type) const
+{
+    if (listener()) // this seems like bad design to me, should be in a common baseclass. -- ecs 8/6/05
+        listener()->resourceNotification();
+
+    // FIXME: total const HACK!
+    // We need a hook to call this when the gradient gets updated, before drawn.
+    if (!m_shadingCache)
+        const_cast<SVGPaintServerGradient*>(this)->updateQuartzGradientCache(this);
+
+    KRenderingDeviceQuartz* quartzDevice = static_cast<KRenderingDeviceQuartz*>(renderingDevice());
+    CGContextRef contextRef = quartzDevice->currentCGContext();
+    RenderStyle* style = object->style();
+    ASSERT(contextRef != NULL);
+
+    CGContextSaveGState(contextRef);
+    CGContextSetAlpha(contextRef, style->opacity());
+
+    if ((type & APPLY_TO_FILL) && style->svgStyle()->hasFill()) {
+        CGContextSaveGState(contextRef);
+        if (isPaintingText())
+            CGContextSetTextDrawingMode(contextRef, kCGTextClip);
+    }
+
+    if ((type & APPLY_TO_STROKE) && style->svgStyle()->hasStroke()) {
+        CGContextSaveGState(contextRef);
+        applyStrokeStyleToContext(contextRef, style, object); // FIXME: this seems like the wrong place for this.
+        if (isPaintingText()) {
+            m_maskImage = new SVGResourceImage();
+            int width  = 2048;
+            int height = 2048; // FIXME???
+            IntSize size = IntSize(width, height);
+            m_maskImage->init(size);
+            KRenderingDeviceContext* maskImageContext = quartzDevice->contextForImage(m_maskImage.get());
+            quartzDevice->pushContext(maskImageContext);
+            CGContextRef maskContext = static_cast<KRenderingDeviceContextQuartz*>(maskImageContext)->cgContext();
+            const_cast<RenderObject*>(object)->style()->setColor(Color(255, 255, 255));
+            CGContextSetTextDrawingMode(maskContext, kCGTextStroke);
+        }
+    }
+
+    return true;
+}
+
+void SVGPaintServerGradient::invalidate()
+{
+    invalidateCaches();
+}
+
+} // namespace WebCore
+
+#endif
+
+// vim:ts=4:noet
diff --git a/WebCore/platform/graphics/svg/cg/SVGPaintServerPatternCg.cpp b/WebCore/platform/graphics/svg/cg/SVGPaintServerPatternCg.cpp
new file mode 100644 (file)
index 0000000..8cb9ffc
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+    Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
+
+    This file is part of the KDE project
+
+    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
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+*/
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerPattern.h"
+
+#include "KRenderingDeviceQuartz.h"
+#include "RenderObject.h"
+#include "SVGResourceImage.h"
+#include "QuartzSupport.h"
+
+namespace WebCore {
+
+static void patternCallback(void* info, CGContextRef context)
+{
+    CGLayerRef layer = reinterpret_cast<SVGResourceImage*>(info)->cgLayer();
+    CGContextDrawLayerAtPoint(context, CGPointZero, layer);
+}
+
+bool SVGPaintServerPattern::setup(KRenderingDeviceContext* context, const RenderObject* object, SVGPaintTargetType type) const
+{
+    if(listener()) // this seems like bad design to me, should be in a common baseclass. -- ecs 8/6/05
+        listener()->resourceNotification();
+
+    RenderStyle* style = object->style();
+
+    KRenderingDeviceContextQuartz* quartzContext = static_cast<KRenderingDeviceContextQuartz*>(context);
+    CGContextRef contextRef = quartzContext->cgContext();
+
+    RefPtr<SVGResourceImage> cell = tile();
+    if (!cell)
+        return false;
+
+    CGContextSaveGState(contextRef);
+
+    CGSize cellSize = CGSize(cell->size());
+
+    CGFloat alpha = 1; // canvasStyle->opacity(); //which?
+
+    // Patterns don't seem to resepect the CTM unless we make them...
+    CGAffineTransform ctm = CGContextGetCTM(contextRef);
+    CGAffineTransform transform = patternTransform();
+    transform = CGAffineTransformConcat(transform, ctm);
+
+    CGSize phase = CGSizeMake(bbox().x(), -bbox().y()); // Pattern space seems to start in the lower-left, so we flip the Y here.
+    CGContextSetPatternPhase(contextRef, phase);
+
+    CGPatternCallbacks callbacks = {0, patternCallback, NULL};
+    m_pattern = CGPatternCreate(
+            tile(),
+            CGRectMake(0, 0, cellSize.width, cellSize.height),
+            transform,
+            bbox().width(), //cellSize.width,
+            bbox().height(), //cellSize.height,
+            kCGPatternTilingConstantSpacing,  // FIXME: should ask CG guys.
+            true, // has color
+            &callbacks);
+
+    CGContextSetAlpha(contextRef, style->opacity()); // or do I set the alpha above?
+
+    m_patternSpace = CGColorSpaceCreatePattern(NULL);
+
+    if ((type & APPLY_TO_FILL) && style->svgStyle()->hasFill()) {
+        CGContextSetFillColorSpace(contextRef, m_patternSpace);
+        CGContextSetFillPattern(contextRef, m_pattern, &alpha);
+        if (isPaintingText()) {
+            const_cast<RenderObject*>(object)->style()->setColor(Color());
+            CGContextSetTextDrawingMode(contextRef, kCGTextFill);
+        }
+    }
+
+    if ((type & APPLY_TO_STROKE) && style->svgStyle()->hasStroke()) {
+        CGContextSetStrokeColorSpace(contextRef, m_patternSpace);
+        CGContextSetStrokePattern(contextRef, m_pattern, &alpha);
+        applyStrokeStyleToContext(contextRef, style, object);
+        if (isPaintingText()) {
+            const_cast<RenderObject*>(object)->style()->setColor(Color());
+            CGContextSetTextDrawingMode(contextRef, kCGTextStroke);
+        }
+    }
+
+    return true;
+}
+
+void SVGPaintServerPattern::teardown(KRenderingDeviceContext* context, const RenderObject* object, SVGPaintTargetType type) const
+{
+    KRenderingDeviceContextQuartz* quartzContext = static_cast<KRenderingDeviceContextQuartz*>(context);
+    CGContextRef contextRef = quartzContext->cgContext();
+    CGPatternRelease(m_pattern);
+    CGColorSpaceRelease(m_patternSpace);
+    CGContextRestoreGState(contextRef);
+}
+
+} // namespace WebCore
+
+#endif
+
+// vim:ts=4:noet
diff --git a/WebCore/platform/graphics/svg/cg/SVGPaintServerSolidCg.cpp b/WebCore/platform/graphics/svg/cg/SVGPaintServerSolidCg.cpp
new file mode 100644 (file)
index 0000000..e081065
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+    Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
+
+    This file is part of the KDE project
+
+    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
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+*/
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerSolid.h"
+
+#include "RenderObject.h"
+#include "KRenderingDeviceQuartz.h"
+#include "QuartzSupport.h"
+
+namespace WebCore {
+
+bool SVGPaintServerSolid::setup(KRenderingDeviceContext* context, const RenderObject* object, SVGPaintTargetType type) const
+{
+    KRenderingDeviceContextQuartz* quartzContext = static_cast<KRenderingDeviceContextQuartz*>(context);
+    CGContextRef contextRef = quartzContext->cgContext();
+    RenderStyle* style = object->style();
+
+    CGContextSetAlpha(contextRef, style->opacity());
+
+    static CGColorSpaceRef deviceRGBColorSpace = CGColorSpaceCreateDeviceRGB(); // This should be shared from GraphicsContext, or some other central location
+
+    if ((type & APPLY_TO_FILL) && style->svgStyle()->hasFill()) {
+        CGFloat colorComponents[4];
+        color().getRGBA(colorComponents[0], colorComponents[1], colorComponents[2], colorComponents[3]);
+        ASSERT(!color().hasAlpha());
+        colorComponents[3] = style->svgStyle()->fillOpacity(); // SVG/CSS colors are not specified w/o alpha
+        CGContextSetFillColorSpace(contextRef, deviceRGBColorSpace);
+        CGContextSetFillColor(contextRef, colorComponents);
+        if (isPaintingText()) {
+            const_cast<RenderObject*>(object)->style()->setColor(color());
+            CGContextSetTextDrawingMode(contextRef, kCGTextFill);
+        }
+    }
+
+    if ((type & APPLY_TO_STROKE) && style->svgStyle()->hasStroke()) {
+        CGFloat colorComponents[4];
+        color().getRGBA(colorComponents[0], colorComponents[1], colorComponents[2], colorComponents[3]);
+        ASSERT(!color().hasAlpha());
+        colorComponents[3] = style->svgStyle()->strokeOpacity(); // SVG/CSS colors are not specified w/o alpha
+        CGContextSetStrokeColorSpace(contextRef, deviceRGBColorSpace);
+        CGContextSetStrokeColor(contextRef, colorComponents);
+        applyStrokeStyleToContext(contextRef, style, object);
+        if (isPaintingText()) {
+            const_cast<RenderObject*>(object)->style()->setColor(color());
+            CGContextSetTextDrawingMode(contextRef, kCGTextStroke);
+        }
+    }
+
+    return true;
+}
+
+} // namespace WebCore
+
+#endif
+
+// vim:ts=4:noet
similarity index 58%
rename from WebCore/kcanvas/device/KRenderingPaintServerSolid.h
rename to WebCore/platform/graphics/svg/qt/SVGPaintServerGradientQt.cpp
index 007fc2027ce51aee6f5d393073463c33d73b1616..57d1c72515ba58beba998ac487de9b21f52dc89a 100644 (file)
@@ -1,6 +1,5 @@
 /*
-    Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005 Rob Buis <buis@kde.org>
+    Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
 
     This file is part of the KDE project
 
     Boston, MA 02111-1307, USA.
 */
 
-#ifndef KRenderingPaintServerSolid_H
-#define KRenderingPaintServerSolid_H
+#include "config.h"
+
 #ifdef SVG_SUPPORT
+#include "SVGPaintServerGradient.h"
 
-#include "Color.h"
-#include "KRenderingPaintServer.h"
+#include <QColor>
+#include <QGradient>
 
 namespace WebCore {
 
-class KRenderingPaintServerSolid : public KRenderingPaintServer
+// Helper function used by linear & radial gradient
+void SVGPaintServerGradient::fillColorArray(QGradient& gradient, const Vector<SVGGradientStop>& stops, float opacity) const
 {
-public:
-    KRenderingPaintServerSolid();
-    virtual ~KRenderingPaintServerSolid();
-
-    virtual KCPaintServerType type() const;
+    for (unsigned i = 0; i < stops.size(); ++i) {
+        float offset = stops[i].first;
+        Color color = stops[i].second;
 
-    // 'Solid' interface
-    Color color() const;
-    void setColor(const Color&);
-
-    TextStream& externalRepresentation(TextStream&) const;
-private:
-    Color m_color;
-};
+        QColor c(color.red(), color.green(), color.blue());
+        c.setAlpha(int(color.alpha() * opacity));
 
+        gradient.setColorAt(offset, c);
+    }
 }
 
-#endif // SVG_SUPPORT
+} // namespace WebCore
+
 #endif
 
 // vim:ts=4:noet
diff --git a/WebCore/platform/graphics/svg/qt/SVGPaintServerLinearGradientQt.cpp b/WebCore/platform/graphics/svg/qt/SVGPaintServerLinearGradientQt.cpp
new file mode 100644 (file)
index 0000000..c885039
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+    Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
+
+    This file is part of the KDE project
+
+    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
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+*/
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerLinearGradient.h"
+
+#include "KRenderingDeviceQt.h"
+#include "RenderPath.h"
+
+#include <QLinearGradient>
+
+namespace WebCore {
+
+bool SVGPaintServerLinearGradient::setup(KRenderingDeviceContext* context, const RenderObject* object, SVGPaintTargetType type) const
+{
+    KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
+    Q_ASSERT(qtContext != 0);
+
+    if (listener())
+        listener()->resourceNotification();
+
+    RenderStyle* renderStyle = object->style();
+
+    double x1, x2, y1, y2;
+    if (boundingBoxMode()) {
+        QRectF bbox = qtContext->pathBBox();
+        x1 = double(bbox.left()) + (double(gradientStart().x() / 100.0) * double(bbox.width()));
+        y1 = double(bbox.top()) + (double(gradientStart().y() / 100.0) * double(bbox.height()));
+        x2 = double(bbox.left()) + (double(gradientEnd().x() / 100.0)  * double(bbox.width()));
+        y2 = double(bbox.top()) + (double(gradientEnd().y() / 100.0) * double(bbox.height()));
+    } else {
+        x1 = gradientStart().x();
+        y1 = gradientStart().y();
+        x2 = gradientEnd().x();
+        y2 = gradientEnd().y();
+    }
+
+    qtContext->painter().setPen(Qt::NoPen);
+    qtContext->painter().setBrush(Qt::NoBrush);
+
+    QLinearGradient gradient(QPointF(x1, y1), QPointF(x2, y2));
+    if (spreadMethod() == SPREADMETHOD_REPEAT)
+        gradient.setSpread(QGradient::RepeatSpread);
+    else if (spreadMethod() == SPREADMETHOD_REFLECT)
+        gradient.setSpread(QGradient::ReflectSpread);
+    else
+        gradient.setSpread(QGradient::PadSpread);
+
+    double opacity = 1.0;
+
+    // TODO: Gradient transform + opacity fixes!
+
+    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill()) {
+        fillColorArray(gradient, gradientStops(), opacity);
+
+        QBrush brush(gradient);
+
+        qtContext->painter().setBrush(brush);
+        qtContext->setFillRule(renderStyle->svgStyle()->fillRule());
+    }
+
+    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke()) {
+        fillColorArray(gradient, gradientStops(), opacity);
+
+        QPen pen;
+        QBrush brush(gradient);
+
+        setPenProperties(object, renderStyle, pen);
+        pen.setBrush(brush);
+
+        qtContext->painter().setPen(pen);
+    }
+
+    return true;
+}
+
+} // namespace WebCore
+
+#endif
+
+// vim:ts=4:noet
similarity index 54%
rename from WebCore/kcanvas/device/qt/KRenderingPaintServerPatternQt.cpp
rename to WebCore/platform/graphics/svg/qt/SVGPaintServerPatternQt.cpp
index d6bb1e1db21286b0c935c25e8cf4eabeec5a27a7..ac70ef3876639f69a3818ca6519b003ca41f28b5 100644 (file)
@@ -1,6 +1,5 @@
 /*
-    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005, 2006 Rob Buis <buis@kde.org>
+    Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
 
     This file is part of the KDE project
 
     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 General Public License
-    along with this program; see the file COPYING.LIB. If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
+    You should have received a copy of the GNU Library General Public License
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
 */
 
 #include "config.h"
 
-#include <qrect.h>
-#include <qimage.h>
-
-#include <math.h>
-#include <QPointF>
-#include <QPainterPath>
-
-#include "RenderPath.h"
-#include "RenderStyle.h"
-#include "KRenderingDeviceQt.h"
-#include "KCanvasRenderingStyle.h"
-#include "KRenderingPaintServerPatternQt.h"
-#include "SVGResourceImage.h"
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerPattern.h"
 
 namespace WebCore {
 
-// KRenderingPaintServerPatternQt
-KRenderingPaintServerPatternQt::KRenderingPaintServerPatternQt()
-    : KRenderingPaintServerPattern()
-    , KRenderingPaintServerQt()
-{
-}
-
-KRenderingPaintServerPatternQt::~KRenderingPaintServerPatternQt()
+bool SVGPaintServerPattern::setup(KRenderingDeviceContext* context, const RenderObject* object, SVGPaintTargetType type) const
 {
-}
-
-void KRenderingPaintServerPatternQt::renderPath(KRenderingDeviceContext* context, const RenderPath* path, KCPaintTargetType type) const
-{
-    RenderStyle* renderStyle = path->style();
-    KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
-
-    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill())
-        qtContext->fillPath();
-
-    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke())
-        qtContext->strokePath();
-}
+    // FIXME: Reactivate old pattern code
 
-bool KRenderingPaintServerPatternQt::setup(KRenderingDeviceContext* context, const RenderObject* object, KCPaintTargetType type) const
-{
 /*
     KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
     Q_ASSERT(qtContext != 0);
 
     QPainterPath* _path = static_cast<QPainterPath*>(qtContext->path());
     Q_ASSERT(_path != 0);
+
     if (listener()) {
         listener()->resourceNotification();
     }
@@ -109,20 +76,8 @@ bool KRenderingPaintServerPatternQt::setup(KRenderingDeviceContext* context, con
     return true;
 }
 
-void KRenderingPaintServerPatternQt::teardown(KRenderingDeviceContext*, const RenderObject*, KCPaintTargetType) const
-{
-}
+} // namespace WebCore
 
-void KRenderingPaintServerPatternQt::draw(KRenderingDeviceContext* context, const RenderPath* path, KCPaintTargetType type) const
-{
-    if (!setup(context, path, type))
-        return;
-
-    renderPath(context, path, type);
-    teardown(context, path, type);
-}
-
-}
+#endif
 
 // vim:ts=4:noet
-
similarity index 53%
rename from WebCore/kcanvas/device/qt/KRenderingPaintServerQt.cpp
rename to WebCore/platform/graphics/svg/qt/SVGPaintServerQt.cpp
index 781a472cc5816b9ec9b54801349ed739b123059c..1dff0295f18e30bef3ee76bf6692ce6ce3839bd4 100644 (file)
@@ -1,6 +1,5 @@
 /*
-    Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <wildfox@kde.org>
-                  2004, 2005, 2006 Rob Buis <buis@kde.org>
+    Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
 
     This file is part of the KDE project
 
     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 General Public License
-    along with this program; see the file COPYING.LIB. If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
+    You should have received a copy of the GNU Library General Public License
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
 */
 
 #include "config.h"
 
-#include <QPen>
-#include <QVector>
+#ifdef SVG_SUPPORT
+#include "SVGPaintServer.h"
 
-#include "RenderStyle.h"
 #include "KCanvasRenderingStyle.h"
-#include "KRenderingPaintServerQt.h"
-
-namespace WebCore {
+#include "KRenderingDeviceQt.h"
+#include "RenderPath.h"
 
-KRenderingPaintServerQt::KRenderingPaintServerQt()
-{
-}
+#include <QPen>
+#include <QVector>
 
-KRenderingPaintServerQt::~KRenderingPaintServerQt()
-{
-}
+namespace WebCore {
 
-void KRenderingPaintServerQt::setPenProperties(const RenderObject* item, const RenderStyle* style, QPen& pen) const
+void SVGPaintServer::setPenProperties(const RenderObject* object, const RenderStyle* style, QPen& pen) const
 {
-    pen.setWidthF(KSVGPainterFactory::cssPrimitiveToLength(item, style->svgStyle()->strokeWidth(), 1.0));
+    pen.setWidthF(KSVGPainterFactory::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0));
 
     if (style->svgStyle()->capStyle() == ButtCap)
         pen.setCapStyle(Qt::FlatCap);
@@ -55,7 +49,7 @@ void KRenderingPaintServerQt::setPenProperties(const RenderObject* item, const R
         pen.setJoinStyle(Qt::RoundJoin);
 
     const KCDashArray& dashes = KSVGPainterFactory::dashArrayFromRenderingStyle(style);
-    double dashOffset = KSVGPainterFactory::cssPrimitiveToLength(item, style->svgStyle()->strokeDashOffset(), 0.0);
+    double dashOffset = KSVGPainterFactory::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0);
 
     unsigned int dashLength = !dashes.isEmpty() ? dashes.size() : 0;
     if(dashLength) {
@@ -66,12 +60,40 @@ void KRenderingPaintServerQt::setPenProperties(const RenderObject* item, const R
             pattern.append(dashes[i % dashLength] / (float)pen.widthF());
 
         pen.setDashPattern(pattern);
-    
+
         Q_UNUSED(dashOffset);
         // TODO: dash-offset, does/will qt4 API allow it? (Rob)
     }
 }
 
+void SVGPaintServer::draw(KRenderingDeviceContext* context, const RenderPath* path, SVGPaintTargetType type) const
+{
+    if (!setup(context, path, type))
+        return;
+
+    renderPath(context, path, type);
+    teardown(context, path, type);
+}
+
+void SVGPaintServer::teardown(KRenderingDeviceContext*, const RenderObject*, SVGPaintTargetType) const
+{
+    // no-op
+}
+
+void SVGPaintServer::renderPath(KRenderingDeviceContext* context, const RenderPath* path, SVGPaintTargetType type) const
+{
+    RenderStyle* renderStyle = path->style();
+    KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
+
+    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill())
+        qtContext->fillPath();
+
+    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke())
+        qtContext->strokePath();
 }
 
+} // namespace WebCore
+
+#endif
+
 // vim:ts=4:noet
diff --git a/WebCore/platform/graphics/svg/qt/SVGPaintServerRadialGradientQt.cpp b/WebCore/platform/graphics/svg/qt/SVGPaintServerRadialGradientQt.cpp
new file mode 100644 (file)
index 0000000..e7ebd65
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+    Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
+
+    This file is part of the KDE project
+
+    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
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+*/
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerRadialGradient.h"
+
+#include "KRenderingDeviceQt.h"
+#include "RenderPath.h"
+
+#include <math.h>
+#include <QRadialGradient>
+
+namespace WebCore {
+
+bool SVGPaintServerRadialGradient:: setup(KRenderingDeviceContext* context, const RenderObject* object, SVGPaintTargetType type) const
+{
+    KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
+    Q_ASSERT(qtContext != 0);
+
+    if (listener())
+        listener()->resourceNotification();
+
+    RenderStyle* renderStyle = object->style();
+
+    qtContext->painter().setPen(Qt::NoPen);
+    qtContext->painter().setBrush(Qt::NoBrush);
+    QMatrix mat = qtContext->ctm();
+
+    double cx, fx, cy, fy, r;
+    if (boundingBoxMode()) {
+        QRectF bbox = qtContext->pathBBox();
+        cx = double(bbox.left()) + (double(gradientCenter().x() / 100.0) * double(bbox.width()));
+        cy = double(bbox.top()) + (double(gradientCenter().y() / 100.0) * double(bbox.height()));
+        fx = double(bbox.left()) + (double(gradientFocal().x() / 100.0) * double(bbox.width())) - cx;
+        fy = double(bbox.top()) + (double(gradientFocal().y() / 100.0) * double(bbox.height())) - cy;
+        r = double(gradientRadius() / 100.0) * (sqrt(pow(bbox.width(), 2) + pow(bbox.height(), 2)));
+
+        float width = bbox.width();
+        float height = bbox.height();
+
+        int diff = int(width - height); // allow slight tolerance
+        if (!(diff > -2 && diff < 2)) {
+            // make elliptical or circular depending on bbox aspect ratio
+            float ratioX = (width / height);
+            float ratioY = (height / width);
+            mat.scale((width > height) ? 1 : ratioX, (width > height) ? ratioY : 1);
+        }
+    } else {
+        cx = gradientCenter().x();
+        cy = gradientCenter().y();
+
+        fx = gradientFocal().x();
+        fy = gradientFocal().y();
+
+        fx -= cx;
+        fy -= cy;
+
+        r = gradientRadius();
+    }
+
+    if (sqrt(fx * fx + fy * fy) > r) {
+        // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and r, set (fx, fy)
+        // to the point of intersection of the line through (fx, fy) and the circle.
+        double angle = atan2(fy, fx);
+        fx = int(cos(angle) * r) - 1;
+        fy = int(sin(angle) * r) - 1;
+    }
+
+    QRadialGradient gradient(QPointF(cx, cy), gradientRadius(), QPointF(fx + cx, fy + cy));
+    if (spreadMethod() == SPREADMETHOD_REPEAT)
+        gradient.setSpread(QGradient::RepeatSpread);
+    else if (spreadMethod() == SPREADMETHOD_REFLECT)
+        gradient.setSpread(QGradient::ReflectSpread);
+    else
+        gradient.setSpread(QGradient::PadSpread);
+
+    double opacity = 1.0;
+
+    // TODO: Gradient transform + opacity fixes!
+
+    // AffineTransform gradientTrans = gradientTransform();
+    // gradientTrans.map(cx, cy, &cx, &cy);
+    // qtContext->painter().setMatrix(mat);
+
+    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill()) {
+        fillColorArray(gradient, gradientStops(), opacity);
+
+        QBrush brush(gradient);
+
+        qtContext->painter().setBrush(brush);
+        qtContext->setFillRule(renderStyle->svgStyle()->fillRule());
+    }
+
+    if ((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke()) {
+        fillColorArray(gradient, gradientStops(), opacity);
+
+        QPen pen;
+        QBrush brush(gradient);
+
+        setPenProperties(object, renderStyle, pen);
+        pen.setBrush(brush);
+
+        qtContext->painter().setPen(pen);
+    }
+
+    return true;
+}
+
+} // namespace WebCore
+
+#endif
+
+// vim:ts=4:noet
diff --git a/WebCore/platform/graphics/svg/qt/SVGPaintServerSolidQt.cpp b/WebCore/platform/graphics/svg/qt/SVGPaintServerSolidQt.cpp
new file mode 100644 (file)
index 0000000..408ac65
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+    Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org>
+
+    This file is part of the KDE project
+
+    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
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+    Boston, MA 02111-1307, USA.
+*/
+
+#include "config.h"
+
+#ifdef SVG_SUPPORT
+#include "SVGPaintServerSolid.h"
+
+#include "KRenderingDeviceQt.h"
+#include "RenderPath.h"
+
+namespace WebCore {
+
+bool SVGPaintServerSolid::setup(KRenderingDeviceContext* context, const RenderObject* object, SVGPaintTargetType type) const
+{
+    KRenderingDeviceContextQt* qtContext = static_cast<KRenderingDeviceContextQt*>(context);
+
+    RenderStyle* renderStyle = object->style();
+    // TODO? qtContext->painter().setOpacity(renderStyle->opacity());
+
+    QColor c = color();
+
+    if ((type & APPLY_TO_FILL) && renderStyle->svgStyle()->hasFill()) {
+        c.setAlphaF(renderStyle->svgStyle()->fillOpacity());
+
+        QBrush brush(c);
+        qtContext->painter().setBrush(brush);
+        qtContext->setFillRule(renderStyle->svgStyle()->fillRule());
+
+        /* if(isPaintingText()) ... */
+    }
+
+    if((type & APPLY_TO_STROKE) && renderStyle->svgStyle()->hasStroke()) {
+        c.setAlphaF(renderStyle->svgStyle()->strokeOpacity());
+
+        QPen pen(c);
+        setPenProperties(object, renderStyle, pen);
+        qtContext->painter().setPen(pen);
+
+        /* if(isPaintingText()) ... */
+    }
+
+    return true;
+}
+
+} // namespace WebCore
+
+#endif
+
+// vim:ts=4:noet
index 1d534c0302ac6d30326b80b6eedeb7b27b9074ee..8cea05577817337d2b58eaf665b36430c24557a2 100644 (file)
@@ -203,13 +203,13 @@ void RenderPath::paint(PaintInfo& paintInfo, int parentX, int parentY)
 
     context->clearPath();
     
-    KRenderingPaintServer* fillPaintServer = KSVGPainterFactory::fillPaintServer(style(), this);
+    SVGPaintServer* fillPaintServer = KSVGPainterFactory::fillPaintServer(style(), this);
     if (fillPaintServer) {
         context->addPath(path());
         fillPaintServer->setActiveClient(this);
         fillPaintServer->draw(context, this, APPLY_TO_FILL);
     }
-    KRenderingPaintServer* strokePaintServer = KSVGPainterFactory::strokePaintServer(style(), this);
+    SVGPaintServer* strokePaintServer = KSVGPainterFactory::strokePaintServer(style(), this);
     if (strokePaintServer) {
         context->addPath(path()); // path is cleared when filled.
         strokePaintServer->setActiveClient(this);
index a99e60f5bb789c984aadfdcda1bfba7e123d5082..1859b6bf1e0676a7c41a68052ba677fd51fa5e9e 100644 (file)
@@ -102,7 +102,7 @@ void paintSVGInlineFlow(InlineFlowBox* flow, RenderObject* object, RenderObject:
         c->beginTransparencyLayer(opacity);
     }
     
-    KRenderingPaintServer* fillPaintServer = KSVGPainterFactory::fillPaintServer(object->style(), object);
+    SVGPaintServer* fillPaintServer = KSVGPainterFactory::fillPaintServer(object->style(), object);
     if (fillPaintServer) {
         fillPaintServer->setPaintingText(true);
         if (fillPaintServer->setup(context, object, APPLY_TO_FILL)) {
@@ -111,7 +111,7 @@ void paintSVGInlineFlow(InlineFlowBox* flow, RenderObject* object, RenderObject:
         }
         fillPaintServer->setPaintingText(false);
     }
-    KRenderingPaintServer* strokePaintServer = KSVGPainterFactory::strokePaintServer(object->style(), object);
+    SVGPaintServer* strokePaintServer = KSVGPainterFactory::strokePaintServer(object->style(), object);
     if (strokePaintServer) {
         strokePaintServer->setPaintingText(true);
         if (strokePaintServer->setup(context, object, APPLY_TO_STROKE)) {
index c80ddb1360de2dbe9909410d3b831bd713101491..21e2f8b9f21fac106370a50542ea65c1532e888d 100644 (file)
@@ -35,9 +35,9 @@
 #include "RenderTreeAsText.h"
 #include "RenderSVGContainer.h"
 #include "KRenderingDevice.h"
-#include "KRenderingPaintServerGradient.h"
-#include "KRenderingPaintServerPattern.h"
-#include "KRenderingPaintServerSolid.h"
+#include "SVGPaintServerGradient.h"
+#include "SVGPaintServerPattern.h"
+#include "SVGPaintServerSolid.h"
 #include "KCanvasRenderingStyle.h"
 #include "SVGStyledElement.h"
 #include <math.h>
@@ -228,7 +228,7 @@ static void writeStyle(TextStream& ts, const RenderObject &object)
         ts << " [opacity=" << style->opacity() << "]";
     if (object.isRenderPath()) {
         const RenderPath& path = static_cast<const RenderPath&>(object);
-        KRenderingPaintServer *strokePaintServer = KSVGPainterFactory::strokePaintServer(style, &path);
+        SVGPaintServer *strokePaintServer = KSVGPainterFactory::strokePaintServer(style, &path);
         if (strokePaintServer) {
             TextStreamSeparator s(" ");
             ts << " [stroke={";
@@ -259,7 +259,7 @@ static void writeStyle(TextStream& ts, const RenderObject &object)
                 ts << s << "[dash array=" << dashArray << "]";        
             ts << "}]";
         }
-        KRenderingPaintServer *fillPaintServer = KSVGPainterFactory::fillPaintServer(style, &path);
+        SVGPaintServer *fillPaintServer = KSVGPainterFactory::fillPaintServer(style, &path);
         if (fillPaintServer) {
             TextStreamSeparator s(" ");
             ts << " [fill={";
@@ -368,7 +368,7 @@ void writeRenderResources(TextStream& ts, Node *parent)
         
         DeprecatedString elementId = svgElement->getAttribute(HTMLNames::idAttr).deprecatedString();
         if (resource->isPaintServer()) {
-            RefPtr<KRenderingPaintServer> paintServer = WTF::static_pointer_cast<KRenderingPaintServer>(resource);
+            RefPtr<SVGPaintServer> paintServer = WTF::static_pointer_cast<SVGPaintServer>(resource);
             ts << "KRenderingPaintServer {id=\"" << elementId << "\" " << *paintServer << "}" << endl;
         } else
             ts << "KCanvasResource {id=\"" << elementId << "\" " << *resource << "}" << endl;