gdi32: Forward the null driver PutImage to the DIB driver since the bits are in DIB format.
This commit is contained in:
parent
bff79eb2b9
commit
6f066ec18a
|
@ -88,73 +88,23 @@ DWORD nulldrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *inf
|
||||||
BITMAPOBJ *bmp;
|
BITMAPOBJ *bmp;
|
||||||
|
|
||||||
if (!hbitmap) return ERROR_SUCCESS;
|
if (!hbitmap) return ERROR_SUCCESS;
|
||||||
if (!(bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ))) return ERROR_INVALID_HANDLE;
|
|
||||||
|
|
||||||
if (info->bmiHeader.biPlanes != 1) goto update_format;
|
|
||||||
if (info->bmiHeader.biBitCount != bmp->bitmap.bmBitsPixel) goto update_format;
|
|
||||||
/* FIXME: check color masks */
|
|
||||||
|
|
||||||
if (bits)
|
if (bits)
|
||||||
{
|
{
|
||||||
int i, width_bytes = get_dib_stride( info->bmiHeader.biWidth, info->bmiHeader.biBitCount );
|
if (!(bmp = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ))) return ERROR_INVALID_HANDLE;
|
||||||
unsigned char *dst_bits, *src_bits;
|
if (!bmp->bitmap.bmBits)
|
||||||
|
|
||||||
if ((src->width != dst->width) || (src->height != dst->height))
|
|
||||||
{
|
{
|
||||||
GDI_ReleaseObj( hbitmap );
|
int width_bytes = get_dib_stride( bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel );
|
||||||
return ERROR_TRANSFORM_NOT_SUPPORTED;
|
if (!(bmp->bitmap.bmBits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
}
|
|
||||||
if (src->visrect.left > 0 || src->visrect.right < bmp->bitmap.bmWidth ||
|
|
||||||
dst->visrect.left > 0 || dst->visrect.right < bmp->bitmap.bmWidth)
|
|
||||||
{
|
|
||||||
FIXME( "setting partial rows not supported\n" );
|
|
||||||
GDI_ReleaseObj( hbitmap );
|
|
||||||
return ERROR_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
if (clip)
|
|
||||||
{
|
|
||||||
FIXME( "clip region not supported\n" );
|
|
||||||
GDI_ReleaseObj( hbitmap );
|
|
||||||
return ERROR_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bmp->bitmap.bmBits &&
|
|
||||||
!(bmp->bitmap.bmBits = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
||||||
bmp->bitmap.bmHeight * width_bytes )))
|
bmp->bitmap.bmHeight * width_bytes )))
|
||||||
{
|
{
|
||||||
GDI_ReleaseObj( hbitmap );
|
GDI_ReleaseObj( hbitmap );
|
||||||
return ERROR_OUTOFMEMORY;
|
return ERROR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
dst_bits = (unsigned char *)bmp->bitmap.bmBits + dst->visrect.top * width_bytes;
|
|
||||||
src_bits = bits->ptr;
|
|
||||||
if (info->bmiHeader.biHeight > 0)
|
|
||||||
{
|
|
||||||
src_bits += (info->bmiHeader.biHeight - 1 - src->visrect.top) * width_bytes;
|
|
||||||
width_bytes = -width_bytes;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
src_bits += src->visrect.top * width_bytes;
|
|
||||||
|
|
||||||
if (width_bytes != bmp->bitmap.bmWidthBytes)
|
|
||||||
{
|
|
||||||
for (i = 0; i < dst->visrect.bottom - dst->visrect.top; i++)
|
|
||||||
{
|
|
||||||
memcpy( dst_bits, src_bits, bmp->bitmap.bmWidthBytes );
|
|
||||||
src_bits += width_bytes;
|
|
||||||
dst_bits += abs(width_bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else memcpy( dst_bits, src_bits, width_bytes * (dst->visrect.bottom - dst->visrect.top) );
|
|
||||||
}
|
}
|
||||||
GDI_ReleaseObj( hbitmap );
|
GDI_ReleaseObj( hbitmap );
|
||||||
return ERROR_SUCCESS;
|
}
|
||||||
|
return dib_driver.pPutImage( NULL, hbitmap, clip, info, bits, src, dst, rop );
|
||||||
update_format:
|
|
||||||
info->bmiHeader.biPlanes = 1;
|
|
||||||
info->bmiHeader.biBitCount = bmp->bitmap.bmBitsPixel;
|
|
||||||
if (info->bmiHeader.biHeight > 0) info->bmiHeader.biHeight = -info->bmiHeader.biHeight;
|
|
||||||
GDI_ReleaseObj( hbitmap );
|
|
||||||
return ERROR_BAD_FORMAT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,7 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush )
|
||||||
mr->rdParm[1] = DIB_RGB_COLORS;
|
mr->rdParm[1] = DIB_RGB_COLORS;
|
||||||
dst_info = (BITMAPINFO *)(mr->rdParm + 2);
|
dst_info = (BITMAPINFO *)(mr->rdParm + 2);
|
||||||
dst_info->bmiHeader = src_info->bmiHeader;
|
dst_info->bmiHeader = src_info->bmiHeader;
|
||||||
|
dst_info->bmiHeader.biClrUsed = 0;
|
||||||
cref = GetTextColor( dev->hdc );
|
cref = GetTextColor( dev->hdc );
|
||||||
dst_info->bmiColors[0].rgbRed = GetRValue(cref);
|
dst_info->bmiColors[0].rgbRed = GetRValue(cref);
|
||||||
dst_info->bmiColors[0].rgbGreen = GetGValue(cref);
|
dst_info->bmiColors[0].rgbGreen = GetGValue(cref);
|
||||||
|
|
Loading…
Reference in New Issue