Fixed GDI locking in GetDeviceCaps.

This commit is contained in:
Alexandre Julliard 2000-08-20 18:49:08 +00:00
parent 0ad7874bec
commit 9bfb173c22
1 changed files with 21 additions and 25 deletions

View File

@ -809,38 +809,34 @@ INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
switch (cap) switch (cap)
{ {
case PHYSICALWIDTH: case PHYSICALWIDTH:
if(Escape(hdc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) if(Escape(hdc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) ret = pt.x;
return pt.x; break;
case PHYSICALHEIGHT: case PHYSICALHEIGHT:
if(Escape(hdc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) if(Escape(hdc, GETPHYSPAGESIZE, 0, NULL, (LPVOID)&pt) > 0) ret = pt.y;
return pt.y; break;
case PHYSICALOFFSETX: case PHYSICALOFFSETX:
if(Escape(hdc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) if(Escape(hdc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) ret = pt.x;
return pt.x; break;
case PHYSICALOFFSETY: case PHYSICALOFFSETY:
if(Escape(hdc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) if(Escape(hdc, GETPRINTINGOFFSET, 0, NULL, (LPVOID)&pt) > 0) ret = pt.y;
return pt.y; break;
case SCALINGFACTORX: case SCALINGFACTORX:
if(Escape(hdc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) if(Escape(hdc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) ret = pt.x;
return pt.x; break;
case SCALINGFACTORY: case SCALINGFACTORY:
if(Escape(hdc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) if(Escape(hdc, GETSCALINGFACTOR, 0, NULL, (LPVOID)&pt) > 0) ret = pt.y;
return pt.y; break;
} default:
if ((cap < 0) || (cap > sizeof(DeviceCaps)-sizeof(WORD))) break;
if ((cap < 0) || (cap > sizeof(DeviceCaps)-sizeof(WORD)))
{
GDI_ReleaseObj( hdc );
return 0;
}
if (((cap>=46) && (cap<88)) || ((cap>=92) && (cap<104))) if (((cap>=46) && (cap<88)) || ((cap>=92) && (cap<104)))
FIXME("(%04x,%d): unsupported DeviceCaps capability, will yield 0!\n", FIXME("(%04x,%d): unsupported DeviceCaps capability, will yield 0!\n",
hdc,cap hdc,cap );
);
TRACE("(%04x,%d): returning %d\n",
hdc, cap, *(WORD *)(((char *)dc->w.devCaps) + cap) );
ret = *(WORD *)(((char *)dc->w.devCaps) + cap); ret = *(WORD *)(((char *)dc->w.devCaps) + cap);
break;
}
TRACE("(%04x,%d): returning %d\n", hdc, cap, ret );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
} }