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

Dmitry Timoshkov dmitry at baikal.ru
Thu May 19 05:06:17 CDT 2022


Nikolay Sivov <nsivov at codeweavers.com> wrote:

> On 5/19/22 12:16, Dmitry Timoshkov wrote:
> > Nikolay Sivov <nsivov at codeweavers.com> wrote:
> >
> >> On 5/19/22 11:56, Dmitry Timoshkov 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.
> >> Command lists and effects outputs are also ID2D1Image, so it's not
> >> always a bitmap.
> > Thanks for pointing that out. Currently images that are not bitmaps can't
> > work as brushes anyway, Henri already explaned that in response to original
> > version of my patch. If anything besides bitmaps is supposed to be supported
> > by ID2D1Device::CreateImageBrush() that needs quite a bit of work. For now
> > accepting only bitmaps seems a fair limitation, and in fact that makes the app
> > that I have here happy.
> >
> I'm not asking to make command lists and effects work before the bitmap 
> image. But this change is backwards, if anything we could implement 
> existing bitmap brush as an image brush with a bitmap.

You are right. That's my fault, since I failed to consider initially simply
adding a new brush vtable (that you pointed out in the first review) and using
existing BITMAP_TYPE for the brush. Merging existing bitmap brush implementation
with an image brush seems impossible due to different vtable layouts.

> Checking image type on creation is likely insufficient, because you can 
> do SetImage() later.

That's a good point, SetImage also needs to fixed in that regard.

> Also extend and interpolation modes will be ignored.

That's also a fair point.

Supporting only bitmaps from the very start would be more correct, again,
that's my fault since I didn't know the consequences of introducing new brush
type.

-- 
Dmitry.



More information about the wine-devel mailing list