Title: [208013] trunk/Source/WebCore
- Revision
- 208013
- Author
- [email protected]
- Date
- 2016-10-27 15:37:21 -0700 (Thu, 27 Oct 2016)
Log Message
[Win][Direct2D] Implement GraphicsContext::releaseWindowsContext.
https://bugs.webkit.org/show_bug.cgi?id=163988
Reviewed by Brent Fulgham.
This method is needed to draw native controls.
* platform/graphics/win/GraphicsContextDirect2D.cpp:
(WebCore::GraphicsContext::releaseWindowsContext):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (208012 => 208013)
--- trunk/Source/WebCore/ChangeLog 2016-10-27 22:25:24 UTC (rev 208012)
+++ trunk/Source/WebCore/ChangeLog 2016-10-27 22:37:21 UTC (rev 208013)
@@ -1,3 +1,15 @@
+2016-10-27 Per Arne Vollan <[email protected]>
+
+ [Win][Direct2D] Implement GraphicsContext::releaseWindowsContext.
+ https://bugs.webkit.org/show_bug.cgi?id=163988
+
+ Reviewed by Brent Fulgham.
+
+ This method is needed to draw native controls.
+
+ * platform/graphics/win/GraphicsContextDirect2D.cpp:
+ (WebCore::GraphicsContext::releaseWindowsContext):
+
2016-10-27 Joseph Pecoraro <[email protected]>
Web Inspector: Worker should recover if Inspector is closed and never sent Worker.initialized command
Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp (208012 => 208013)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp 2016-10-27 22:25:24 UTC (rev 208012)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp 2016-10-27 22:37:21 UTC (rev 208013)
@@ -257,6 +257,35 @@
void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap)
{
+ bool createdBitmap = mayCreateBitmap && (!m_data->m_hdc || isInTransparencyLayer());
+ if (!createdBitmap) {
+ m_data->restore();
+ return;
+ }
+
+ if (!hdc || dstRect.isEmpty())
+ return;
+
+ auto sourceBitmap = adoptGDIObject(static_cast<HBITMAP>(::GetCurrentObject(hdc, OBJ_BITMAP)));
+
+ DIBPixelData pixelData(sourceBitmap.get());
+ ASSERT(pixelData.bitsPerPixel() == 32);
+
+ auto bitmapProperties = D2D1::BitmapProperties(D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE));
+
+ COMPtr<ID2D1Bitmap> bitmap;
+ HRESULT hr = platformContext()->CreateBitmap(pixelData.size(), pixelData.buffer(), pixelData.bytesPerRow(), &bitmapProperties, &bitmap);
+ ASSERT(SUCCEEDED(hr));
+
+ if (!didBeginDraw())
+ platformContext()->BeginDraw();
+
+ platformContext()->DrawBitmap(bitmap.get(), dstRect);
+
+ if (!didBeginDraw())
+ hr = platformContext()->EndDraw();
+
+ ::DeleteDC(hdc);
}
void GraphicsContext::drawWindowsBitmap(WindowsBitmap* image, const IntPoint& point)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes