[PATCH] uxtheme: Support images in GetThemeBackgroundRegion. (try 2)
Alexandre Julliard
julliard at winehq.org
Tue Mar 3 03:18:30 CST 2015
Mark Harmstone <hellas at burntcomma.com> writes:
> + /* loop through the image looking for transparent pixels,
> + * grouping together horizontal runs into one rect */
> + ptr = bits;
> + for (y = 0; y < r.bottom; y++) {
> + BOOL trans = FALSE;
> + int transstart;
> +
> + for (x = 0; x < r.right; x++) {
> + COLORREF colour = ptr[2] << 16 | ptr[1] << 8 | ptr[0];
> + ptr += 4;
> +
> + if (colour == transcolour) {
> + if (!trans) {
> + transstart = x;
> + trans = TRUE;
> + }
> + } else if (trans) {
> + rgntemp = CreateRectRgn(transstart, y, x, y+1);
> + CombineRgn(hrgn, hrgn, rgntemp, RGN_DIFF);
> + DeleteObject(rgntemp);
> + trans = FALSE;
> + }
> + }
> +
> + if (trans) {
> + rgntemp = CreateRectRgn(transstart, y, r.right, y+1);
> + CombineRgn(hrgn, hrgn, rgntemp, RGN_DIFF);
> + DeleteObject(rgntemp);
> + }
> + }
That's going to be pretty slow. There's a better implementation in
winex11.drv:update_surface_region(), you could just copy that.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list