Migrate to CGContextSetBaseCTM() and CGContextResetClip() from WKSI
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Oct 2015 23:20:07 +0000 (23:20 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Oct 2015 23:20:07 +0000 (23:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150155

Reviewed by Tim Horton.

Source/WebCore:

No new tests because there is no behavior change.

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawPattern):
(WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::putByteArray):
* platform/ios/WebCoreSystemInterfaceIOS.mm:
* platform/mac/WebCoreSystemInterface.h:
* platform/mac/WebCoreSystemInterface.mm:

Source/WebKit/mac:

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Deleted.
* WebView/WebView.mm:
(-[WebView _setBaseCTM:forContext:]):

Source/WebKit2:

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Deleted.

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

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm
Source/WebCore/platform/mac/WebCoreSystemInterface.h
Source/WebCore/platform/mac/WebCoreSystemInterface.mm
Source/WebCore/platform/spi/cg/CoreGraphicsSPI.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm

index 2b1088d..2dd7da2 100644 (file)
@@ -1,3 +1,21 @@
+2015-10-15  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Migrate to CGContextSetBaseCTM() and CGContextResetClip() from WKSI
+        https://bugs.webkit.org/show_bug.cgi?id=150155
+
+        Reviewed by Tim Horton.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::drawPattern):
+        (WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
+        * platform/graphics/cg/ImageBufferCG.cpp:
+        (WebCore::ImageBuffer::putByteArray):
+        * platform/ios/WebCoreSystemInterfaceIOS.mm:
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+
 2015-10-15  Dan Bernstein  <mitz@apple.com>
 
         Fixed the build.
index 45e464f..bbdbcf5 100644 (file)
@@ -336,8 +336,7 @@ void GraphicsContext::drawPattern(Image& image, const FloatRect& tileRect, const
         RetainPtr<CGColorRef> color = adoptCF(CGColorCreateWithPattern(patternSpace.get(), pattern.get(), &alpha));
         CGContextSetFillColorSpace(context, patternSpace.get());
 
-        // FIXME: Really want a public API for this. It is just CGContextSetBaseCTM(context, CGAffineTransformIdentiy).
-        wkSetBaseCTM(context, CGAffineTransformIdentity);
+        CGContextSetBaseCTM(context, CGAffineTransformIdentity);
         CGContextSetPatternPhase(context, CGSizeZero);
 
         CGContextSetFillColorWithColor(context, color.get());
@@ -1695,7 +1694,7 @@ void GraphicsContext::platformApplyDeviceScaleFactor(float deviceScaleFactor)
     // CoreGraphics expects the base CTM of a HiDPI context to have the scale factor applied to it.
     // Failing to change the base level CTM will cause certain CG features, such as focus rings,
     // to draw with a scale factor of 1 rather than the actual scale factor.
-    wkSetBaseCTM(platformContext(), CGAffineTransformScale(CGContextGetBaseCTM(platformContext()), deviceScaleFactor, deviceScaleFactor));
+    CGContextSetBaseCTM(platformContext(), CGAffineTransformScale(CGContextGetBaseCTM(platformContext()), deviceScaleFactor, deviceScaleFactor));
 }
 
 void GraphicsContext::platformFillEllipse(const FloatRect& ellipse)
index 7bd7f52..f6095f6 100644 (file)
@@ -325,7 +325,7 @@ void ImageBuffer::putByteArray(Multiply multiplied, Uint8ClampedArray* source, c
         CGContextConcatCTM(destContext, AffineTransform(wkGetUserToBaseCTM(destContext)).inverse());
     else
         CGContextConcatCTM(destContext, AffineTransform(CGContextGetCTM(destContext)).inverse());
-    wkCGContextResetClip(destContext);
+    CGContextResetClip(destContext);
     CGContextSetInterpolationQuality(destContext, kCGInterpolationNone);
     CGContextSetAlpha(destContext, 1.0);
     CGContextSetBlendMode(destContext, kCGBlendModeCopy);
index 9de359f..a787c82 100644 (file)
 WEBCORE_EXPORT void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef context, void (^block)(CGRect rect));
 WEBCORE_EXPORT BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
 WEBCORE_EXPORT CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int);
-WEBCORE_EXPORT void (*wkCGContextResetClip)(CGContextRef);
 WEBCORE_EXPORT void (*wkClearGlyphVector)(void* glyphs);
 WEBCORE_EXPORT OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs);
 WEBCORE_EXPORT NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
-WEBCORE_EXPORT void (*wkSetBaseCTM)(CGContextRef, CGAffineTransform);
 WEBCORE_EXPORT void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
 WEBCORE_EXPORT CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
 WEBCORE_EXPORT bool (*wkCGContextIsPDFContext)(CGContextRef);
index 8f85a8c..a42a3ac 100644 (file)
@@ -131,7 +131,6 @@ typedef enum {
     wkPatternTilingConstantSpacingMinimalDistortion,
     wkPatternTilingConstantSpacing
 } wkPatternTiling;
-extern void (*wkCGContextResetClip)(CGContextRef);
 #if !PLATFORM(IOS)
 extern bool (*wkCGContextDrawsWithCorrectShadowOffsets)(CGContextRef);
 #endif
@@ -198,7 +197,6 @@ extern void (*wkSetCookieStoragePrivateBrowsingEnabled)(BOOL);
 extern void (*wkSetDragImage)(NSImage*, NSPoint offset);
 #endif
 extern void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
-extern void (*wkSetBaseCTM)(CGContextRef, CGAffineTransform);
 extern void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint);
 extern CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
 extern bool (*wkCGContextIsPDFContext)(CGContextRef);
index 79e506a..fffafc2 100644 (file)
@@ -33,7 +33,6 @@
 void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *);
 void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef context, void (^block)(CGRect rect));
 BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
-void (*wkCGContextResetClip)(CGContextRef);
 bool (*wkCGContextDrawsWithCorrectShadowOffsets)(CGContextRef);
 CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int);
 NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
@@ -77,7 +76,6 @@ void (*wkQTClearMediaDownloadCache)();
 
 void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*, BOOL);
 void (*wkSetDragImage)(NSImage*, NSPoint offset);
-void (*wkSetBaseCTM)(CGContextRef, CGAffineTransform);
 void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
 CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
 bool (*wkCGContextIsPDFContext)(CGContextRef);
index 9a0209c..9e0397c 100644 (file)
@@ -142,6 +142,7 @@ void CGContextSetBaseCTM(CGContextRef, CGAffineTransform);
 void CGContextSetCTM(CGContextRef, CGAffineTransform);
 void CGContextSetCompositeOperation(CGContextRef, CGCompositeOperation);
 void CGContextSetShouldAntialiasFonts(CGContextRef, bool shouldAntialiasFonts);
+void CGContextResetClip(CGContextRef);
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
 void CGContextSetFontDilation(CGContextRef, CGSize);
 void CGContextSetFontRenderingStyle(CGContextRef, CGFontRenderingStyle);
index 9235809..5c6e49f 100644 (file)
@@ -1,3 +1,15 @@
+2015-10-15  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Migrate to CGContextSetBaseCTM() and CGContextResetClip() from WKSI
+        https://bugs.webkit.org/show_bug.cgi?id=150155
+
+        Reviewed by Tim Horton.
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Deleted.
+        * WebView/WebView.mm:
+        (-[WebView _setBaseCTM:forContext:]):
+
 2015-10-15  Dan Bernstein  <mitz@apple.com>
 
         [Cocoa] Stop using WKSetNSURLConnectionDefersCallbacks
index 141c1b1..98a7a5b 100644 (file)
@@ -50,7 +50,6 @@ void InitWebCoreSystemInterface(void)
     INIT(CGContextGetShouldSmoothFonts);
 #endif
     INIT(CGPatternCreateWithImageAndTransform);
-    INIT(CGContextResetClip);
 #if !PLATFORM(IOS)
     INIT(CGContextDrawsWithCorrectShadowOffsets);
 #endif
@@ -84,7 +83,6 @@ void InitWebCoreSystemInterface(void)
     INIT(WindowSetScaledFrame);
     INIT(SetCGFontRenderingMode);
 #endif
-    INIT(SetBaseCTM);
     INIT(SetCONNECTProxyAuthorizationForStream);
     INIT(SetCONNECTProxyForStream);
 #if !PLATFORM(IOS)
index 877dfe4..5e343f6 100644 (file)
@@ -3871,7 +3871,7 @@ static inline IMP getMethod(id o, SEL s)
 
 - (void)_setBaseCTM:(CGAffineTransform)transform forContext:(CGContextRef)context
 {
-    WKSetBaseCTM(context, transform);
+    CGContextSetBaseCTM(context, transform);
 }
 
 - (BOOL)interactiveFormValidationEnabled
index 422a1ad..e40f9d8 100644 (file)
@@ -1,3 +1,13 @@
+2015-10-15  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Migrate to CGContextSetBaseCTM() and CGContextResetClip() from WKSI
+        https://bugs.webkit.org/show_bug.cgi?id=150155
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Deleted.
+
 2015-10-15  Dean Jackson  <dino@apple.com>
 
         Fix the iOS build. And hopefully not breaking the other builds
index ac18c98..dd9897b 100644 (file)
@@ -42,7 +42,6 @@ void InitWebCoreSystemInterface(void)
         INIT(CALayerEnumerateRectsBeingDrawnWithBlock);
         INIT(CGContextGetShouldSmoothFonts);
         INIT(CGPatternCreateWithImageAndTransform);
-        INIT(CGContextResetClip);
 #if !PLATFORM(IOS)
         INIT(CGContextDrawsWithCorrectShadowOffsets);
 #endif
@@ -91,7 +90,6 @@ void InitWebCoreSystemInterface(void)
         INIT(QTClearMediaDownloadCache);
         INIT(SetCGFontRenderingMode);
 #endif
-        INIT(SetBaseCTM);
         INIT(SetCONNECTProxyAuthorizationForStream);
         INIT(SetCONNECTProxyForStream);
 #if !PLATFORM(IOS)