Changeset 36795 in webkit
- Timestamp:
- Sep 22, 2008 11:05:59 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r36791 r36795 1 2008-09-22 Dirk Schulze <vbs85@gmx.de> 2 3 Reviewed by eseidel. Landed by eseidel. 4 5 Moved makeMapBetweenRects from SVG/CG to AffineTransform 6 Make SVGResourceClipper::applyClip more cross-platform 7 8 * platform/graphics/AffineTransform.cpp: 9 * platform/graphics/AffineTransform.h: 10 * svg/graphics/cg/CgSupport.cpp: 11 * svg/graphics/cg/CgSupport.h: 12 * svg/graphics/cg/SVGPaintServerGradientCg.cpp: 13 (WebCore::SVGPaintServerGradient::handleBoundingBoxModeAndGradientTransformation): 14 * svg/graphics/cg/SVGResourceClipperCg.cpp: 15 (WebCore::SVGResourceClipper::applyClip): 16 1 17 2008-09-22 Alp Toker <alp@nuanti.com> 2 18 -
trunk/WebCore/platform/graphics/AffineTransform.cpp
r36275 r36795 136 136 } 137 137 138 AffineTransform& AffineTransform::makeMapBetweenRects(const FloatRect& source, const FloatRect& dest); 139 { 140 AffineTransform transform; 141 transform.translate(dest.x() - source.x(), dest.y() - source.y()); 142 transform.scale(dest.width() / source.width(), dest.height() / source.height()); 143 return transform; 144 } 145 138 146 IntPoint AffineTransform::mapPoint(const IntPoint& point) const 139 147 { -
trunk/WebCore/platform/graphics/AffineTransform.h
r36274 r36795 124 124 }; 125 125 126 AffineTransform& makeMapBetweenRects(const FloatRect& source, const FloatRect& dest); 127 126 128 } // namespace WebCore 127 129 -
trunk/WebCore/svg/graphics/cg/CgSupport.cpp
r36734 r36795 41 41 42 42 namespace WebCore { 43 44 CGAffineTransform CGAffineTransformMakeMapBetweenRects(CGRect source, CGRect dest)45 {46 CGAffineTransform transform = CGAffineTransformMakeTranslation(dest.origin.x - source.origin.x, dest.origin.y - source.origin.y);47 transform = CGAffineTransformScale(transform, dest.size.width/source.size.width, dest.size.height/source.size.height);48 return transform;49 }50 43 51 44 CGContextRef scratchContext() -
trunk/WebCore/svg/graphics/cg/CgSupport.h
r36734 r36795 42 42 class GraphicsContext; 43 43 44 CGAffineTransform CGAffineTransformMakeMapBetweenRects(CGRect source, CGRect dest);45 46 44 CGContextRef scratchContext(); 47 45 FloatRect strokeBoundingBox(const Path& path, RenderStyle*, const RenderObject*); -
trunk/WebCore/svg/graphics/cg/SVGPaintServerGradientCg.cpp
r31830 r36795 25 25 #include "SVGPaintServerGradient.h" 26 26 27 #include "CgSupport.h"28 27 #include "FloatConversion.h" 29 28 #include "GraphicsContext.h" … … 255 254 void SVGPaintServerGradient::handleBoundingBoxModeAndGradientTransformation(GraphicsContext* context, const FloatRect& targetRect) const 256 255 { 257 CGContextRef contextRef = context->platformContext();258 259 256 if (boundingBoxMode()) { 260 257 // Choose default gradient bounding box 261 CGRect gradientBBox = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);258 FloatRect gradientBBox(0.0f, 0.0f, 1.0f, 1.0f); 262 259 263 260 // Generate a transform to map between both bounding boxes 264 CGAffineTransform gradientIntoObjectBBox = CGAffineTransformMakeMapBetweenRects(gradientBBox, CGRect(targetRect)); 265 CGContextConcatCTM(contextRef, gradientIntoObjectBBox); 261 context->concatCTM(makeMapBetweenRects(gradientBBox, targetRect)); 266 262 } 267 263 268 264 // Apply the gradient's own transform 269 CGAffineTransform transform = gradientTransform(); 270 CGContextConcatCTM(contextRef, transform); 265 context->concatCTM(gradientTransform()); 271 266 } 272 267 -
trunk/WebCore/svg/graphics/cg/SVGResourceClipperCg.cpp
r29663 r36795 31 31 #include "SVGResourceClipper.h" 32 32 33 #include "AffineTransform.h" 33 34 #include "GraphicsContext.h" 34 #include "CgSupport.h"35 35 36 36 namespace WebCore { … … 38 38 void SVGResourceClipper::applyClip(GraphicsContext* context, const FloatRect& boundingBox) const 39 39 { 40 CGContextRef cgContext = context->platformContext();41 40 if (m_clipData.clipData().size() < 1) 42 41 return; … … 47 46 context->beginPath(); 48 47 49 CGAffineTransform bboxTransform = CGAffineTransformMakeMapBetweenRects(CGRectMake(0,0,1,1), CGRect(boundingBox));48 AffineTransform bboxTransform = makeMapBetweenRects(FloatRect(0.0f, 0.0f, 1.0f, 1.0f), boundingBox); 50 49 51 50 for (unsigned x = 0; x < m_clipData.clipData().size(); x++) { … … 54 53 heterogenousClipRules = true; 55 54 56 CGPathRef clipPath = data.path.platformPath();55 Path clipPath = data.path; 57 56 58 if (data.bboxUnits) { 59 CGMutablePathRef transformedPath = CGPathCreateMutable(); 60 CGPathAddPath(transformedPath, &bboxTransform, clipPath); 61 CGContextAddPath(cgContext, transformedPath); 62 CGPathRelease(transformedPath); 63 } else 64 CGContextAddPath(cgContext, clipPath); 57 if (data.bboxUnits) 58 clipPath.transform(bboxTransform); 59 60 context->addPath(clipPath); 65 61 } 66 62 63 CGContextRef cgContext = context->platformContext(); 67 64 if (m_clipData.clipData().size()) { 68 65 // FIXME!
Note: See TracChangeset
for help on using the changeset viewer.