Nikolay Sivov nsivov@codeweavers.com wrote:
On 5/29/22 12:03, Dmitry Timoshkov wrote:
Nikolay Sivov nsivov@codeweavers.com wrote:
I started by extending tests from patch 3/3, and I'm curious now how does your application create such bitmap?
Is it just ID2D1DeviceContext::CreateBitmap(D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ), or something more complicated?
How is this bitmap used later? Is it set to an image brush, and then used for fills?
The application first creates a bitmap with D2D1_BITMAP_OPTIONS_TARGET, then creates an image brush from it. Then the app creates another bitmap with D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ, copies contents from original bitmap with ::CopyFromBitmap() and then ::Map()s it with D2D1_MAP_OPTIONS_READ.
I see, makes sense. Please test with attached patches to see if this path still works. Turns out there is no need to create a temporary resource.
Attached patches seem to work, Unmap() helper could be inlined though. Probably I should also note, that the patch to make an image brush work for bitmaps is still required for correct painting in my application.
Thanks for keeping working on this.