gdi32: Allow a caller to build_rle_bitmap to not request the clip region.
This commit is contained in:
parent
8f4fab2483
commit
2127e9444d
|
@ -252,14 +252,19 @@ static BOOL build_rle_bitmap( const BITMAPINFO *info, struct gdi_image_bits *bit
|
||||||
BYTE skip, num, data;
|
BYTE skip, num, data;
|
||||||
BYTE *out_bits, *in_bits = bits->ptr;
|
BYTE *out_bits, *in_bits = bits->ptr;
|
||||||
|
|
||||||
*clip = NULL;
|
if (clip) *clip = NULL;
|
||||||
|
|
||||||
assert( info->bmiHeader.biBitCount == 4 || info->bmiHeader.biBitCount == 8 );
|
assert( info->bmiHeader.biBitCount == 4 || info->bmiHeader.biBitCount == 8 );
|
||||||
|
|
||||||
out_bits = HeapAlloc( GetProcessHeap(), 0, get_dib_image_size( info ) );
|
out_bits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, get_dib_image_size( info ) );
|
||||||
|
if (!out_bits) goto fail;
|
||||||
|
|
||||||
|
if (clip)
|
||||||
|
{
|
||||||
*clip = CreateRectRgn( 0, 0, 0, 0 );
|
*clip = CreateRectRgn( 0, 0, 0, 0 );
|
||||||
run = CreateRectRgn( 0, 0, 0, 0 );
|
run = CreateRectRgn( 0, 0, 0, 0 );
|
||||||
if (!out_bits || !*clip || !run) goto fail;
|
if (!*clip || !run) goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
x = left = right = 0;
|
x = left = right = 0;
|
||||||
y = height - 1;
|
y = height - 1;
|
||||||
|
@ -299,7 +304,7 @@ static BOOL build_rle_bitmap( const BITMAPINFO *info, struct gdi_image_bits *bit
|
||||||
{
|
{
|
||||||
if (data < 3)
|
if (data < 3)
|
||||||
{
|
{
|
||||||
if(left != right)
|
if(left != right && clip)
|
||||||
{
|
{
|
||||||
SetRectRgn( run, left, y, right, y + 1 );
|
SetRectRgn( run, left, y, right, y + 1 );
|
||||||
CombineRgn( *clip, run, *clip, RGN_OR );
|
CombineRgn( *clip, run, *clip, RGN_OR );
|
||||||
|
@ -365,7 +370,7 @@ static BOOL build_rle_bitmap( const BITMAPINFO *info, struct gdi_image_bits *bit
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
DeleteObject( run );
|
if (run) DeleteObject( run );
|
||||||
if (bits->free) bits->free( bits );
|
if (bits->free) bits->free( bits );
|
||||||
|
|
||||||
bits->ptr = out_bits;
|
bits->ptr = out_bits;
|
||||||
|
@ -376,7 +381,7 @@ done:
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (run) DeleteObject( run );
|
if (run) DeleteObject( run );
|
||||||
if (*clip) DeleteObject( *clip );
|
if (clip && *clip) DeleteObject( *clip );
|
||||||
HeapFree( GetProcessHeap(), 0, out_bits );
|
HeapFree( GetProcessHeap(), 0, out_bits );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue