gdiplus: Add a registry setting to control use of software bitmaps.

Vincent Povirk vincent at codeweavers.com
Sun Sep 5 18:00:23 CDT 2010


This patch adds a registry setting, HKCU\Software\Wine\GdiPlus\SoftwareBitmaps, that controls the use of software bitmaps in gdiplus.

All the evidence suggests that native gdiplus bitmap objects are basically pointers to a memory buffer that contains the image data. This buffer may be allocated by gdiplus or supplied by the application. All drawing operations are done by reading and writing this buffer, and the application may read or write the buffer directly at any time.

In most cases, Wine's gdiplus creates bitmap objects based on gdi32 DIB objects. This usually sort of works, but it has two major problems:
* If the bitmap was created from a buffer supplied by the application, reading and writing the buffer directly has no effect.
* If the bitmap is in a format with an alpha channel, most drawing operations to the bitmap will not update the alpha channel, so the bitmap usually ends up completely transparent, and drawing to something else has no effect.

We now have the ability to create bitmaps in the way that native does (I'm choosing to call these software bitmaps), but by default we only do it when it's impossible to create a DIB (such as when creating 64-bit images). If we did it all the time, this would not help the above problems in most cases because we do not have a software implementation of most drawing operations. The exceptions are drawing a bitmap onto another bitmap and using GetDC/ReleaseDC.

Ideally, we should implement all drawing operations in software and create DIB objects only when it would be impossible for the application to tell the difference (or maybe never), but until we implement all the drawing functions this policy change would cause regressions. At the moment, I think it would create more bugs than it fixes.

However, this sort of change would make it possible to detect the above situations, so I think this setting will be useful as a debugging tool and on the off chance that it fixes some applications.

The new setting accepts the following values:
* always - Always create software bitmaps.
* asneeded - Create software bitmaps only when the failure to do so could break something (namely, when the bitmap has an alpha channel or should point to an application buffer). This is useful for debugging and should become the default when gdiplus is more capable.
* never - Only create software bitmaps when it's absolutely necessary. This is the default.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20100905/38c2aeb1/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-gdiplus-Add-a-registry-setting-to-control-use-of-softw.txt
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20100905/38c2aeb1/attachment.txt>


More information about the wine-patches mailing list