mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
Eliminate some unnecessary direct accesses to DC internals from EMF
driver.
This commit is contained in:
parent
8f82f62624
commit
90c42fed6b
@ -85,7 +85,7 @@ static BOOL EMFDRV_BitBlockTransfer(
|
||||
WORD nBPP;
|
||||
LPBITMAPINFOHEADER lpBmiH;
|
||||
EMFDRV_PDEVICE* physDevSrc = (EMFDRV_PDEVICE*)devSrc;
|
||||
DC* dcSrc = physDevSrc->dc;
|
||||
HBITMAP hBitmap = GetCurrentObject(physDevSrc->hdc, OBJ_BITMAP);
|
||||
|
||||
if (emrType == EMR_BITBLT)
|
||||
emrSize = sizeof(EMRBITBLT);
|
||||
@ -94,7 +94,7 @@ static BOOL EMFDRV_BitBlockTransfer(
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
GetObjectA(dcSrc->hBitmap, sizeof(BITMAP), &BM);
|
||||
GetObjectW(hBitmap, sizeof(BITMAP), &BM);
|
||||
|
||||
nBPP = BM.bmPlanes * BM.bmBitsPixel;
|
||||
if(nBPP > 8) nBPP = 24; /* FIXME Can't get 16bpp to work for some reason */
|
||||
@ -127,7 +127,7 @@ static BOOL EMFDRV_BitBlockTransfer(
|
||||
pEMR->xformSrc.eM22 = 1.0; /** Where should we */
|
||||
pEMR->xformSrc.eDx = 0.0; /** get that info */
|
||||
pEMR->xformSrc.eDy = 0.0; /** ???? */
|
||||
pEMR->crBkColorSrc = dcSrc->backgroundColor;
|
||||
pEMR->crBkColorSrc = GetBkColor(physDevSrc->hdc);
|
||||
pEMR->iUsageSrc = DIB_RGB_COLORS;
|
||||
pEMR->offBmiSrc = emrSize;
|
||||
pEMR->cbBmiSrc = bmiSize;
|
||||
@ -152,16 +152,16 @@ static BOOL EMFDRV_BitBlockTransfer(
|
||||
lpBmiH->biCompression = BI_RGB;
|
||||
lpBmiH->biSizeImage = bitsSize;
|
||||
lpBmiH->biYPelsPerMeter = /* 1 meter = 39.37 inch */
|
||||
MulDiv(GetDeviceCaps(dcSrc->hSelf,LOGPIXELSX),3937,100);
|
||||
MulDiv(GetDeviceCaps(physDevSrc->hdc,LOGPIXELSX),3937,100);
|
||||
lpBmiH->biXPelsPerMeter =
|
||||
MulDiv(GetDeviceCaps(dcSrc->hSelf,LOGPIXELSY),3937,100);
|
||||
MulDiv(GetDeviceCaps(physDevSrc->hdc,LOGPIXELSY),3937,100);
|
||||
lpBmiH->biClrUsed = nBPP <= 8 ? 1 << nBPP : 0;
|
||||
/* Set biClrImportant to 0, indicating that all of the
|
||||
device colors are important. */
|
||||
lpBmiH->biClrImportant = 0;
|
||||
|
||||
/* Initiliaze bitmap bits */
|
||||
if (GetDIBits(dcSrc->hSelf, dcSrc->hBitmap, 0, (UINT)lpBmiH->biHeight,
|
||||
if (GetDIBits(physDevSrc->hdc, hBitmap, 0, (UINT)lpBmiH->biHeight,
|
||||
(BYTE*)pEMR + pEMR->offBitsSrc,
|
||||
(LPBITMAPINFO)lpBmiH, DIB_RGB_COLORS))
|
||||
{
|
||||
|
@ -52,10 +52,10 @@ EMFDRV_MoveTo(PHYSDEV dev, INT x, INT y)
|
||||
BOOL
|
||||
EMFDRV_LineTo( PHYSDEV dev, INT x, INT y )
|
||||
{
|
||||
POINT pt;
|
||||
EMRLINETO emr;
|
||||
RECTL bounds;
|
||||
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
|
||||
emr.emr.iType = EMR_LINETO;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
@ -65,10 +65,12 @@ EMFDRV_LineTo( PHYSDEV dev, INT x, INT y )
|
||||
if(!EMFDRV_WriteRecord( dev, &emr.emr ))
|
||||
return FALSE;
|
||||
|
||||
bounds.left = min(x, dc->CursPosX);
|
||||
bounds.top = min(y, dc->CursPosY);
|
||||
bounds.right = max(x, dc->CursPosX);
|
||||
bounds.bottom = max(y, dc->CursPosY);
|
||||
GetCurrentPositionEx(physDev->hdc, &pt);
|
||||
|
||||
bounds.left = min(x, pt.x);
|
||||
bounds.top = min(y, pt.y);
|
||||
bounds.right = max(x, pt.x);
|
||||
bounds.bottom = max(y, pt.y);
|
||||
|
||||
EMFDRV_UpdateBBox( dev, &bounds );
|
||||
|
||||
@ -89,14 +91,13 @@ EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
||||
EMRARC emr;
|
||||
RECTL bounds;
|
||||
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
|
||||
if(left == right || top == bottom) return FALSE;
|
||||
|
||||
if(left > right) {temp = left; left = right; right = temp;}
|
||||
if(top > bottom) {temp = top; top = bottom; bottom = temp;}
|
||||
|
||||
if(dc->GraphicsMode == GM_COMPATIBLE) {
|
||||
if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
|
||||
right--;
|
||||
bottom--;
|
||||
}
|
||||
@ -224,7 +225,6 @@ EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
|
||||
EMRELLIPSE emr;
|
||||
INT temp;
|
||||
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
|
||||
TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
|
||||
|
||||
@ -233,7 +233,7 @@ EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
|
||||
if(left > right) {temp = left; left = right; right = temp;}
|
||||
if(top > bottom) {temp = top; top = bottom; bottom = temp;}
|
||||
|
||||
if(dc->GraphicsMode == GM_COMPATIBLE) {
|
||||
if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
|
||||
right--;
|
||||
bottom--;
|
||||
}
|
||||
@ -258,7 +258,6 @@ EMFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
|
||||
EMRRECTANGLE emr;
|
||||
INT temp;
|
||||
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
|
||||
TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
|
||||
|
||||
@ -267,7 +266,7 @@ EMFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
|
||||
if(left > right) {temp = left; left = right; right = temp;}
|
||||
if(top > bottom) {temp = top; top = bottom; bottom = temp;}
|
||||
|
||||
if(dc->GraphicsMode == GM_COMPATIBLE) {
|
||||
if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
|
||||
right--;
|
||||
bottom--;
|
||||
}
|
||||
@ -293,14 +292,13 @@ EMFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
|
||||
EMRROUNDRECT emr;
|
||||
INT temp;
|
||||
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
|
||||
DC *dc = physDev->dc;
|
||||
|
||||
if(left == right || top == bottom) return FALSE;
|
||||
|
||||
if(left > right) {temp = left; left = right; right = temp;}
|
||||
if(top > bottom) {temp = top; top = bottom; bottom = temp;}
|
||||
|
||||
if(dc->GraphicsMode == GM_COMPATIBLE) {
|
||||
if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
|
||||
right--;
|
||||
bottom--;
|
||||
}
|
||||
|
@ -133,26 +133,32 @@ BOOL EMFDRV_ModifyWorldTransform( PHYSDEV dev, const XFORM *xform, INT mode)
|
||||
|
||||
INT EMFDRV_OffsetViewportOrg( PHYSDEV dev, INT x, INT y )
|
||||
{
|
||||
POINT pt;
|
||||
EMRSETVIEWPORTORGEX emr;
|
||||
EMFDRV_PDEVICE* physDev = (EMFDRV_PDEVICE*)dev;
|
||||
|
||||
GetViewportOrgEx(physDev->hdc, &pt);
|
||||
|
||||
emr.emr.iType = EMR_SETVIEWPORTORGEX;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
emr.ptlOrigin.x = physDev->dc->vportOrgX + x;
|
||||
emr.ptlOrigin.y = physDev->dc->vportOrgY + y;
|
||||
emr.ptlOrigin.x = pt.x + x;
|
||||
emr.ptlOrigin.y = pt.y + y;
|
||||
|
||||
return EMFDRV_WriteRecord( dev, &emr.emr );
|
||||
}
|
||||
|
||||
INT EMFDRV_OffsetWindowOrg( PHYSDEV dev, INT x, INT y )
|
||||
{
|
||||
POINT pt;
|
||||
EMRSETWINDOWORGEX emr;
|
||||
EMFDRV_PDEVICE* physDev = (EMFDRV_PDEVICE*)dev;
|
||||
|
||||
GetWindowOrgEx(physDev->hdc, &pt);
|
||||
|
||||
emr.emr.iType = EMR_SETWINDOWORGEX;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
emr.ptlOrigin.x = physDev->dc->wndOrgX + x;
|
||||
emr.ptlOrigin.y = physDev->dc->wndOrgY + y;
|
||||
emr.ptlOrigin.x = pt.x + x;
|
||||
emr.ptlOrigin.y = pt.y + y;
|
||||
|
||||
return EMFDRV_WriteRecord( dev, &emr.emr );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user