Commit 7ea59c10 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Use dithering also for 1-bpp gradients.

parent 59f347b7
......@@ -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 (y = rc->top; y < min( rc->top + 16, rc->bottom ); y++, ptr += dib->stride)
{
for (x = rc->left; x < rc->right; x++)
{
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;
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->top + 1; y < rc->bottom; y++, ptr += dib->stride)
}
for ( ; 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]);
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]);
}
}
......
......@@ -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)
{
......
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment