Title: [273971] trunk/Source/WebCore
Revision
273971
Author
[email protected]
Date
2021-03-05 08:20:06 -0800 (Fri, 05 Mar 2021)

Log Message

Unreviewed Windows build fix after r273966.

* platform/win/DragImageCGWin.cpp:
(WebCore::scaleDragImage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273970 => 273971)


--- trunk/Source/WebCore/ChangeLog	2021-03-05 16:15:08 UTC (rev 273970)
+++ trunk/Source/WebCore/ChangeLog	2021-03-05 16:20:06 UTC (rev 273971)
@@ -1,3 +1,10 @@
+2021-03-05  Chris Dumez  <[email protected]>
+
+        Unreviewed Windows build fix after r273966.
+
+        * platform/win/DragImageCGWin.cpp:
+        (WebCore::scaleDragImage):
+
 2021-03-05  ChangSeok Oh  <[email protected]>
 
         AVIF decoding support

Modified: trunk/Source/WebCore/platform/win/DragImageCGWin.cpp (273970 => 273971)


--- trunk/Source/WebCore/platform/win/DragImageCGWin.cpp	2021-03-05 16:15:08 UTC (rev 273970)
+++ trunk/Source/WebCore/platform/win/DragImageCGWin.cpp	2021-03-05 16:20:06 UTC (rev 273971)
@@ -86,6 +86,12 @@
     GDIObject<HBITMAP> hbmp;
     auto image = adoptGDIObject(imageRef);
 
+    auto returnHbmp = [&hbmp, &image] {
+        if (!hbmp)
+            hbmp.swap(image);
+        return hbmp.leak();
+    };
+
     IntSize srcSize = dragImageSize(image.get());
     IntSize dstSize(static_cast<int>(srcSize.width() * scale.width()), static_cast<int>(srcSize.height() * scale.height()));
 
@@ -92,12 +98,12 @@
     HWndDC dc(0);
     auto dstDC = adoptGDIObject(::CreateCompatibleDC(dc));
     if (!dstDC)
-        goto exit;
+        return returnHbmp();
 
     CGContextRef targetContext;
     hbmp = allocImage(dstDC.get(), dstSize, &targetContext);
     if (!hbmp)
-        goto exit;
+        return returnHbmp();
 
     auto srcContext = createCgContextFromBitmap(image.get());
     auto srcImage = adoptCF(CGBitmapContextCreateImage(srcContext.get()));
@@ -108,10 +114,7 @@
     CGContextDrawImage(targetContext, rect, srcImage.get());
     CGContextRelease(targetContext);
 
-exit:
-    if (!hbmp)
-        hbmp.swap(image);
-    return hbmp.leak();
+    return returnHbmp();
 }
     
 DragImageRef createDragImageFromImage(Image* img, ImageOrientation)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to