Title: [261071] trunk/Source
Revision
261071
Author
[email protected]
Date
2020-05-03 21:14:51 -0700 (Sun, 03 May 2020)

Log Message

Use LocalCurrentGraphicsContext in WebKit::convertPlatformImageToBitmap()
<https://webkit.org/b/211274>

Reviewed by Darin Adler.

Source/WebCore:

* platform/mac/LocalCurrentGraphicsContext.h:
(WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext):
(WebCore::LocalCurrentGraphicsContext::~LocalCurrentGraphicsContext):
- Export methods for use in WebKit.

Source/WebKit:

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::convertPlatformImageToBitmap):
- Use LocalCurrentGraphicsContext to replace code.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261070 => 261071)


--- trunk/Source/WebCore/ChangeLog	2020-05-04 03:42:02 UTC (rev 261070)
+++ trunk/Source/WebCore/ChangeLog	2020-05-04 04:14:51 UTC (rev 261071)
@@ -1,5 +1,17 @@
 2020-05-03  David Kilzer  <[email protected]>
 
+        Use LocalCurrentGraphicsContext in WebKit::convertPlatformImageToBitmap()
+        <https://webkit.org/b/211274>
+
+        Reviewed by Darin Adler.
+
+        * platform/mac/LocalCurrentGraphicsContext.h:
+        (WebCore::LocalCurrentGraphicsContext::LocalCurrentGraphicsContext):
+        (WebCore::LocalCurrentGraphicsContext::~LocalCurrentGraphicsContext):
+        - Export methods for use in WebKit.
+
+2020-05-03  David Kilzer  <[email protected]>
+
         Fix static analyzer false positive in -[WebUndefined undefined]
         <https://webkit.org/b/211353>
 

Modified: trunk/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h (261070 => 261071)


--- trunk/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h	2020-05-04 03:42:02 UTC (rev 261070)
+++ trunk/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h	2020-05-04 04:14:51 UTC (rev 261071)
@@ -33,8 +33,8 @@
 class LocalCurrentGraphicsContext {
     WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext);
 public:
-    LocalCurrentGraphicsContext(GraphicsContext&);
-    ~LocalCurrentGraphicsContext();
+    WEBCORE_EXPORT LocalCurrentGraphicsContext(GraphicsContext&);
+    WEBCORE_EXPORT ~LocalCurrentGraphicsContext();
     CGContextRef cgContext();
 private:
     GraphicsContext& m_savedGraphicsContext;

Modified: trunk/Source/WebKit/ChangeLog (261070 => 261071)


--- trunk/Source/WebKit/ChangeLog	2020-05-04 03:42:02 UTC (rev 261070)
+++ trunk/Source/WebKit/ChangeLog	2020-05-04 04:14:51 UTC (rev 261071)
@@ -1,5 +1,16 @@
 2020-05-03  David Kilzer  <[email protected]>
 
+        Use LocalCurrentGraphicsContext in WebKit::convertPlatformImageToBitmap()
+        <https://webkit.org/b/211274>
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (WebKit::convertPlatformImageToBitmap):
+        - Use LocalCurrentGraphicsContext to replace code.
+
+2020-05-03  David Kilzer  <[email protected]>
+
         Use default initializers and default constructors in WebEvent.h
         <https://webkit.org/b/211354>
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (261070 => 261071)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2020-05-04 03:42:02 UTC (rev 261070)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2020-05-04 04:14:51 UTC (rev 261071)
@@ -400,17 +400,14 @@
     auto graphicsContext = bitmap->createGraphicsContext();
     if (!graphicsContext)
         return nullptr;
+
 #if PLATFORM(IOS_FAMILY)
     UIGraphicsPushContext(graphicsContext->platformContext());
     [image drawInRect:CGRectMake(0, 0, bitmap->size().width(), bitmap->size().height())];
     UIGraphicsPopContext();
-#elif PLATFORM(MAC)
-    auto savedContext = retainPtr([NSGraphicsContext currentContext]);
-
-    [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:graphicsContext->platformContext() flipped:YES]];
+#elif USE(APPKIT)
+    LocalCurrentGraphicsContext savedContext(*graphicsContext);
     [image drawInRect:NSMakeRect(0, 0, bitmap->size().width(), bitmap->size().height()) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1 respectFlipped:YES hints:nil];
-
-    [NSGraphicsContext setCurrentContext:savedContext.get()];
 #endif
     return bitmap;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to