winex11: Get rid of the SetDIBitsToDevice implementation.
This commit is contained in:
parent
6f275874f3
commit
3a260497be
|
@ -929,7 +929,12 @@ static void test_dib_formats(void)
|
|||
"SetDIBits succeeded for %u/%u/%u\n", bpp, planes, compr );
|
||||
ret = SetDIBitsToDevice( memdc, 0, 0, 1, 1, 0, 0, 0, 1, data, bi, DIB_RGB_COLORS );
|
||||
if (expect_ok)
|
||||
{
|
||||
if (todo)
|
||||
todo_wine ok( ret, "SetDIBitsToDevice failed for %u/%u/%u\n", bpp, planes, compr );
|
||||
else
|
||||
ok( ret, "SetDIBitsToDevice failed for %u/%u/%u\n", bpp, planes, compr );
|
||||
}
|
||||
else
|
||||
ok( !ret ||
|
||||
broken((bpp == 4 && compr == BI_RLE4) || (bpp == 8 && compr == BI_RLE8)), /* nt4 */
|
||||
|
@ -978,7 +983,12 @@ static void test_dib_formats(void)
|
|||
ok( !ret, "SetDIBits succeeded for %u/%u/%u\n", bpp, planes, compr );
|
||||
ret = SetDIBitsToDevice( memdc, 0, 0, 1, 1, 0, 0, 0, 1, data, bi, DIB_RGB_COLORS );
|
||||
if (expect_ok)
|
||||
{
|
||||
if (todo)
|
||||
todo_wine ok( ret, "SetDIBitsToDevice failed for %u/%u/%u\n", bpp, planes, compr );
|
||||
else
|
||||
ok( ret, "SetDIBitsToDevice failed for %u/%u/%u\n", bpp, planes, compr );
|
||||
}
|
||||
else
|
||||
ok( !ret, "SetDIBitsToDevice succeeded for %u/%u/%u\n", bpp, planes, compr );
|
||||
ret = StretchDIBits( memdc, 0, 0, 1, 1, 0, 0, 1, 1, data, bi, DIB_RGB_COLORS, SRCCOPY );
|
||||
|
@ -1023,7 +1033,7 @@ static void test_dib_formats(void)
|
|||
ok( hdib != NULL, "CreateDIBitmap failed with null bitfields\n" );
|
||||
DeleteObject( hdib );
|
||||
ret = SetDIBitsToDevice( memdc, 0, 0, 1, 1, 0, 0, 0, 1, data, bi, DIB_RGB_COLORS );
|
||||
ok( ret, "SetDIBitsToDevice failed with null bitfields\n" );
|
||||
todo_wine ok( ret, "SetDIBitsToDevice failed with null bitfields\n" );
|
||||
ret = StretchDIBits( memdc, 0, 0, 1, 1, 0, 0, 1, 1, data, bi, DIB_RGB_COLORS, SRCCOPY );
|
||||
todo_wine ok( ret, "StretchDIBits failed with null bitfields\n" );
|
||||
ret = GetDIBits(hdc, hbmp, 0, 2, data, bi, DIB_RGB_COLORS);
|
||||
|
|
|
@ -3713,141 +3713,6 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
|
|||
return lines;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* X11DRV_SetDIBitsToDevice
|
||||
*
|
||||
*/
|
||||
INT X11DRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDest, DWORD cx, DWORD cy,
|
||||
INT xSrc, INT ySrc, UINT startscan, UINT lines, LPCVOID bits,
|
||||
BITMAPINFO *info, UINT coloruse )
|
||||
{
|
||||
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
|
||||
X11DRV_DIB_IMAGEBITS_DESCR descr;
|
||||
INT result;
|
||||
LONG height;
|
||||
BOOL top_down;
|
||||
POINT pt;
|
||||
int rop = X11DRV_XROPfunction[GetROP2(dev->hdc) - 1];
|
||||
|
||||
top_down = (info->bmiHeader.biHeight < 0);
|
||||
height = abs( info->bmiHeader.biHeight );
|
||||
descr.infoBpp = info->bmiHeader.biBitCount;
|
||||
descr.compression = info->bmiHeader.biCompression;
|
||||
|
||||
pt.x = xDest;
|
||||
pt.y = yDest;
|
||||
LPtoDP(dev->hdc, &pt, 1);
|
||||
if (GetLayout( dev->hdc ) & LAYOUT_RTL) pt.x -= cx - 1;
|
||||
|
||||
if (!lines || (startscan >= height)) return 0;
|
||||
if (!top_down && startscan + lines > height) lines = height - startscan;
|
||||
|
||||
/* make xSrc,ySrc point to the upper-left corner, not the lower-left one,
|
||||
* and clamp all values to fit inside [startscan,startscan+lines]
|
||||
*/
|
||||
if (ySrc + cy <= startscan + lines)
|
||||
{
|
||||
UINT y = startscan + lines - (ySrc + cy);
|
||||
if (ySrc < startscan) cy -= (startscan - ySrc);
|
||||
if (!top_down)
|
||||
{
|
||||
/* avoid getting unnecessary lines */
|
||||
ySrc = 0;
|
||||
if (y >= lines) return 0;
|
||||
lines -= y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (y >= lines) return lines;
|
||||
ySrc = y; /* need to get all lines in top down mode */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ySrc >= startscan + lines) return 0;
|
||||
pt.y += ySrc + cy - (startscan + lines);
|
||||
cy = startscan + lines - ySrc;
|
||||
ySrc = 0;
|
||||
if (cy > lines) cy = lines;
|
||||
}
|
||||
if (xSrc >= info->bmiHeader.biWidth) return lines;
|
||||
if (xSrc + cx <= 0) return lines;
|
||||
if (xSrc + cx >= info->bmiHeader.biWidth) cx = info->bmiHeader.biWidth - xSrc;
|
||||
if (xSrc < 0)
|
||||
{
|
||||
pt.x -= xSrc;
|
||||
cx += xSrc;
|
||||
xSrc = 0;
|
||||
}
|
||||
if (!cx || !cy) return lines;
|
||||
|
||||
/* Update the pixmap from the DIB section */
|
||||
X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod);
|
||||
|
||||
X11DRV_SetupGCForText( physDev ); /* To have the correct colors */
|
||||
wine_tsx11_lock();
|
||||
XSetFunction(gdi_display, physDev->gc, rop);
|
||||
wine_tsx11_unlock();
|
||||
|
||||
switch (descr.infoBpp)
|
||||
{
|
||||
case 1:
|
||||
case 4:
|
||||
case 8:
|
||||
descr.colorMap = (RGBQUAD *)X11DRV_DIB_BuildColorMap(
|
||||
physDev, coloruse,
|
||||
physDev->depth, info, &descr.nColorMap );
|
||||
if (!descr.colorMap) return 0;
|
||||
descr.rMask = descr.gMask = descr.bMask = 0;
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
descr.rMask = (descr.compression == BI_BITFIELDS) ? *(const DWORD *)info->bmiColors : 0x7c00;
|
||||
descr.gMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)info->bmiColors + 1) : 0x03e0;
|
||||
descr.bMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)info->bmiColors + 2) : 0x001f;
|
||||
descr.colorMap = 0;
|
||||
break;
|
||||
|
||||
case 24:
|
||||
case 32:
|
||||
descr.rMask = (descr.compression == BI_BITFIELDS) ? *(const DWORD *)info->bmiColors : 0xff0000;
|
||||
descr.gMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)info->bmiColors + 1) : 0x00ff00;
|
||||
descr.bMask = (descr.compression == BI_BITFIELDS) ? *((const DWORD *)info->bmiColors + 2) : 0x0000ff;
|
||||
descr.colorMap = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
descr.physDev = physDev;
|
||||
descr.bits = bits;
|
||||
descr.image = NULL;
|
||||
descr.palentry = NULL;
|
||||
descr.lines = top_down ? -lines : lines;
|
||||
descr.infoWidth = info->bmiHeader.biWidth;
|
||||
descr.depth = physDev->depth;
|
||||
descr.shifts = physDev->color_shifts;
|
||||
descr.drawable = physDev->drawable;
|
||||
descr.gc = physDev->gc;
|
||||
descr.xSrc = xSrc;
|
||||
descr.ySrc = ySrc;
|
||||
descr.xDest = physDev->dc_rect.left + pt.x;
|
||||
descr.yDest = physDev->dc_rect.top + pt.y;
|
||||
descr.width = cx;
|
||||
descr.height = cy;
|
||||
descr.shm_mode = X11DRV_SHM_NONE;
|
||||
descr.dibpitch = X11DRV_DIB_GetDIBWidthBytes( info->bmiHeader.biWidth, info->bmiHeader.biBitCount );
|
||||
descr.physBitmap = NULL;
|
||||
|
||||
result = X11DRV_DIB_SetImageBits( &descr );
|
||||
|
||||
if (descr.infoBpp <= 8)
|
||||
HeapFree(GetProcessHeap(), 0, descr.colorMap);
|
||||
|
||||
/* Update the DIBSection of the pixmap */
|
||||
X11DRV_UnlockDIBSection(physDev, TRUE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* X11DRV_DIB_DoCopyDIBSection
|
||||
*/
|
||||
|
|
|
@ -532,7 +532,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
|
|||
X11DRV_SetDCBrushColor, /* pSetDCBrushColor */
|
||||
X11DRV_SetDCPenColor, /* pSetDCPenColor */
|
||||
X11DRV_SetDIBColorTable, /* pSetDIBColorTable */
|
||||
X11DRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
|
||||
NULL, /* pSetDIBitsToDevice */
|
||||
X11DRV_SetDeviceClipping, /* pSetDeviceClipping */
|
||||
X11DRV_SetDeviceGammaRamp, /* pSetDeviceGammaRamp */
|
||||
NULL, /* pSetLayout */
|
||||
|
|
|
@ -236,8 +236,6 @@ extern COLORREF X11DRV_SetDCPenColor( PHYSDEV dev, COLORREF crColor ) DECLSPEC_H
|
|||
extern void X11DRV_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip_rgn ) DECLSPEC_HIDDEN;
|
||||
extern BOOL X11DRV_SetDeviceGammaRamp( PHYSDEV dev, LPVOID ramp ) DECLSPEC_HIDDEN;
|
||||
extern UINT X11DRV_SetDIBColorTable( PHYSDEV dev, UINT start, UINT count, const RGBQUAD *colors ) DECLSPEC_HIDDEN;
|
||||
extern INT X11DRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc, INT ySrc,
|
||||
UINT startscan, UINT lines, LPCVOID bits, BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN;
|
||||
extern COLORREF X11DRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern BOOL X11DRV_SetPixelFormat(PHYSDEV dev, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd) DECLSPEC_HIDDEN;
|
||||
extern COLORREF X11DRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in New Issue