diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c index 47ba0e1a40b..d0d838bee74 100644 --- a/dlls/gdi32/dibdrv/primitives.c +++ b/dlls/gdi32/dibdrv/primitives.c @@ -4491,27 +4491,28 @@ static BOOL gradient_rect_1( const dib_info *dib, const RECT *rc, const TRIVERTE switch (mode) { case GRADIENT_FILL_RECT_H: - for (x = rc->left; x < rc->right; x++) + for (y = rc->top; y < min( rc->top + 16, rc->bottom ); y++, ptr += dib->stride) { - DWORD val = gradient_rgb_24( v, x - v[0].x, v[1].x - v[0].x ); - val = rgb_to_pixel_colortable( dib, val >> 16, val >> 8, val ) ? 0xff : 0; - ptr[x / 8] = (ptr[x / 8] & ~pixel_masks_1[x % 8]) | (val & pixel_masks_1[x % 8]); - } - - for (y = rc->top + 1; y < rc->bottom; y++, ptr += dib->stride) for (x = rc->left; x < rc->right; x++) - ptr[dib->stride + x / 8] = (ptr[dib->stride + x / 8] & ~pixel_masks_1[x % 8]) | - (ptr[x / 8] & pixel_masks_1[x % 8]); + { + BYTE val = gradient_rgb_8( dib, v, x - v[0].x, v[1].x - v[0].x, x, y ) ? 0xff : 0; + ptr[x / 8] = (ptr[x / 8] & ~pixel_masks_1[x % 8]) | (val & pixel_masks_1[x % 8]); + } + } + for ( ; y < rc->bottom; y++, ptr += dib->stride) + for (x = rc->left; x < rc->right; x++) + ptr[x / 8] = (ptr[x / 8] & ~pixel_masks_1[x % 8]) | + (ptr[x / 8 - 16 * dib->stride] & pixel_masks_1[x % 8]); break; case GRADIENT_FILL_RECT_V: - for (y = rc->top; y < rc->bottom; y++) + for (y = rc->top; y < rc->bottom; y++, ptr += dib->stride) { - DWORD val = gradient_rgb_24( v, y - v[0].y, v[1].y - v[0].y ); - val = rgb_to_pixel_colortable( dib, val >> 16, val >> 8, val ) ? 0xff : 0; + BYTE values[16]; + for (x = 0; x < 16; x++) + values[x] = gradient_rgb_8( dib, v, y - v[0].y, v[1].y - v[0].y, x, y ) ? 0xff : 0; for (x = rc->left; x < rc->right; x++) - ptr[x / 8] = (ptr[x / 8] & ~pixel_masks_1[x % 8]) | (val & pixel_masks_1[x % 8]); - ptr += dib->stride; + ptr[x / 8] = (ptr[x / 8] & ~pixel_masks_1[x % 8]) | (values[x % 16] & pixel_masks_1[x % 8]); } break; @@ -4522,8 +4523,7 @@ static BOOL gradient_rect_1( const dib_info *dib, const RECT *rc, const TRIVERTE triangle_coords( v, rc, y, &left, &right ); for (x = left; x < right; x++) { - DWORD val = gradient_triangle_24( v, x, y, det ); - val = rgb_to_pixel_colortable( dib, val >> 16, val >> 8, val ) ? 0xff : 0; + BYTE val = gradient_triangle_8( dib, v, x, y, det ) ? 0xff : 0; ptr[x / 8] = (ptr[x / 8] & ~pixel_masks_1[x % 8]) | (val & pixel_masks_1[x % 8]); } } diff --git a/dlls/winex11.drv/graphics.c b/dlls/winex11.drv/graphics.c index 88e9b0cdcf2..f2cf037cb11 100644 --- a/dlls/winex11.drv/graphics.c +++ b/dlls/winex11.drv/graphics.c @@ -1506,8 +1506,8 @@ BOOL X11DRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, unsigned int i; XGCValues val; - /* 4, 8, and 16-bpp use dithering */ - if (physdev->depth >= 4 && physdev->depth <= 16) goto fallback; + /* <= 16-bpp use dithering */ + if (physdev->depth <= 16) goto fallback; switch (mode) { diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index bccbe4d4934..3853cd8172d 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -2543,8 +2543,8 @@ static BOOL xrenderdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG n if (!X11DRV_XRender_Installed) goto fallback; if (!pXRenderCreateLinearGradient) goto fallback; - /* 16-bpp uses dithering */ - if (!physdev->pict_format || physdev->pict_format->depth == 16) goto fallback; + /* <= 16-bpp uses dithering */ + if (!physdev->pict_format || physdev->pict_format->depth <= 16) goto fallback; switch (mode) {