RESOLVED FIXED 163668
[Win][Direct2D] Implement ImageBufferData::getData.
https://bugs.webkit.org/show_bug.cgi?id=163668
Summary [Win][Direct2D] Implement ImageBufferData::getData.
Per Arne Vollan
Reported 2016-10-19 10:11:04 PDT
This method is not yet implemented for Direct2D.
Attachments
Patch (4.32 KB, patch)
2016-10-19 10:14 PDT, Per Arne Vollan
bfulgham: review+
bfulgham: commit-queue-
Per Arne Vollan
Comment 1 2016-10-19 10:14:20 PDT
WebKit Commit Bot
Comment 2 2016-10-19 10:15:21 PDT
Attachment 292078 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp:78: Use the class HWndDC instead of calling GetDC to avoid potential memory leaks. [runtime/leaky_pattern] [5] Total errors found: 1 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brent Fulgham
Comment 3 2016-10-19 10:38:32 PDT
Comment on attachment 292078 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=292078&action=review Thanks for getting this to work! I had a few minor comments I'd like you to address when landing. > Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp:50 > + area *= rect.height(); You should use the "area()" method: area = 4 * rect.area(); > Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp:71 > + hr = platformContext->QueryInterface(__uuidof(ID2D1GdiInteropRenderTarget), (void**)&gdiRenderTarget); I think we should retain this in the GraphicsContextPlatformPrivate, since there will be other times we want to get a GDI HBITMAP or similar out of our D2D context. You can do this as a separate patch. > Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp:89 > + memcpy(result->data(), pixels, 4 * rect.width() * rect.height()); Can we avoid this extra copy by somehow using result->data() as the pixel source?
Per Arne Vollan
Comment 4 2016-10-20 01:50:04 PDT
(In reply to comment #3) > Comment on attachment 292078 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=292078&action=review > > Thanks for getting this to work! I had a few minor comments I'd like you to > address when landing. > > > Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp:50 > > + area *= rect.height(); > > You should use the "area()" method: area = 4 * rect.area(); > > > Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp:71 > > + hr = platformContext->QueryInterface(__uuidof(ID2D1GdiInteropRenderTarget), (void**)&gdiRenderTarget); > > I think we should retain this in the GraphicsContextPlatformPrivate, since > there will be other times we want to get a GDI HBITMAP or similar out of our > D2D context. > > You can do this as a separate patch. > > > Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp:89 > > + memcpy(result->data(), pixels, 4 * rect.width() * rect.height()); > > Can we avoid this extra copy by somehow using result->data() as the pixel > source? I haven't found a way to do this yet, since the system is allocating the bitmap pixel data for us. Thanks for reviewing!
Per Arne Vollan
Comment 5 2016-10-20 02:09:14 PDT
Note You need to log in before you can comment on or make changes to this bug.