Changeset 54112 in webkit
- Timestamp:
- Jan 31, 2010 1:04:58 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 added
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/Android.mk
r53695 r54112 467 467 platform/graphics/skia/TransformationMatrixSkia.cpp \ 468 468 \ 469 platform/graphics/transforms/AffineTransform.cpp \ 469 470 platform/graphics/transforms/Matrix3DTransformOperation.cpp \ 470 471 platform/graphics/transforms/MatrixTransformOperation.cpp \ -
trunk/WebCore/ChangeLog
r54111 r54112 1 2010-01-31 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Simon Fraser. 4 5 Add back an AffineTransform class for use by SVG 6 https://bugs.webkit.org/show_bug.cgi?id=33750 7 8 These are the first steps on reimplementing AffineTransform. Unlike 9 the old affine code, this one is platform independent like TransformationMatrix. 10 AffineTransform has the benefit, that it stores just 6 doubles instead of 11 16 in TransformationMatrix. The calculations of transformations are not that 12 complex and can improve the memory usage and speed of SVG. 13 AffineTransform can be used by HTML Canvas3D or SVG, since they are 2D related (at 14 least for the moment). 15 HTML Canvas is the first that makes use of the new AffineTransform. Next patches 16 will introduce the affine code to SVG. 17 18 No new tests. The new AffineTransformation code is tested by fast/canvas. 19 20 * Android.mk: 21 * GNUmakefile.am: 22 * WebCore.gypi: 23 * WebCore.pro: 24 * WebCore.vcproj/WebCore.vcproj: 25 * WebCore.xcodeproj/project.pbxproj: 26 * html/canvas/CanvasRenderingContext2D.cpp: 27 (WebCore::CanvasRenderingContext2D::scale): 28 (WebCore::CanvasRenderingContext2D::rotate): 29 (WebCore::CanvasRenderingContext2D::translate): 30 (WebCore::CanvasRenderingContext2D::transform): 31 (WebCore::CanvasRenderingContext2D::setTransform): 32 (WebCore::CanvasRenderingContext2D::isPointInPath): 33 (WebCore::CanvasRenderingContext2D::willDraw): 34 * html/canvas/CanvasRenderingContext2D.h: 35 * platform/graphics/GraphicsContext.h: 36 * platform/graphics/Path.h: 37 * platform/graphics/cairo/GraphicsContextCairo.cpp: 38 (WebCore::GraphicsContext::getAffineCTM): 39 (WebCore::GraphicsContext::concatCTM): 40 * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: 41 (WebCore::GraphicsContextPlatformPrivate::concatCTM): 42 * platform/graphics/cairo/PathCairo.cpp: 43 (WebCore::Path::transform): 44 * platform/graphics/cairo/TransformationMatrixCairo.cpp: 45 (WebCore::AffineTransform::operator cairo_matrix_t): 46 * platform/graphics/cg/GraphicsContextCG.cpp: 47 (WebCore::GraphicsContext::concatCTM): 48 (WebCore::GraphicsContext::getAffineCTM): 49 * platform/graphics/cg/GraphicsContextPlatformPrivateCG.h: 50 (WebCore::GraphicsContextPlatformPrivate::concatCTM): 51 * platform/graphics/cg/PathCG.cpp: 52 (WebCore::Path::transform): 53 * platform/graphics/cg/TransformationMatrixCG.cpp: 54 (WebCore::AffineTransform::operator CGAffineTransform): 55 * platform/graphics/haiku/GraphicsContextHaiku.cpp: 56 (WebCore::GraphicsContext::getAffineCTM): 57 (WebCore::GraphicsContext::concatCTM): 58 * platform/graphics/haiku/PathHaiku.cpp: 59 (WebCore::Path::transform): 60 * platform/graphics/qt/GraphicsContextQt.cpp: 61 (WebCore::GraphicsContext::getAffineCTM): 62 (WebCore::GraphicsContext::concatCTM): 63 * platform/graphics/qt/PathQt.cpp: 64 (WebCore::Path::transform): 65 * platform/graphics/qt/TransformationMatrixQt.cpp: 66 (WebCore::AffineTransform::operator QTransform): 67 * platform/graphics/skia/GraphicsContextSkia.cpp: 68 (WebCore::GraphicsContext::getAffineCTM): 69 * platform/graphics/skia/PathSkia.cpp: 70 (WebCore::Path::transform): 71 * platform/graphics/skia/TransformationMatrixSkia.cpp: 72 (WebCore::AffineTransform::operator SkMatrix): 73 * platform/graphics/transforms/AffineTransform.cpp: Added. 74 (WebCore::affineTransformDecompose): 75 (WebCore::affineTransformCompose): 76 (WebCore::AffineTransform::AffineTransform): 77 (WebCore::AffineTransform::reset): 78 (WebCore::AffineTransform::setMatrix): 79 (WebCore::AffineTransform::isIdentity): 80 (WebCore::AffineTransform::det): 81 (WebCore::AffineTransform::isInvertible): 82 (WebCore::AffineTransform::inverse): 83 (WebCore::AffineTransform::multiply): 84 (WebCore::AffineTransform::multLeft): 85 (WebCore::AffineTransform::rotate): 86 (WebCore::AffineTransform::scale): 87 (WebCore::AffineTransform::translate): 88 (WebCore::AffineTransform::scaleNonUniform): 89 (WebCore::AffineTransform::rotateFromVector): 90 (WebCore::AffineTransform::flipX): 91 (WebCore::AffineTransform::flipY): 92 (WebCore::AffineTransform::shear): 93 (WebCore::AffineTransform::skew): 94 (WebCore::AffineTransform::skewX): 95 (WebCore::AffineTransform::skewY): 96 (WebCore::makeMapBetweenRects): 97 (WebCore::AffineTransform::map): 98 (WebCore::AffineTransform::mapPoint): 99 (WebCore::AffineTransform::mapRect): 100 (WebCore::AffineTransform::blend): 101 * platform/graphics/transforms/AffineTransform.h: Added. 102 (WebCore::AffineTransform::a): 103 (WebCore::AffineTransform::setA): 104 (WebCore::AffineTransform::b): 105 (WebCore::AffineTransform::setB): 106 (WebCore::AffineTransform::c): 107 (WebCore::AffineTransform::setC): 108 (WebCore::AffineTransform::d): 109 (WebCore::AffineTransform::setD): 110 (WebCore::AffineTransform::e): 111 (WebCore::AffineTransform::setE): 112 (WebCore::AffineTransform::f): 113 (WebCore::AffineTransform::setF): 114 (WebCore::AffineTransform::operator== ): 115 (WebCore::AffineTransform::operator!=): 116 (WebCore::AffineTransform::operator*=): 117 (WebCore::AffineTransform::operator*): 118 (WebCore::AffineTransform::setMatrix): 119 * platform/graphics/wince/GraphicsContextWince.cpp: 120 (WebCore::GraphicsContext::concatCTM): 121 (WebCore::GraphicsContext::getAffineCTM): 122 * platform/graphics/wx/GraphicsContextWx.cpp: 123 (WebCore::GraphicsContext::getAffineCTM): 124 (WebCore::GraphicsContext::concatCTM): 125 * platform/graphics/wx/PathWx.cpp: 126 (WebCore::Path::transform): 127 * platform/graphics/wx/TransformationMatrixWx.cpp: 128 (WebCore::AffineTransform::operator wxGraphicsMatrix): 129 1 130 2010-01-31 Pavel Feldman <pfeldman@chromium.org> 2 131 -
trunk/WebCore/GNUmakefile.am
r54104 r54112 1602 1602 WebCore/platform/graphics/WidthIterator.cpp \ 1603 1603 WebCore/platform/graphics/WidthIterator.h \ 1604 WebCore/platform/graphics/transforms/AffineTransform.cpp \ 1605 WebCore/platform/graphics/transforms/AffineTransform.h \ 1604 1606 WebCore/platform/graphics/transforms/IdentityTransformOperation.h \ 1605 1607 WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp \ -
trunk/WebCore/WebCore.gypi
r54110 r54112 2137 2137 'platform/graphics/skia/SkiaUtils.h', 2138 2138 'platform/graphics/skia/TransformationMatrixSkia.cpp', 2139 'platform/graphics/transforms/AffineTransform.cpp', 2140 'platform/graphics/transforms/AffineTransform.h', 2139 2141 'platform/graphics/transforms/IdentityTransformOperation.h', 2140 2142 'platform/graphics/transforms/Matrix3DTransformOperation.cpp', -
trunk/WebCore/WebCore.pro
r54109 r54112 805 805 platform/graphics/SegmentedFontData.cpp \ 806 806 platform/graphics/SimpleFontData.cpp \ 807 platform/graphics/transforms/AffineTransform.cpp \ 807 808 platform/graphics/transforms/TransformationMatrix.cpp \ 808 809 platform/graphics/transforms/MatrixTransformOperation.cpp \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r54110 r54112 24108 24108 > 24109 24109 <File 24110 RelativePath="..\platform\graphics\transforms\AffineTransform.cpp" 24111 > 24112 </File> 24113 <File 24114 RelativePath="..\platform\graphics\transforms\AffineTransform.h" 24115 > 24116 <File 24110 24117 RelativePath="..\platform\graphics\transforms\IdentityTransformOperation.h" 24111 24118 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r54103 r54112 1314 1314 84A81F410FC7E02700955300 /* SourceGraphic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84A81F3F0FC7E02700955300 /* SourceGraphic.cpp */; }; 1315 1315 84A81F420FC7E02700955300 /* SourceGraphic.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A81F400FC7E02700955300 /* SourceGraphic.h */; }; 1316 84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D0C4031115F1D40018AA34 /* AffineTransform.cpp */; }; 1317 84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D0C4051115F1EA0018AA34 /* AffineTransform.h */; }; 1316 1318 85004D940ACEEAEF00C438F6 /* DOMSVGDefsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 85004D880ACEEAEF00C438F6 /* DOMSVGDefsElement.h */; }; 1317 1319 85004D950ACEEAEF00C438F6 /* DOMSVGDefsElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85004D890ACEEAEF00C438F6 /* DOMSVGDefsElement.mm */; }; … … 6717 6719 84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebCoreKeyGenerator.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 6718 6720 84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SSLKeyGeneratorMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 6721 84D0C4031115F1D40018AA34 /* AffineTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AffineTransform.cpp; path = transforms/AffineTransform.cpp; sourceTree = "<group>"; }; 6722 84D0C4051115F1EA0018AA34 /* AffineTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AffineTransform.h; path = transforms/AffineTransform.h; sourceTree = "<group>"; }; 6719 6723 85004D880ACEEAEF00C438F6 /* DOMSVGDefsElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGDefsElement.h; sourceTree = "<group>"; }; 6720 6724 85004D890ACEEAEF00C438F6 /* DOMSVGDefsElement.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMSVGDefsElement.mm; sourceTree = "<group>"; }; … … 10900 10904 isa = PBXGroup; 10901 10905 children = ( 10906 84D0C4051115F1EA0018AA34 /* AffineTransform.h */, 10907 84D0C4031115F1D40018AA34 /* AffineTransform.cpp */, 10902 10908 49E911B50EF86D47009D0CAF /* IdentityTransformOperation.h */, 10903 10909 49D5DC270F423A73008F20FD /* Matrix3DTransformOperation.cpp */, … … 18466 18472 E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 18467 18473 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */, 18474 84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */, 18468 18475 ); 18469 18476 runOnlyForDeploymentPostprocessing = 0; … … 20640 20647 E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 20641 20648 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */, 20649 84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */, 20642 20650 ); 20643 20651 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r52682 r54112 31 31 #include "CanvasRenderingContext2D.h" 32 32 33 #include " TransformationMatrix.h"33 #include "AffineTransform.h" 34 34 #include "CSSParser.h" 35 35 #include "CachedImage.h" … … 358 358 return; 359 359 360 TransformationMatrixnewTransform = state().m_transform;360 AffineTransform newTransform = state().m_transform; 361 361 newTransform.scaleNonUniform(sx, sy); 362 362 if (!newTransform.isInvertible()) { … … 367 367 state().m_transform = newTransform; 368 368 c->scale(FloatSize(sx, sy)); 369 m_path.transform( TransformationMatrix().scaleNonUniform(1.0/sx, 1.0/sy));369 m_path.transform(AffineTransform().scaleNonUniform(1.0 / sx, 1.0 / sy)); 370 370 } 371 371 … … 381 381 return; 382 382 383 TransformationMatrixnewTransform = state().m_transform;383 AffineTransform newTransform = state().m_transform; 384 384 newTransform.rotate(angleInRadians / piDouble * 180.0); 385 385 if (!newTransform.isInvertible()) { … … 390 390 state().m_transform = newTransform; 391 391 c->rotate(angleInRadians); 392 m_path.transform( TransformationMatrix().rotate(-angleInRadians / piDouble * 180.0));392 m_path.transform(AffineTransform().rotate(-angleInRadians / piDouble * 180.0)); 393 393 } 394 394 … … 404 404 return; 405 405 406 TransformationMatrixnewTransform = state().m_transform;406 AffineTransform newTransform = state().m_transform; 407 407 newTransform.translate(tx, ty); 408 408 if (!newTransform.isInvertible()) { … … 413 413 state().m_transform = newTransform; 414 414 c->translate(tx, ty); 415 m_path.transform( TransformationMatrix().translate(-tx, -ty));415 m_path.transform(AffineTransform().translate(-tx, -ty)); 416 416 } 417 417 … … 428 428 return; 429 429 430 TransformationMatrixtransform(m11, m12, m21, m22, dx, dy);431 TransformationMatrixnewTransform = transform * state().m_transform;430 AffineTransform transform(m11, m12, m21, m22, dx, dy); 431 AffineTransform newTransform = transform * state().m_transform; 432 432 if (!newTransform.isInvertible()) { 433 433 state().m_invertibleCTM = false; … … 450 450 return; 451 451 452 TransformationMatrixctm = state().m_transform;452 AffineTransform ctm = state().m_transform; 453 453 if (!ctm.isInvertible()) 454 454 return; … … 709 709 710 710 FloatPoint point(x, y); 711 TransformationMatrixctm = state().m_transform;711 AffineTransform ctm = state().m_transform; 712 712 FloatPoint transformedPoint = ctm.inverse().mapPoint(point); 713 713 return m_path.contains(transformedPoint); … … 1242 1242 FloatRect dirtyRect = r; 1243 1243 if (options & CanvasWillDrawApplyTransform) { 1244 TransformationMatrixctm = state().m_transform;1244 AffineTransform ctm = state().m_transform; 1245 1245 dirtyRect = ctm.mapRect(r); 1246 1246 } -
trunk/WebCore/html/canvas/CanvasRenderingContext2D.h
r49734 r54112 27 27 #define CanvasRenderingContext2D_h 28 28 29 #include "AffineTransform.h" 29 30 #include "CanvasRenderingContext.h" 30 #include "TransformationMatrix.h"31 31 #include "FloatSize.h" 32 32 #include "Font.h" … … 219 219 float m_globalAlpha; 220 220 CompositeOperator m_globalComposite; 221 TransformationMatrixm_transform;221 AffineTransform m_transform; 222 222 bool m_invertibleCTM; 223 223 -
trunk/WebCore/platform/graphics/GraphicsContext.h
r54075 r54112 112 112 const int cMisspellingLinePatternGapWidth = 1; 113 113 114 class AffineTransform; 114 115 class Font; 115 116 class Generator; … … 305 306 306 307 void concatCTM(const TransformationMatrix&); 308 void concatCTM(const AffineTransform&); 307 309 TransformationMatrix getCTM() const; 310 AffineTransform getAffineCTM() const; 308 311 309 312 #if OS(WINCE) && !PLATFORM(QT) -
trunk/WebCore/platform/graphics/Path.h
r53131 r54112 68 68 namespace WebCore { 69 69 70 class AffineTransform; 70 71 class FloatPoint; 71 72 class FloatRect; … … 146 147 147 148 void apply(void* info, PathApplierFunction) const; 149 void transform(const AffineTransform&); 148 150 void transform(const TransformationMatrix&); 149 151 -
trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r53857 r54112 33 33 #if PLATFORM(CAIRO) 34 34 35 #include "AffineTransform.h" 35 36 #include "CairoPath.h" 36 37 #include "FEGaussianBlur.h" … … 215 216 cairo_get_matrix(cr, &m); 216 217 return TransformationMatrix(m.xx, m.yx, m.xy, m.yy, m.x0, m.y0); 218 } 219 220 AffineTransform GraphicsContext::getAffineCTM() const 221 { 222 cairo_t* cr = platformContext(); 223 cairo_matrix_t m; 224 cairo_get_matrix(cr, &m); 225 return AffineTransform(m.xx, m.yx, m.xy, m.yy, m.x0, m.y0); 217 226 } 218 227 … … 793 802 794 803 void GraphicsContext::concatCTM(const TransformationMatrix& transform) 804 { 805 if (paintingDisabled()) 806 return; 807 808 cairo_t* cr = m_data->cr; 809 const cairo_matrix_t matrix = cairo_matrix_t(transform); 810 cairo_transform(cr, &matrix); 811 m_data->concatCTM(transform); 812 } 813 814 void GraphicsContext::concatCTM(const AffineTransform& transform) 795 815 { 796 816 if (paintingDisabled()) -
trunk/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h
r52421 r54112 72 72 void rotate(float); 73 73 void translate(float, float); 74 void concatCTM(const AffineTransform&); 74 75 void concatCTM(const TransformationMatrix&); 75 76 void beginTransparencyLayer() { m_transparencyCount++; } … … 86 87 void rotate(float) {} 87 88 void translate(float, float) {} 89 void concatCTM(const AffineTransform&) {} 88 90 void concatCTM(const TransformationMatrix&) {} 89 91 void beginTransparencyLayer() {} -
trunk/WebCore/platform/graphics/cairo/PathCairo.cpp
r50527 r54112 26 26 #include "Path.h" 27 27 28 #include "AffineTransform.h" 28 29 #include "TransformationMatrix.h" 29 30 #include "CairoPath.h" … … 327 328 } 328 329 330 void Path::transform(const AffineTransform& trans) 331 { 332 cairo_t* m_cr = platformPath()->m_cr; 333 cairo_matrix_t c_matrix = cairo_matrix_t(trans); 334 cairo_matrix_invert(&c_matrix); 335 cairo_transform(m_cr, &c_matrix); 336 } 337 329 338 void Path::transform(const TransformationMatrix& trans) 330 339 { -
trunk/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp
r40774 r54112 24 24 25 25 #include "config.h" 26 #include "AffineTransform.h" 26 27 #include "TransformationMatrix.h" 27 28 … … 47 48 } 48 49 50 AffineTransform::operator cairo_matrix_t() const 51 { 52 cairo_matrix_t m; 53 54 cairo_matrix_init (&m, 55 a(), 56 b(), 57 c(), 58 d(), 59 e(), 60 f()); 61 return m; 62 } 63 49 64 } 50 65 -
trunk/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r54107 r54112 29 29 #include "GraphicsContext.h" 30 30 31 #include "AffineTransform.h" 31 32 #include "FloatConversion.h" 32 33 #include "GraphicsContextPlatformPrivateCG.h" … … 959 960 } 960 961 961 void GraphicsContext::concatCTM(const TransformationMatrix& transform)962 void GraphicsContext::concatCTM(const AffineTransform& transform) 962 963 { 963 964 if (paintingDisabled()) … … 966 967 m_data->concatCTM(transform); 967 968 m_data->m_userToDeviceTransformKnownToBeIdentity = false; 969 } 970 971 void GraphicsContext::concatCTM(const TransformationMatrix& transform) 972 { 973 if (paintingDisabled()) 974 return; 975 CGContextConcatCTM(platformContext(), transform); 976 m_data->concatCTM(transform); 977 m_data->m_userToDeviceTransformKnownToBeIdentity = false; 978 } 979 980 AffineTransform GraphicsContext::getAffineCTM() const 981 { 982 CGAffineTransform t = CGContextGetCTM(platformContext()); 983 return AffineTransform(t.a, t.b, t.c, t.d, t.tx, t.ty); 968 984 } 969 985 -
trunk/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h
r51212 r54112 74 74 void rotate(float) {} 75 75 void translate(float, float) {} 76 void concatCTM(const AffineTransform&) {} 76 77 void concatCTM(const TransformationMatrix&) {} 77 78 void beginTransparencyLayer() {} … … 89 90 void rotate(float); 90 91 void translate(float, float); 92 void concatCTM(const AffineTransform&); 91 93 void concatCTM(const TransformationMatrix&); 92 94 void beginTransparencyLayer() { m_transparencyCount++; } -
trunk/WebCore/platform/graphics/cg/PathCG.cpp
r47585 r54112 30 30 #if PLATFORM(CG) 31 31 32 #include "AffineTransform.h" 32 33 #include "TransformationMatrix.h" 33 34 #include <ApplicationServices/ApplicationServices.h> … … 347 348 } 348 349 349 void Path::transform(const TransformationMatrix& transform)350 void Path::transform(const AffineTransform& transform) 350 351 { 351 352 CGMutablePathRef path = CGPathCreateMutable(); … … 356 357 } 357 358 359 void Path::transform(const TransformationMatrix& transform) 360 { 361 CGMutablePathRef path = CGPathCreateMutable(); 362 CGAffineTransform transformCG = transform; 363 CGPathAddPath(path, &transformCG, m_path); 364 CGPathRelease(m_path); 365 m_path = path; 366 } 367 358 368 } 359 369 -
trunk/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp
r40761 r54112 25 25 26 26 #include "config.h" 27 #include "AffineTransform.h" 27 28 #include "TransformationMatrix.h" 28 29 … … 44 45 } 45 46 47 AffineTransform::operator CGAffineTransform() const 48 { 49 return CGAffineTransformMake(narrowPrecisionToCGFloat(a()), 50 narrowPrecisionToCGFloat(b()), 51 narrowPrecisionToCGFloat(c()), 52 narrowPrecisionToCGFloat(d()), 53 narrowPrecisionToCGFloat(e()), 54 narrowPrecisionToCGFloat(f())); 55 } 56 46 57 } 47 58 -
trunk/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp
r53857 r54112 29 29 #include "GraphicsContext.h" 30 30 31 #include "AffineTransform.h" 31 32 #include "CString.h" 32 33 #include "Color.h" … … 392 393 } 393 394 395 AffineTransform GraphicsContext::getAffineCTM() const 396 { 397 notImplemented(); 398 return AffineTransform(); 399 } 400 394 401 TransformationMatrix GraphicsContext::getCTM() const 395 402 { … … 445 452 446 453 void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness) 454 { 455 if (paintingDisabled()) 456 return; 457 458 notImplemented(); 459 } 460 461 void GraphicsContext::concatCTM(const AffineTransform& transform) 447 462 { 448 463 if (paintingDisabled()) -
trunk/WebCore/platform/graphics/haiku/PathHaiku.cpp
r47142 r54112 29 29 #include "Path.h" 30 30 31 #include "AffineTransform.h" 31 32 #include "FloatRect.h" 32 33 #include "NotImplemented.h" … … 147 148 } 148 149 150 void Path::transform(const AffineTransform& transform) 151 { 152 notImplemented(); 153 } 154 149 155 void Path::transform(const TransformationMatrix& transform) 150 156 { -
trunk/WebCore/platform/graphics/qt/GraphicsContextQt.cpp
r53857 r54112 41 41 #endif 42 42 43 #include "AffineTransform.h" 43 44 #include "Color.h" 44 45 #include "FloatConversion.h" … … 276 277 } 277 278 279 AffineTransform GraphicsContext::getAffineCTM() const 280 { 281 QTransform matrix(platformContext()->combinedTransform()); 282 return AffineTransform(matrix.m11(), matrix.m12(), matrix.m21(), 283 matrix.m22(), matrix.dx(), matrix.dy()); 284 } 285 278 286 TransformationMatrix GraphicsContext::getCTM() const 279 287 { … … 1189 1197 } 1190 1198 1199 void GraphicsContext::concatCTM(const AffineTransform& transform) 1200 { 1201 if (paintingDisabled()) 1202 return; 1203 1204 m_data->p()->setWorldTransform(transform, true); 1205 1206 // Transformations to the context shouldn't transform the currentPath. 1207 // We have to undo every change made to the context from the currentPath 1208 // to avoid wrong drawings. 1209 if (!m_data->currentPath.isEmpty() && transform.isInvertible()) { 1210 QTransform matrix = transform.inverse(); 1211 m_data->currentPath = m_data->currentPath * matrix; 1212 m_common->state.pathTransform.multiply(transform.toTransformationMatrix()); 1213 } 1214 } 1215 1216 1191 1217 void GraphicsContext::concatCTM(const TransformationMatrix& transform) 1192 1218 { -
trunk/WebCore/platform/graphics/qt/PathQt.cpp
r53131 r54112 2 2 * Copyright (C) 2006 Zack Rusin <zack@kde.org> 3 3 * 2006 Rob Buis <buis@kde.org> 4 * 2009 Dirk Schulze <krit@webkit.org>4 * 2009, 2010 Dirk Schulze <krit@webkit.org> 5 5 * 6 6 * All rights reserved. … … 31 31 #include "Path.h" 32 32 33 #include " TransformationMatrix.h"33 #include "AffineTransform.h" 34 34 #include "FloatRect.h" 35 35 #include "GraphicsContext.h" … … 37 37 #include "PlatformString.h" 38 38 #include "StrokeStyleApplier.h" 39 #include "TransformationMatrix.h" 39 40 #include <QPainterPath> 40 41 #include <QTransform> … … 380 381 } 381 382 383 void Path::transform(const AffineTransform& transform) 384 { 385 m_path = QTransform(transform).map(m_path); 386 } 387 382 388 void Path::transform(const TransformationMatrix& transform) 383 389 { -
trunk/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp
r46170 r54112 25 25 26 26 #include "config.h" 27 #include "AffineTransform.h" 27 28 #include "TransformationMatrix.h" 28 29 … … 37 38 } 38 39 40 AffineTransform::operator QTransform() const 41 { 42 return QTransform(a(), b(), c(), d(), e(), f()); 43 } 44 39 45 } 40 46 -
trunk/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp
r53857 r54112 32 32 #include "GraphicsContext.h" 33 33 34 #include "AffineTransform.h" 34 35 #include "Color.h" 35 36 #include "FloatRect.h" … … 440 441 } 441 442 443 void GraphicsContext::concatCTM(const AffineTransform& affine) 444 { 445 if (paintingDisabled()) 446 return; 447 platformContext()->canvas()->concat(affine); 448 } 449 442 450 void GraphicsContext::concatCTM(const TransformationMatrix& xform) 443 451 { … … 806 814 } 807 815 816 AffineTransform GraphicsContext::getAffineCTM() const 817 { 818 const SkMatrix& m = platformContext()->canvas()->getTotalMatrix(); 819 return AffineTransform(SkScalarToDouble(m.getScaleX()), // a 820 SkScalarToDouble(m.getSkewY()), // b 821 SkScalarToDouble(m.getSkewX()), // c 822 SkScalarToDouble(m.getScaleY()), // d 823 SkScalarToDouble(m.getTranslateX()), // e 824 SkScalarToDouble(m.getTranslateY())); // f 825 } 826 808 827 TransformationMatrix GraphicsContext::getCTM() const 809 828 { -
trunk/WebCore/platform/graphics/skia/PathSkia.cpp
r49794 r54112 31 31 #include "Path.h" 32 32 33 #include "AffineTransform.h" 33 34 #include "FloatRect.h" 34 35 #include "ImageBuffer.h" … … 215 216 } 216 217 218 void Path::transform(const AffineTransform& xform) 219 { 220 m_path->transform(xform); 221 } 222 217 223 void Path::transform(const TransformationMatrix& xform) 218 224 { -
trunk/WebCore/platform/graphics/skia/TransformationMatrixSkia.cpp
r40809 r54112 29 29 30 30 #include "config.h" 31 #include "AffineTransform.h" 31 32 #include "TransformationMatrix.h" 32 33 … … 55 56 } 56 57 58 AffineTransform::operator SkMatrix() const 59 { 60 SkMatrix result; 61 62 result.setScaleX(WebCoreDoubleToSkScalar(a())); 63 result.setSkewX(WebCoreDoubleToSkScalar(c())); 64 result.setTranslateX(WebCoreDoubleToSkScalar(e())); 65 66 result.setScaleY(WebCoreDoubleToSkScalar(d())); 67 result.setSkewY(WebCoreDoubleToSkScalar(b())); 68 result.setTranslateY(WebCoreDoubleToSkScalar(f())); 69 70 // FIXME: Set perspective properly. 71 result.setPerspX(0); 72 result.setPerspY(0); 73 result.set(SkMatrix::kMPersp2, SK_Scalar1); 74 75 return result; 76 } 77 57 78 } // namespace WebCore -
trunk/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
r53857 r54112 22 22 #include "GraphicsContext.h" 23 23 24 #include "AffineTransform.h" 24 25 #include "CharacterNames.h" 25 26 #include "GlyphBuffer.h" … … 1144 1145 } 1145 1146 1147 void GraphicsContext::concatCTM(const AffineTransform& transform) 1148 { 1149 m_data->concatCTM(transform); 1150 } 1151 1146 1152 void GraphicsContext::concatCTM(const TransformationMatrix& transform) 1147 1153 { … … 1530 1536 1531 1537 GradientFill(dc, tv.data(), tv.size(), mesh.data(), mesh.size(), vertical ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H); 1538 } 1539 1540 AffineTransform GraphicsContext::getAffineCTM() const 1541 { 1542 return m_data->m_transform; 1532 1543 } 1533 1544 -
trunk/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
r53857 r54112 27 27 #include "GraphicsContext.h" 28 28 29 #include "AffineTransform.h" 29 30 #include "TransformationMatrix.h" 30 31 #include "FloatRect.h" … … 360 361 } 361 362 363 AffineTransform GraphicsContext::getAffineCTM() const 364 { 365 notImplemented(); 366 return AffineTransform(); 367 } 368 362 369 TransformationMatrix GraphicsContext::getCTM() const 363 370 { … … 470 477 if (m_data->context) 471 478 m_data->context->SetBrush(wxBrush(color)); 479 } 480 481 void GraphicsContext::concatCTM(const AffineTransform& transform) 482 { 483 if (paintingDisabled()) 484 return; 485 486 notImplemented(); 487 return; 472 488 } 473 489 -
trunk/WebCore/platform/graphics/wx/PathWx.cpp
r45873 r54112 27 27 #include "Path.h" 28 28 29 #include "AffineTransform.h" 29 30 #include "TransformationMatrix.h" 30 31 #include "FloatPoint.h" … … 203 204 } 204 205 206 void Path::transform(const AffineTransform& transform) 207 { 208 #if USE(WXGC) 209 if (m_path) 210 m_path->Transform(transform); 211 #endif 212 } 213 205 214 void Path::transform(const TransformationMatrix& transform) 206 215 { -
trunk/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp
r42610 r54112 25 25 26 26 #include "config.h" 27 #include "AffineTransform.h" 27 28 #include "TransformationMatrix.h" 28 29 … … 46 47 return matrix; 47 48 } 49 50 AffineTransform::operator wxGraphicsMatrix() const 51 { 52 wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetDefaultRenderer(); 53 ASSERT(renderer); 54 55 wxGraphicsMatrix matrix = renderer->CreateMatrix(a(), b(), c(), d(), e(), f()); 56 return matrix; 57 } 48 58 #endif 49 59
Note: See TracChangeset
for help on using the changeset viewer.