[PATCH v3] d2d1: Make ID2D1Device::CreateImageBrush() accept only bitmap as a source image.

Dmitry Timoshkov dmitry at baikal.ru
Fri Jun 3 07:40:47 CDT 2022


Nikolay Sivov <nsivov at codeweavers.com> wrote:

> On 5/26/22 17:36, Dmitry Timoshkov wrote:
> > Nikolay Sivov <nsivov at codeweavers.com> wrote:
> >
> >> On 5/26/22 17:15, Dmitry Timoshkov wrote:
> >>> Nikolay Sivov <nsivov at codeweavers.com> wrote:
> >>>
> >>>> On 5/26/22 14:34, Dmitry Timoshkov wrote:
> >>>>> Nikolay Sivov <nsivov at codeweavers.com> wrote:
> >>>>>
> >>>>>> On 5/25/22 18:58, Dmitry Timoshkov wrote:
> >>>>>>> Dmitry Timoshkov <dmitry at baikal.ru> wrote:
> >>>>>>>
> >>>>>>>> ID2D1Bitmap derives from ID2D1Image, which in turn derives from ID2D1Resource.
> >>>>>>>> That means that ID2D1Device::CreateImageBrush() can't be really passed anything
> >>>>>>>> but a ID2D1Bitmap* represented as a ID2D1Image*.
> >>>>>>>>
> >>>>>>>> I've added QueryInterface+FIXME just in case, probably it could be dropped.
> >>>>>>>>
> >>>>>>>> v2: Fix test crashes with image == NULL.
> >>>>>>>> v3: Add a QueryInterface() check to SetImage().
> >>>>>>> Is there anything that could be improved in this patch to make it acceptable?
> >>>>>>> Probably I should add once again, that this patch allows a bitmap work as an
> >>>>>>> image brush (unlike current broken state) and actually makes work the app that
> >>>>>>> have here.
> >>>>>>>
> >>>>>> Same thing I mention last time - it's backwards. Bitmap brush could
> >>>>>> probably be implemented as image brush, but not the other way. I don't
> >>>>>> think you'll need any shader changes for that.
> >>>>> Do you mean something like the attached patch, or do I miss something?
> >>>>> With the attached patch (on top of just sent ::Map()/::Unmap() patches)
> >>>>> I get areas filled with black in the application that I'm working on,
> >>>>> unlike with the proposed patch where I get correctly filled areas with
> >>>>> a proper brush.
> >>>>>
> >>>> I suspect black color is from this in sample_brush():
> >>>>
> >>>> return float4(0.0, 0.0, 0.0, brush.opacity);
> >>>>
> >>>> Which means you didn't set brush type correctly in the constant buffer.
> >>> I also think that's the source of the problem. However that's the shader
> >>> code, and you mentioned above that I don't need them to make image brush
> >>> work. Or did I misunderstand something? Do you have a suggestion for that?
> >>>
> >> Brush type is set in d2d_brush_fill_cb(), trying setting it "correctly"
> >> to bitmap brush type.
> > Thank you very much, setting cb->type to TYPE_BITMAP in the TYPE_IMAGE case
> > has fixed painting in my application. Do you think that the patch I attached
> > in my previous reply with this fix is an acceptable solution, or there are
> > other things you'd like to see addressed?
> >
> I think we should avoid duplication of bind_bitmap() function, since 
> it's exactly the same. Probably passing image brush description there, 
> which could be filled from bitmap brush description, expect for source 
> rectangle.

Thanks for the helpful pointers. Does the attached patch match your suggestions?
The patch works prety well with the application that I have here.

-- 
Dmitry.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-d2d1-Add-support-for-painting-image-brush-as-a-bitma.patch
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20220603/3b70f5f8/attachment.ksh>


More information about the wine-devel mailing list