diff options
author | Steve Block <steveblock@google.com> | 2010-02-05 14:27:46 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-15 10:49:50 +0000 |
commit | 5e2bc6953fe6923165b8a5d7679939693a1d58d6 (patch) | |
tree | 6ccb8c24bc2bf5e8f413e6cfae250b729b426631 /WebCore/platform/graphics/cg | |
parent | 4a00f4fccc3cb7e9996749a05631f5d7b9de756e (diff) | |
download | external_webkit-5e2bc6953fe6923165b8a5d7679939693a1d58d6.zip external_webkit-5e2bc6953fe6923165b8a5d7679939693a1d58d6.tar.gz external_webkit-5e2bc6953fe6923165b8a5d7679939693a1d58d6.tar.bz2 |
Merge webkit.org at r54340 : Initial merge by git
Change-Id: Ib489d2ff91186ea3652522e1d586e54416a2cf44
Diffstat (limited to 'WebCore/platform/graphics/cg')
4 files changed, 39 insertions, 0 deletions
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index b11ba66..a339982 100644 --- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -28,6 +28,7 @@ #include "config.h" #include "GraphicsContext.h" +#include "AffineTransform.h" #include "FloatConversion.h" #include "GraphicsContextPlatformPrivateCG.h" #include "GraphicsContextPrivate.h" @@ -958,6 +959,15 @@ void GraphicsContext::translate(float x, float y) m_data->m_userToDeviceTransformKnownToBeIdentity = false; } +void GraphicsContext::concatCTM(const AffineTransform& transform) +{ + if (paintingDisabled()) + return; + CGContextConcatCTM(platformContext(), transform); + m_data->concatCTM(transform); + m_data->m_userToDeviceTransformKnownToBeIdentity = false; +} + void GraphicsContext::concatCTM(const TransformationMatrix& transform) { if (paintingDisabled()) @@ -967,6 +977,12 @@ void GraphicsContext::concatCTM(const TransformationMatrix& transform) m_data->m_userToDeviceTransformKnownToBeIdentity = false; } +AffineTransform GraphicsContext::getAffineCTM() const +{ + CGAffineTransform t = CGContextGetCTM(platformContext()); + return AffineTransform(t.a, t.b, t.c, t.d, t.tx, t.ty); +} + TransformationMatrix GraphicsContext::getCTM() const { CGAffineTransform t = CGContextGetCTM(platformContext()); diff --git a/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h b/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h index ff1816f..7b80d5b 100644 --- a/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h +++ b/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h @@ -73,6 +73,7 @@ public: void scale(const FloatSize&) {} void rotate(float) {} void translate(float, float) {} + void concatCTM(const AffineTransform&) {} void concatCTM(const TransformationMatrix&) {} void beginTransparencyLayer() {} void endTransparencyLayer() {} @@ -88,6 +89,7 @@ public: void scale(const FloatSize&); void rotate(float); void translate(float, float); + void concatCTM(const AffineTransform&); void concatCTM(const TransformationMatrix&); void beginTransparencyLayer() { m_transparencyCount++; } void endTransparencyLayer() { m_transparencyCount--; } diff --git a/WebCore/platform/graphics/cg/PathCG.cpp b/WebCore/platform/graphics/cg/PathCG.cpp index 3b05641..01680df 100644 --- a/WebCore/platform/graphics/cg/PathCG.cpp +++ b/WebCore/platform/graphics/cg/PathCG.cpp @@ -29,6 +29,7 @@ #if PLATFORM(CG) +#include "AffineTransform.h" #include "TransformationMatrix.h" #include <ApplicationServices/ApplicationServices.h> #include "FloatRect.h" @@ -346,6 +347,15 @@ void Path::apply(void* info, PathApplierFunction function) const CGPathApply(m_path, &pinfo, CGPathApplierToPathApplier); } +void Path::transform(const AffineTransform& transform) +{ + CGMutablePathRef path = CGPathCreateMutable(); + CGAffineTransform transformCG = transform; + CGPathAddPath(path, &transformCG, m_path); + CGPathRelease(m_path); + m_path = path; +} + void Path::transform(const TransformationMatrix& transform) { CGMutablePathRef path = CGPathCreateMutable(); diff --git a/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp b/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp index 568a6b3..5fe2122 100644 --- a/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp +++ b/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp @@ -24,6 +24,7 @@ */ #include "config.h" +#include "AffineTransform.h" #include "TransformationMatrix.h" #if PLATFORM(CG) @@ -43,6 +44,16 @@ TransformationMatrix::operator CGAffineTransform() const narrowPrecisionToCGFloat(f())); } +AffineTransform::operator CGAffineTransform() const +{ + return CGAffineTransformMake(narrowPrecisionToCGFloat(a()), + narrowPrecisionToCGFloat(b()), + narrowPrecisionToCGFloat(c()), + narrowPrecisionToCGFloat(d()), + narrowPrecisionToCGFloat(e()), + narrowPrecisionToCGFloat(f())); +} + } #endif // PLATFORM(CG) |