Author: gadamopoulos
Date: Wed Jan 12 12:50:22 2011
New Revision: 50366
URL:
http://svn.reactos.org/svn/reactos?rev=50366&view=rev
Log:
fix build... err, implement shared memory for dcs between win32k and winent
Added:
branches/arwinss/reactos/dll/win32/winent.drv/gdiobj.c (with props)
Modified:
branches/arwinss/reactos/dll/win32/winent.drv/bitblt.c
branches/arwinss/reactos/dll/win32/winent.drv/dib.c
branches/arwinss/reactos/dll/win32/winent.drv/font.c
branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c
branches/arwinss/reactos/dll/win32/winent.drv/graphics.c
branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c
branches/arwinss/reactos/dll/win32/winent.drv/winent.h
branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild
branches/arwinss/reactos/include/reactos/win32k/ntgdihdl.h
branches/arwinss/reactos/include/reactos/wine/ntrosgdi.h
branches/arwinss/reactos/subsystems/win32/win32k/eng/device.c
branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c
branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h
branches/arwinss/reactos/subsystems/win32/win32k/main/init.c
branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild
Modified: branches/arwinss/reactos/dll/win32/winent.drv/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/bitblt.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/bitblt.c [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -16,7 +16,7 @@
/* FUNCTIONS **************************************************************/
-BOOL CDECL RosDrv_PatBlt( NTDRV_PDEVICE *physDev, INT left, INT top, INT width, INT
height, DWORD rop )
+BOOL CDECL RosDrv_PatBlt( PDC_ATTR pdcattr, INT left, INT top, INT width, INT height,
DWORD rop )
{
POINT pts[2], ptBrush;
@@ -26,94 +26,94 @@
pts[1].x = left + width;
pts[1].y = top + height;
- LPtoDP(physDev->hdc, pts, 2);
+ LPtoDP(pdcattr->hdc, pts, 2);
width = pts[1].x - pts[0].x;
height = pts[1].y - pts[0].y;
- left = pts[0].x + physDev->dc_rect.left;
- top = pts[0].y + physDev->dc_rect.top;
+ left = pts[0].x + pdcattr->dc_rect.left;
+ top = pts[0].y + pdcattr->dc_rect.top;
/* Update brush origin */
- GetBrushOrgEx(physDev->hdc, &ptBrush);
- ptBrush.x += physDev->dc_rect.left;
- ptBrush.y += physDev->dc_rect.top;
- RosGdiSetBrushOrg(physDev->hKernelDC, ptBrush.x, ptBrush.y);
+ GetBrushOrgEx(pdcattr->hdc, &ptBrush);
+ ptBrush.x += pdcattr->dc_rect.left;
+ ptBrush.y += pdcattr->dc_rect.top;
+ RosGdiSetBrushOrg(pdcattr->hKernelDC, ptBrush.x, ptBrush.y);
- return RosGdiPatBlt(physDev->hKernelDC, left, top, width, height, rop);
+ return RosGdiPatBlt(pdcattr->hKernelDC, left, top, width, height, rop);
}
-BOOL CDECL RosDrv_BitBlt( NTDRV_PDEVICE *physDevDst, INT xDst, INT yDst,
- INT width, INT height, NTDRV_PDEVICE *physDevSrc,
+BOOL CDECL RosDrv_BitBlt( PDC_ATTR pdcattrDst, INT xDst, INT yDst,
+ INT width, INT height, PDC_ATTR pdcattrSrc,
INT xSrc, INT ySrc, DWORD rop )
{
BOOL useSrc;
POINT pts[2], ptBrush;
useSrc = (((rop >> 2) & 0x330000) != (rop & 0x330000));
- if (!physDevSrc && useSrc) return FALSE;
+ if (!pdcattrSrc && useSrc) return FALSE;
/* Forward to PatBlt if src dev is missing */
- if (!physDevSrc)
- return RosDrv_PatBlt(physDevDst, xDst, yDst, width, height, rop);
+ if (!pdcattrSrc)
+ return RosDrv_PatBlt(pdcattrDst, xDst, yDst, width, height, rop);
/* map source coordinates */
- if (physDevSrc)
+ if (pdcattrSrc)
{
pts[0].x = xSrc;
pts[0].y = ySrc;
pts[1].x = xSrc + width;
pts[1].y = ySrc + height;
- LPtoDP(physDevSrc->hdc, pts, 2);
+ LPtoDP(pdcattrSrc->hdc, pts, 2);
width = pts[1].x - pts[0].x;
height = pts[1].y - pts[0].y;
- xSrc = pts[0].x + physDevSrc->dc_rect.left;
- ySrc = pts[0].y + physDevSrc->dc_rect.top;
+ xSrc = pts[0].x + pdcattrSrc->dc_rect.left;
+ ySrc = pts[0].y + pdcattrSrc->dc_rect.top;
}
/* map dest coordinates */
pts[0].x = xDst;
pts[0].y = yDst;
- LPtoDP(physDevDst->hdc, pts, 1);
- xDst = pts[0].x + physDevDst->dc_rect.left;
- yDst = pts[0].y + physDevDst->dc_rect.top;
+ LPtoDP(pdcattrDst->hdc, pts, 1);
+ xDst = pts[0].x + pdcattrDst->dc_rect.left;
+ yDst = pts[0].y + pdcattrDst->dc_rect.top;
/* Update brush origin */
- GetBrushOrgEx(physDevDst->hdc, &ptBrush);
- ptBrush.x += physDevDst->dc_rect.left;
- ptBrush.y += physDevDst->dc_rect.top;
- RosGdiSetBrushOrg(physDevDst->hKernelDC, ptBrush.x, ptBrush.y);
+ GetBrushOrgEx(pdcattrDst->hdc, &ptBrush);
+ ptBrush.x += pdcattrDst->dc_rect.left;
+ ptBrush.y += pdcattrDst->dc_rect.top;
+ RosGdiSetBrushOrg(pdcattrDst->hKernelDC, ptBrush.x, ptBrush.y);
//FIXME("xDst %d, yDst %d, widthDst %d, heightDst %d, src x %d y %d\n",
// xDst, yDst, width, height, xSrc, ySrc);
- return RosGdiBitBlt(physDevDst->hKernelDC, xDst, yDst, width, height,
- physDevSrc->hKernelDC, xSrc, ySrc, rop);
+ return RosGdiBitBlt(pdcattrDst->hKernelDC, xDst, yDst, width, height,
+ pdcattrSrc->hKernelDC, xSrc, ySrc, rop);
}
-BOOL CDECL RosDrv_StretchBlt( NTDRV_PDEVICE *physDevDst, INT xDst, INT yDst,
+BOOL CDECL RosDrv_StretchBlt( PDC_ATTR pdcattrDst, INT xDst, INT yDst,
INT widthDst, INT heightDst,
- NTDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
+ PDC_ATTR pdcattrSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, DWORD rop )
{
BOOL useSrc;
POINT pts[2], ptBrush;
useSrc = (((rop >> 2) & 0x330000) != (rop & 0x330000));
- if (!physDevSrc && useSrc) return FALSE;
+ if (!pdcattrSrc && useSrc) return FALSE;
/* map source coordinates */
- if (physDevSrc)
+ if (pdcattrSrc)
{
pts[0].x = xSrc;
pts[0].y = ySrc;
pts[1].x = xSrc + widthSrc;
pts[1].y = ySrc + heightSrc;
- LPtoDP(physDevSrc->hdc, pts, 2);
+ LPtoDP(pdcattrSrc->hdc, pts, 2);
widthSrc = pts[1].x - pts[0].x;
heightSrc = pts[1].y - pts[0].y;
- xSrc = pts[0].x + physDevSrc->dc_rect.left;
- ySrc = pts[0].y + physDevSrc->dc_rect.top;
+ xSrc = pts[0].x + pdcattrSrc->dc_rect.left;
+ ySrc = pts[0].y + pdcattrSrc->dc_rect.top;
}
/* map dest coordinates */
@@ -121,41 +121,41 @@
pts[0].y = yDst;
pts[1].x = xDst + widthDst;
pts[1].y = yDst + heightDst;
- LPtoDP(physDevDst->hdc, pts, 2);
+ LPtoDP(pdcattrDst->hdc, pts, 2);
widthDst = pts[1].x - pts[0].x;
heightDst = pts[1].y - pts[0].y;
- xDst = pts[0].x + physDevDst->dc_rect.left;
- yDst = pts[0].y + physDevDst->dc_rect.top;
+ xDst = pts[0].x + pdcattrDst->dc_rect.left;
+ yDst = pts[0].y + pdcattrDst->dc_rect.top;
/* Update brush origin */
- GetBrushOrgEx(physDevDst->hdc, &ptBrush);
- ptBrush.x += physDevDst->dc_rect.left;
- ptBrush.y += physDevDst->dc_rect.top;
- RosGdiSetBrushOrg(physDevDst->hKernelDC, ptBrush.x, ptBrush.y);
+ GetBrushOrgEx(pdcattrDst->hdc, &ptBrush);
+ ptBrush.x += pdcattrDst->dc_rect.left;
+ ptBrush.y += pdcattrDst->dc_rect.top;
+ RosGdiSetBrushOrg(pdcattrDst->hKernelDC, ptBrush.x, ptBrush.y);
- return RosGdiStretchBlt(physDevDst->hKernelDC, xDst, yDst, widthDst, heightDst,
- physDevSrc->hKernelDC, xSrc, ySrc, widthSrc, heightSrc, rop);
+ return RosGdiStretchBlt(pdcattrDst->hKernelDC, xDst, yDst, widthDst, heightDst,
+ pdcattrSrc->hKernelDC, xSrc, ySrc, widthSrc, heightSrc, rop);
}
-BOOL CDECL RosDrv_AlphaBlend(NTDRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT widthDst,
INT heightDst,
- NTDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, INT widthSrc,
INT heightSrc,
+BOOL CDECL RosDrv_AlphaBlend(PDC_ATTR pdcattrDst, INT xDst, INT yDst, INT widthDst, INT
heightDst,
+ PDC_ATTR pdcattrSrc, INT xSrc, INT ySrc, INT widthSrc, INT
heightSrc,
BLENDFUNCTION blendfn)
{
POINT pts[2], ptBrush;
/* map source coordinates */
- if (physDevSrc)
+ if (pdcattrSrc)
{
pts[0].x = xSrc;
pts[0].y = ySrc;
pts[1].x = xSrc + widthSrc;
pts[1].y = ySrc + heightSrc;
- LPtoDP(physDevSrc->hdc, pts, 2);
+ LPtoDP(pdcattrSrc->hdc, pts, 2);
widthSrc = pts[1].x - pts[0].x;
heightSrc = pts[1].y - pts[0].y;
- xSrc = pts[0].x + physDevSrc->dc_rect.left;
- ySrc = pts[0].y + physDevSrc->dc_rect.top;
+ xSrc = pts[0].x + pdcattrSrc->dc_rect.left;
+ ySrc = pts[0].y + pdcattrSrc->dc_rect.top;
}
/* map dest coordinates */
@@ -164,20 +164,20 @@
pts[1].x = xDst + widthDst;
pts[1].y = yDst + heightDst;
- LPtoDP(physDevDst->hdc, pts, 2);
+ LPtoDP(pdcattrDst->hdc, pts, 2);
widthDst = pts[1].x - pts[0].x;
heightDst = pts[1].y - pts[0].y;
- xDst = pts[0].x + physDevDst->dc_rect.left;
- yDst = pts[0].y + physDevDst->dc_rect.top;
+ xDst = pts[0].x + pdcattrDst->dc_rect.left;
+ yDst = pts[0].y + pdcattrDst->dc_rect.top;
/* Update brush origin */
- GetBrushOrgEx(physDevDst->hdc, &ptBrush);
- ptBrush.x += physDevDst->dc_rect.left;
- ptBrush.y += physDevDst->dc_rect.top;
- RosGdiSetBrushOrg(physDevDst->hKernelDC, ptBrush.x, ptBrush.y);
+ GetBrushOrgEx(pdcattrDst->hdc, &ptBrush);
+ ptBrush.x += pdcattrDst->dc_rect.left;
+ ptBrush.y += pdcattrDst->dc_rect.top;
+ RosGdiSetBrushOrg(pdcattrDst->hKernelDC, ptBrush.x, ptBrush.y);
- return RosGdiAlphaBlend(physDevDst->hKernelDC, xDst, yDst, widthDst, heightDst,
- physDevSrc->hKernelDC, xSrc, ySrc, widthSrc, heightSrc, blendfn);
+ return RosGdiAlphaBlend(pdcattrDst->hKernelDC, xDst, yDst, widthDst, heightDst,
+ pdcattrSrc->hKernelDC, xSrc, ySrc, widthSrc, heightSrc, blendfn);
}
Modified: branches/arwinss/reactos/dll/win32/winent.drv/dib.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/dib.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/dib.c [iso-8859-1] Wed Jan 12 12:50:22
2011
@@ -71,7 +71,7 @@
return ((width * depth + 31) & ~31) >> 3;
}
-INT CDECL RosDrv_SetDIBitsToDevice( NTDRV_PDEVICE *physDev, INT xDest, INT yDest, DWORD
cx,
+INT CDECL RosDrv_SetDIBitsToDevice( PDC_ATTR pdcattr, INT xDest, INT yDest, DWORD cx,
DWORD cy, INT xSrc, INT ySrc,
UINT startscan, UINT lines, LPCVOID bits,
const BITMAPINFO *info, UINT coloruse )
@@ -82,9 +82,9 @@
POINT pt;
pt.x = xDest; pt.y = yDest;
- LPtoDP(physDev->hdc, &pt, 1);
- pt.x += physDev->dc_rect.left;
- pt.y += physDev->dc_rect.top;
+ LPtoDP(pdcattr->hdc, &pt, 1);
+ pt.x += pdcattr->dc_rect.left;
+ pt.y += pdcattr->dc_rect.top;
/* Perform extensive parameter checking */
if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height,
@@ -129,11 +129,11 @@
if (xSrc + cx >= width) cx = width - xSrc;
if (!cx || !cy) return lines;
- return RosGdiSetDIBitsToDevice(physDev->hKernelDC, pt.x, pt.y, cx, cy,
+ return RosGdiSetDIBitsToDevice(pdcattr->hKernelDC, pt.x, pt.y, cx, cy,
xSrc, ySrc, startscan, top_down ? -lines : lines, bits, info, coloruse);
}
-INT CDECL RosDrv_SetDIBits( NTDRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan,
+INT CDECL RosDrv_SetDIBits( PDC_ATTR pdcattr, HBITMAP hbitmap, UINT startscan,
UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT
coloruse )
{
LONG height, width, tmpheight;
@@ -175,7 +175,7 @@
hbitmap = (HBITMAP)MapUserHandle(hbitmap);
- result = RosGdiSetDIBits(physDev->hKernelDC, hbitmap, startscan,
+ result = RosGdiSetDIBits(pdcattr->hKernelDC, hbitmap, startscan,
lines, safeBits, info, coloruse);
/* Free safe copy of bits */
@@ -185,7 +185,7 @@
return result;
}
-INT CDECL RosDrv_GetDIBits( NTDRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan, UINT
lines,
+INT CDECL RosDrv_GetDIBits( PDC_ATTR pdcattr, HBITMAP hbitmap, UINT startscan, UINT
lines,
LPVOID bits, BITMAPINFO *info, UINT coloruse )
{
size_t obj_size;
@@ -197,10 +197,10 @@
hbitmap = (HBITMAP)MapUserHandle(hbitmap);
/* Perform GetDIBits */
- return RosGdiGetDIBits(physDev->hKernelDC, hbitmap, startscan, lines, bits, info,
coloruse, &dib);
-}
-
-HBITMAP CDECL RosDrv_CreateDIBSection( NTDRV_PDEVICE *physDev, HBITMAP hbitmap,
+ return RosGdiGetDIBits(pdcattr->hKernelDC, hbitmap, startscan, lines, bits, info,
coloruse, &dib);
+}
+
+HBITMAP CDECL RosDrv_CreateDIBSection( PDC_ATTR pdcattr, HBITMAP hbitmap,
const BITMAPINFO *bmi, UINT usage )
{
DIBSECTION dib;
@@ -217,16 +217,16 @@
// TODO: Should pass as a flag instead
if (height < 0) dib.dsBmih.biHeight *= -1;
- hKbitmap = RosGdiCreateDIBSection(physDev->hKernelDC, bmi, usage, &dib);
+ hKbitmap = RosGdiCreateDIBSection(pdcattr->hKernelDC, bmi, usage, &dib);
AddHandleMapping(hKbitmap, hbitmap);
return hbitmap;
}
-UINT CDECL RosDrv_SetDIBColorTable( NTDRV_PDEVICE *physDev, UINT start, UINT count, const
RGBQUAD *colors )
-{
- return RosGdiSetDIBColorTable(physDev->hKernelDC, start, count, colors);
+UINT CDECL RosDrv_SetDIBColorTable( PDC_ATTR pdcattr, UINT start, UINT count, const
RGBQUAD *colors )
+{
+ return RosGdiSetDIBColorTable(pdcattr->hKernelDC, start, count, colors);
}
Modified: branches/arwinss/reactos/dll/win32/winent.drv/font.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/font.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/font.c [iso-8859-1] Wed Jan 12 12:50:22
2011
@@ -192,7 +192,7 @@
return mru;
}
-static BOOL get_gasp_flags(NTDRV_PDEVICE *physDev, WORD *flags)
+static BOOL get_gasp_flags(PDC_ATTR pdcattr, WORD *flags)
{
DWORD size;
WORD *gasp, *buffer;
@@ -202,15 +202,15 @@
*flags = 0;
- size = GetFontData(physDev->hdc, MS_GASP_TAG, 0, NULL, 0);
+ size = GetFontData(pdcattr->hdc, MS_GASP_TAG, 0, NULL, 0);
if(size == GDI_ERROR)
return FALSE;
gasp = buffer = HeapAlloc(GetProcessHeap(), 0, size);
- GetFontData(physDev->hdc, MS_GASP_TAG, 0, gasp, size);
-
- GetTextMetricsW(physDev->hdc, &tm);
- ppem = abs(RosDrv_YWStoDS(physDev, tm.tmAscent + tm.tmDescent -
tm.tmInternalLeading));
+ GetFontData(pdcattr->hdc, MS_GASP_TAG, 0, gasp, size);
+
+ GetTextMetricsW(pdcattr->hdc, &tm);
+ ppem = abs(RosDrv_YWStoDS(pdcattr, tm.tmAscent + tm.tmDescent -
tm.tmInternalLeading));
gasp++;
num_recs = get_be_word(*gasp);
@@ -228,7 +228,7 @@
return TRUE;
}
-static AA_Type get_antialias_type( NTDRV_PDEVICE *physDev, BOOL subpixel, BOOL hinter)
+static AA_Type get_antialias_type( PDC_ATTR pdcattr, BOOL subpixel, BOOL hinter)
{
AA_Type ret;
WORD flags;
@@ -250,7 +250,7 @@
But, Wine's subpixel rendering can support the portrait mode.
*/
}
- else if (!hinter || !get_gasp_flags(physDev, &flags) || flags & GASP_DOGRAY)
+ else if (!hinter || !get_gasp_flags(pdcattr, &flags) || flags & GASP_DOGRAY)
ret = AA_Grey;
else
ret = AA_None;
@@ -258,7 +258,7 @@
return ret;
}
-static int GetCacheEntry(NTDRV_PDEVICE *physDev, LFANDSIZE *plfsz)
+static int GetCacheEntry(PDC_ATTR pdcattr, LFANDSIZE *plfsz)
{
int ret;
int format;
@@ -289,11 +289,11 @@
switch (plfsz->lf.lfQuality)
{
case ANTIALIASED_QUALITY:
- entry->aa_default = get_antialias_type( physDev, FALSE, hinter );
+ entry->aa_default = get_antialias_type( pdcattr, FALSE, hinter );
break;
case CLEARTYPE_QUALITY:
case CLEARTYPE_NATURAL_QUALITY:
- entry->aa_default = get_antialias_type( physDev, subpixel, hinter );
+ entry->aa_default = get_antialias_type( pdcattr, subpixel, hinter );
break;
case DEFAULT_QUALITY:
case DRAFT_QUALITY:
@@ -302,7 +302,7 @@
if ( SystemParametersInfoW( SPI_GETFONTSMOOTHING, 0, &font_smoothing,
0) &&
font_smoothing)
{
- entry->aa_default = get_antialias_type( physDev, subpixel, hinter
);
+ entry->aa_default = get_antialias_type( pdcattr, subpixel, hinter
);
}
else
entry->aa_default = AA_None;
@@ -354,14 +354,14 @@
*
* Helper to ExtTextOut. Must be called inside xrender_cs
*/
-static BOOL UploadGlyph(NTDRV_PDEVICE *physDev, int glyph, AA_Type format)
+static BOOL UploadGlyph(PDC_ATTR pdcattr, int glyph, AA_Type format)
{
unsigned int buflen;
char *buf;
//Glyph gid;
GLYPHMETRICS gm;
GlyphInfo gi;
- gsCacheEntry *entry = glyphsetCache + physDev->cache_index;
+ gsCacheEntry *entry = glyphsetCache + pdcattr->cache_index;
gsCacheEntryFormat *formatEntry;
UINT ggo_format = GGO_GLYPH_INDEX;
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
@@ -390,13 +390,13 @@
break;
}
- buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL,
&identity);
+ buflen = GetGlyphOutlineW(pdcattr->hdc, glyph, ggo_format, &gm, 0, NULL,
&identity);
if(buflen == GDI_ERROR) {
if(format != AA_None) {
format = AA_None;
entry->aa_default = AA_None;
ggo_format = GGO_GLYPH_INDEX | GGO_BITMAP;
- buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0,
NULL, &identity);
+ buflen = GetGlyphOutlineW(pdcattr->hdc, glyph, ggo_format, &gm, 0,
NULL, &identity);
}
if(buflen == GDI_ERROR) {
WARN("GetGlyphOutlineW failed\n");
@@ -447,7 +447,7 @@
}
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen);
- GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, buflen, buf,
&identity);
+ GetGlyphOutlineW(pdcattr->hdc, glyph, ggo_format, &gm, buflen, buf,
&identity);
formatEntry->realized[glyph] = TRUE;
TRACE("buflen = %d. Got metrics: %dx%d adv=%d,%d origin=%d,%d\n",
@@ -505,7 +505,7 @@
VOID
-FeSelectFont(NTDRV_PDEVICE *physDev, HFONT hfont)
+FeSelectFont(PDC_ATTR pdcattr, HFONT hfont)
{
LFANDSIZE lfsz;
@@ -514,19 +514,19 @@
lfsz.lf.lfHeight, lfsz.lf.lfWidth, lfsz.lf.lfWeight,
lfsz.lf.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName));
lfsz.lf.lfWidth = abs( lfsz.lf.lfWidth );
- lfsz.devsize.cx = RosDrv_XWStoDS( physDev, lfsz.lf.lfWidth );
- lfsz.devsize.cy = RosDrv_YWStoDS( physDev, lfsz.lf.lfHeight );
- GetWorldTransform( physDev->hdc, &lfsz.xform );
+ lfsz.devsize.cx = RosDrv_XWStoDS( pdcattr, lfsz.lf.lfWidth );
+ lfsz.devsize.cy = RosDrv_YWStoDS( pdcattr, lfsz.lf.lfHeight );
+ GetWorldTransform( pdcattr->hdc, &lfsz.xform );
lfsz_calc_hash(&lfsz);
/*EnterCriticalSection(&xrender_cs);*/
- if (physDev->cache_index != -1)
- dec_ref_cache(physDev->cache_index);
- physDev->cache_index = GetCacheEntry(physDev, &lfsz);
+ if (pdcattr->cache_index != -1)
+ dec_ref_cache(pdcattr->cache_index);
+ pdcattr->cache_index = GetCacheEntry(pdcattr, &lfsz);
/*LeaveCriticalSection(&xrender_cs);*/
}
-BOOL FeTextOut( NTDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
+BOOL FeTextOut( PDC_ATTR pdcattr, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR wstr, UINT count,
const INT *lpDx )
{
@@ -535,7 +535,7 @@
gsCacheEntry *entry;
gsCacheEntryFormat *formatEntry;
BOOL retv = FALSE;
- //HDC hdc = physDev->hdc;
+ //HDC hdc = pdcattr->hdc;
//int textPixel, backgroundPixel;
HRGN saved_region = 0;
BOOL disable_antialias = FALSE;
@@ -543,12 +543,12 @@
//DIBSECTION bmp;
unsigned int idx;
RECT rect;
- //enum drawable_depth_type depth_type = (physDev->depth == 1) ? mono_drawable :
color_drawable;
+ //enum drawable_depth_type depth_type = (pdcattr->depth == 1) ? mono_drawable :
color_drawable;
//Picture tile_pict = 0;
/* Do we need to disable antialiasing because of palette mode? */
#if 0
- if( !physDev->bitmap || GetObjectW( physDev->bitmap->hbitmap, sizeof(bmp),
&bmp ) != sizeof(bmp) ) {
+ if( !pdcattr->bitmap || GetObjectW( pdcattr->bitmap->hbitmap, sizeof(bmp),
&bmp ) != sizeof(bmp) ) {
TRACE("bitmap is not a DIB\n");
}
else if (bmp.dsBmih.biBitCount <= 8) {
@@ -557,11 +557,11 @@
}
#endif
- //RosDrv_LockDIBSection( physDev, DIB_Status_GdiMod );
+ //RosDrv_LockDIBSection( pdcattr, DIB_Status_GdiMod );
#if 0
- if(physDev->depth == 1) {
- if((physDev->textPixel & 0xffffff) == 0) {
+ if(pdcattr->depth == 1) {
+ if((pdcattr->textPixel & 0xffffff) == 0) {
textPixel = 0;
backgroundPixel = 1;
} else {
@@ -569,8 +569,8 @@
backgroundPixel = 0;
}
} else {
- textPixel = physDev->textPixel;
- backgroundPixel = physDev->backgroundPixel;
+ textPixel = pdcattr->textPixel;
+ backgroundPixel = pdcattr->backgroundPixel;
}
#endif
@@ -579,18 +579,18 @@
HBRUSH brush, oldBrush;
HPEN pen, oldPen;
- brush = CreateSolidBrush(GetBkColor(physDev->hdc));
- oldBrush = SelectObject(physDev->hdc, brush);
+ brush = CreateSolidBrush(GetBkColor(pdcattr->hdc));
+ oldBrush = SelectObject(pdcattr->hdc, brush);
pen = CreatePen(PS_NULL, 0, 0);
- oldPen = SelectObject(physDev->hdc, pen);
+ oldPen = SelectObject(pdcattr->hdc, pen);
CopyRect(&rect, lprect);
- OffsetRect(&rect, physDev->dc_rect.left, physDev->dc_rect.top);
- RosGdiRectangle(physDev->hKernelDC, &rect);
-
- DeleteObject(SelectObject(physDev->hdc, oldBrush));
- DeleteObject(SelectObject(physDev->hdc, oldPen));
+ OffsetRect(&rect, pdcattr->dc_rect.left, pdcattr->dc_rect.top);
+ RosGdiRectangle(pdcattr->hKernelDC, &rect);
+
+ DeleteObject(SelectObject(pdcattr->hdc, oldBrush));
+ DeleteObject(SelectObject(pdcattr->hdc, oldPen));
}
if(count == 0)
@@ -606,27 +606,27 @@
clip_region = CreateRectRgnIndirect( lprect );
/* make a copy of the current device region */
saved_region = CreateRectRgn( 0, 0, 0, 0 );
- CombineRgn( saved_region, physDev->region, 0, RGN_COPY );
- RosDrv_SetDeviceClipping( physDev, saved_region, clip_region );
+ CombineRgn( saved_region, pdcattr->region, 0, RGN_COPY );
+ RosDrv_SetDeviceClipping( pdcattr, saved_region, clip_region );
DeleteObject( clip_region );
}
//EnterCriticalSection(&xrender_cs);
- entry = glyphsetCache + physDev->cache_index;
+ entry = glyphsetCache + pdcattr->cache_index;
if( disable_antialias == FALSE )
aa_type = entry->aa_default;
formatEntry = entry->format[aa_type];
for(idx = 0; idx < count; idx++) {
if( !formatEntry ) {
- UploadGlyph(physDev, wstr[idx], aa_type);
+ UploadGlyph(pdcattr, wstr[idx], aa_type);
/* re-evaluate antialias since aa_default may have changed */
if( disable_antialias == FALSE )
aa_type = entry->aa_default;
formatEntry = entry->format[aa_type];
} else if( wstr[idx] >= formatEntry->nrealized ||
formatEntry->realized[wstr[idx]] == FALSE) {
- UploadGlyph(physDev, wstr[idx], aa_type);
+ UploadGlyph(pdcattr, wstr[idx], aa_type);
}
}
if (!formatEntry)
@@ -637,68 +637,68 @@
}
TRACE("Writing %s at %d,%d\n", debugstr_wn(wstr,count),
- physDev->dc_rect.left + x, physDev->dc_rect.top + y);
-
- RosGdiExtTextOut(physDev->hKernelDC, physDev->dc_rect.left + x,
physDev->dc_rect.top + y, flags, lprect, wstr, count, lpDx, formatEntry, aa_type);
+ pdcattr->dc_rect.left + x, pdcattr->dc_rect.top + y);
+
+ RosGdiExtTextOut(pdcattr->hKernelDC, pdcattr->dc_rect.left + x,
pdcattr->dc_rect.top + y, flags, lprect, wstr, count, lpDx, formatEntry, aa_type);
//LeaveCriticalSection(&xrender_cs);
if (flags & ETO_CLIPPED)
{
/* restore the device region */
- RosDrv_SetDeviceClipping( physDev, saved_region, 0 );
+ RosDrv_SetDeviceClipping( pdcattr, saved_region, 0 );
DeleteObject( saved_region );
}
retv = TRUE;
done_unlock:
- //RosDrv_UnlockDIBSection( physDev, TRUE );
+ //RosDrv_UnlockDIBSection( pdcattr, TRUE );
return retv;
}
-BOOL CDECL RosDrv_ExtTextOut( NTDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
+BOOL CDECL RosDrv_ExtTextOut( PDC_ATTR pdcattr, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR wstr, UINT count,
const INT *lpDx )
{
- //if (physDev->has_gdi_font)
- return FeTextOut(physDev, x, y, flags, lprect, wstr, count, lpDx);
+ //if (pdcattr->has_gdi_font)
+ return FeTextOut(pdcattr, x, y, flags, lprect, wstr, count, lpDx);
//UNIMPLEMENTED;
//return FALSE;
}
-BOOL CDECL RosDrv_GetTextExtentExPoint( NTDRV_PDEVICE *physDev, LPCWSTR str, INT count,
+BOOL CDECL RosDrv_GetTextExtentExPoint( PDC_ATTR pdcattr, LPCWSTR str, INT count,
INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE
size )
{
UNIMPLEMENTED;
return FALSE;
}
-BOOL CDECL RosDrv_GetTextMetrics(NTDRV_PDEVICE *physDev, TEXTMETRICW *metrics)
+BOOL CDECL RosDrv_GetTextMetrics(PDC_ATTR pdcattr, TEXTMETRICW *metrics)
{
/* Let GDI font engine do the work */
return FALSE;
}
-BOOL CDECL RosDrv_EnumDeviceFonts( NTDRV_PDEVICE *physDev, LPLOGFONTW plf,
+BOOL CDECL RosDrv_EnumDeviceFonts( PDC_ATTR pdcattr, LPLOGFONTW plf,
FONTENUMPROCW proc, LPARAM lp )
{
/* We're always using client-side fonts. */
return FALSE;
}
-HFONT CDECL RosDrv_SelectFont( NTDRV_PDEVICE *physDev, HFONT hfont, HANDLE gdiFont )
+HFONT CDECL RosDrv_SelectFont( PDC_ATTR pdcattr, HFONT hfont, HANDLE gdiFont )
{
/* We don't have a kernelmode font engine */
if (gdiFont == 0)
{
- /*RosGdiSelectFont(physDev->hKernelDC, hfont, gdiFont);*/
+ /*RosGdiSelectFont(pdcattr->hKernelDC, hfont, gdiFont);*/
}
else
{
/* Save information about the selected font */
- FeSelectFont(physDev, hfont);
+ FeSelectFont(pdcattr, hfont);
}
/* Indicate that gdiFont is good to use */
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -13,104 +13,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(rosgdidrv);
-/* GLOBALS ****************************************************************/
-static struct list handle_mapping_list = LIST_INIT( handle_mapping_list );
-static CRITICAL_SECTION handle_mapping_cs;
-static BOOL StockObjectsInitialized = FALSE;
-
-typedef struct _HMAPPING
-{
- HGDIOBJ hUser;
- HGDIOBJ hKernel;
- struct list entry;
-} HMAPPING, *PHMAPPING;
-
/* FUNCTIONS **************************************************************/
-VOID InitHandleMapping()
-{
- InitializeCriticalSection(&handle_mapping_cs);
-}
-
-VOID AddHandleMapping(HGDIOBJ hKernel, HGDIOBJ hUser)
-{
- PHMAPPING mapping = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HMAPPING));
- if(!mapping)
- return;
-
- mapping->hKernel = hKernel;
- mapping->hUser = hUser;
-
- EnterCriticalSection(&handle_mapping_cs);
- list_add_tail(&handle_mapping_list, &mapping->entry);
- LeaveCriticalSection(&handle_mapping_cs);
-}
-
-static PHMAPPING FindHandleMapping(HGDIOBJ hUser)
-{
- PHMAPPING item;
-
- LIST_FOR_EACH_ENTRY( item, &handle_mapping_list, HMAPPING, entry )
- {
- if (item->hUser == hUser)
- {
- return item;
- }
- }
-
- return NULL;
-}
-
-HGDIOBJ MapUserHandle(HGDIOBJ hUser)
-{
- PHMAPPING mapping;
-
- /* Map stock objects if not mapped yet */
- if(!StockObjectsInitialized)
- {
- HGDIOBJ hKernel, hUser;
-
- hKernel = NtGdiGetStockObject(DEFAULT_BITMAP);
- hUser = GetStockObject( STOCK_LAST+1 );
-
- /* Make sure that both kernel mode and user mode objects are initialized */
- if(hKernel && hUser)
- {
- AddHandleMapping(NtGdiGetStockObject(DEFAULT_BITMAP), GetStockObject(
STOCK_LAST+1 ));
- StockObjectsInitialized = TRUE;
- }
- }
-
- mapping = FindHandleMapping(hUser);
-
- return mapping ? mapping->hKernel : NULL;
-}
-
-VOID RemoveHandleMapping(HGDIOBJ hUser)
-{
- PHMAPPING mapping;
-
- mapping = FindHandleMapping(hUser);
- if(mapping == NULL)
- return;
-
- EnterCriticalSection(&handle_mapping_cs);
- list_remove(&mapping->entry);
- LeaveCriticalSection(&handle_mapping_cs);
-}
-
-VOID CleanupHandleMapping()
-{
- PHMAPPING mapping;
-
- while(!list_empty(&handle_mapping_list))
- {
- mapping = LIST_ENTRY(list_head(&handle_mapping_list), HMAPPING, entry);
- RemoveHandleMapping(mapping->hUser);
- }
-}
-
-BOOL CDECL RosDrv_CreateBitmap( NTDRV_PDEVICE *physDev, HBITMAP hbitmap, LPVOID bmBits )
+BOOL CDECL RosDrv_CreateBitmap( PDC_ATTR pdcattr, HBITMAP hbitmap, LPVOID bmBits )
{
BITMAP bitmap;
HBITMAP hKbitmap;
@@ -122,7 +27,7 @@
if (bitmap.bmPlanes != 1) return FALSE;
/* Create the kernelmode bitmap object */
- hKbitmap = RosGdiCreateBitmap(physDev->hKernelDC, &bitmap, bmBits);
+ hKbitmap = RosGdiCreateBitmap(pdcattr->hKernelDC, &bitmap, bmBits);
if(!hKbitmap)
return FALSE;
@@ -131,37 +36,46 @@
return TRUE;
}
-BOOL CDECL RosDrv_CreateDC( HDC hdc, NTDRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR
device,
+BOOL CDECL RosDrv_CreateDC( HDC hdc, PDC_ATTR *ppdcattr, LPCWSTR driver, LPCWSTR device,
LPCWSTR output, const DEVMODEW* initData )
{
BOOL bRet;
DWORD dcType;
- NTDRV_PDEVICE *physDev;
+ PDC_ATTR pdcattr;
HDC hKernelDC;
-
- /* Allocate memory for two handles */
- physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) );
- if (!physDev) return FALSE;
/* Get DC type */
dcType = GetObjectType(hdc);
/* Call the win32 kernel */
bRet = RosGdiCreateDC(&hKernelDC, driver, device, output, initData, dcType);
+ if(!bRet)
+ {
+ ERR("RosGdiCreateDC failed!!!\n");
+ return FALSE;
+ }
+
+ /* Retrieve the user mode part of the new handle */
+ pdcattr = GdiGetDcAttr(hKernelDC);
+ if(!pdcattr)
+ {
+ ERR("RosGdiCreateDC failed!!!\n");
+ return TRUE;
+ }
/* Save newly created DC */
- physDev->hKernelDC = hKernelDC;
- physDev->hdc = hdc;
+ pdcattr->hKernelDC = hKernelDC;
+ pdcattr->hdc = hdc;
/* No font is selected */
- physDev->cache_index = -1;
+ pdcattr->cache_index = -1;
/* Create a usermode clipping region (same as kernelmode one, just to reduce
amount of syscalls) */
- physDev->region = CreateRectRgn( 0, 0, 0, 0 );
+ pdcattr->region = CreateRectRgn( 0, 0, 0, 0 );
/* Return allocated physical DC to the caller */
- *pdev = physDev;
+ *ppdcattr = pdcattr;
return bRet;
}
@@ -178,24 +92,16 @@
return RosGdiDeleteBitmap(hKbitmap);
}
-BOOL CDECL RosDrv_DeleteDC( NTDRV_PDEVICE *physDev )
-{
- BOOL res;
-
+BOOL CDECL RosDrv_DeleteDC( PDC_ATTR pdcattr )
+{
/* Delete usermode copy of a clipping region */
- DeleteObject( physDev->region );
+ DeleteObject( pdcattr->region );
/* Delete kernel DC */
- res = RosGdiDeleteDC(physDev->hKernelDC);
-
- /* Free the um/km handle pair memory */
- HeapFree( GetProcessHeap(), 0, physDev );
-
- /* Return result */
- return res;
-}
-
-INT CDECL RosDrv_ExtEscape( NTDRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID
in_data,
+ return RosGdiDeleteDC(pdcattr->hKernelDC);
+}
+
+INT CDECL RosDrv_ExtEscape( PDC_ATTR pdcattr, INT escape, INT in_count, LPCVOID in_data,
INT out_count, LPVOID out_data )
{
switch(escape)
@@ -210,13 +116,13 @@
{
const struct ntdrv_escape_set_drawable *data = in_data;
- physDev->dc_rect = data->dc_rect;
- RosGdiSetDcRects(physDev->hKernelDC, NULL,
(RECT*)&data->drawable_rect);
-
- RosGdiGetDC(physDev->hKernelDC, data->drawable,
data->clip_children);
+ pdcattr->dc_rect = data->dc_rect;
+ RosGdiSetDcRects(pdcattr->hKernelDC, NULL,
(RECT*)&data->drawable_rect);
+
+ RosGdiGetDC(pdcattr->hKernelDC, data->drawable,
data->clip_children);
TRACE( "SET_DRAWABLE hdc %p dc_rect %s drawable_rect
%s\n",
- physDev->hdc, wine_dbgstr_rect(&data->dc_rect),
wine_dbgstr_rect(&data->drawable_rect) );
+ pdcattr->hdc, wine_dbgstr_rect(&data->dc_rect),
wine_dbgstr_rect(&data->drawable_rect) );
return TRUE;
}
break;
@@ -238,49 +144,49 @@
return RosGdiGetBitmapBits(hbitmap, buffer, count);
}
-BOOL CDECL RosDrv_GetCharWidth( NTDRV_PDEVICE *physDev, UINT firstChar, UINT lastChar,
+BOOL CDECL RosDrv_GetCharWidth( PDC_ATTR pdcattr, UINT firstChar, UINT lastChar,
LPINT buffer )
{
UNIMPLEMENTED;
return FALSE;
}
-INT CDECL RosDrv_GetDeviceCaps( NTDRV_PDEVICE *physDev, INT cap )
-{
- return RosGdiGetDeviceCaps(physDev->hKernelDC, cap);
-}
-
-BOOL CDECL RosDrv_GetDeviceGammaRamp(NTDRV_PDEVICE *physDev, LPVOID ramp)
-{
- UNIMPLEMENTED;
- return FALSE;
-}
-
-COLORREF CDECL RosDrv_GetNearestColor( NTDRV_PDEVICE *physDev, COLORREF color )
-{
- UNIMPLEMENTED;
- return 0;
-}
-
-UINT CDECL RosDrv_GetSystemPaletteEntries( NTDRV_PDEVICE *physDev, UINT start, UINT
count,
+INT CDECL RosDrv_GetDeviceCaps( PDC_ATTR pdcattr, INT cap )
+{
+ return RosGdiGetDeviceCaps(pdcattr->hKernelDC, cap);
+}
+
+BOOL CDECL RosDrv_GetDeviceGammaRamp(PDC_ATTR pdcattr, LPVOID ramp)
+{
+ UNIMPLEMENTED;
+ return FALSE;
+}
+
+COLORREF CDECL RosDrv_GetNearestColor( PDC_ATTR pdcattr, COLORREF color )
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+UINT CDECL RosDrv_GetSystemPaletteEntries( PDC_ATTR pdcattr, UINT start, UINT count,
LPPALETTEENTRY entries )
{
- return RosGdiGetSystemPaletteEntries(physDev->hKernelDC, start, count, entries);
-}
-
-UINT CDECL RosDrv_RealizeDefaultPalette( NTDRV_PDEVICE *physDev )
+ return RosGdiGetSystemPaletteEntries(pdcattr->hKernelDC, start, count, entries);
+}
+
+UINT CDECL RosDrv_RealizeDefaultPalette( PDC_ATTR pdcattr )
{
//UNIMPLEMENTED;
return FALSE;
}
-UINT CDECL RosDrv_RealizePalette( NTDRV_PDEVICE *physDev, HPALETTE hpal, BOOL primary )
-{
- UNIMPLEMENTED;
- return FALSE;
-}
-
-HBITMAP CDECL RosDrv_SelectBitmap( NTDRV_PDEVICE *physDev, HBITMAP hbitmap )
+UINT CDECL RosDrv_RealizePalette( PDC_ATTR pdcattr, HPALETTE hpal, BOOL primary )
+{
+ UNIMPLEMENTED;
+ return FALSE;
+}
+
+HBITMAP CDECL RosDrv_SelectBitmap( PDC_ATTR pdcattr, HBITMAP hbitmap )
{
BOOL bRes;
@@ -288,7 +194,7 @@
hbitmap = (HBITMAP)MapUserHandle(hbitmap);
/* Select the bitmap into the DC */
- bRes = RosGdiSelectBitmap(physDev->hKernelDC, hbitmap);
+ bRes = RosGdiSelectBitmap(pdcattr->hKernelDC, hbitmap);
/* If there was an error, return 0 */
if (!bRes) return 0;
@@ -297,7 +203,7 @@
return hbitmap;
}
-HBRUSH CDECL RosDrv_SelectBrush( NTDRV_PDEVICE *physDev, HBRUSH hbrush )
+HBRUSH CDECL RosDrv_SelectBrush( PDC_ATTR pdcattr, HBRUSH hbrush )
{
LOGBRUSH logbrush;
@@ -306,12 +212,12 @@
if(logbrush.lbStyle == BS_PATTERN)
logbrush.lbHatch = (ULONG_PTR)MapUserHandle((HBITMAP)logbrush.lbHatch);
- RosGdiSelectBrush(physDev->hKernelDC, &logbrush);
+ RosGdiSelectBrush(pdcattr->hKernelDC, &logbrush);
return hbrush;
}
-HPEN CDECL RosDrv_SelectPen( NTDRV_PDEVICE *physDev, HPEN hpen )
+HPEN CDECL RosDrv_SelectPen( PDC_ATTR pdcattr, HPEN hpen )
{
LOGPEN logpen;
EXTLOGPEN *elogpen = NULL;
@@ -331,10 +237,10 @@
/* If it's a stock object, then use DC's color */
if (hpen == GetStockObject( DC_PEN ))
- logpen.lopnColor = GetDCPenColor(physDev->hdc);
+ logpen.lopnColor = GetDCPenColor(pdcattr->hdc);
/* Call kernelmode */
- RosGdiSelectPen(physDev->hKernelDC, &logpen, elogpen);
+ RosGdiSelectPen(pdcattr->hKernelDC, &logpen, elogpen);
/* Free ext logpen memory if it was allocated */
if (elogpen) HeapFree( GetProcessHeap(), 0, elogpen );
@@ -349,19 +255,19 @@
return 0;
}
-COLORREF CDECL RosDrv_SetDCBrushColor( NTDRV_PDEVICE *physDev, COLORREF crColor )
-{
- UNIMPLEMENTED;
- return 0;
-}
-
-COLORREF CDECL RosDrv_SetDCPenColor( NTDRV_PDEVICE *physDev, COLORREF crColor )
-{
- UNIMPLEMENTED;
- return 0;
-}
-
-BOOL CDECL RosDrv_SetDeviceGammaRamp(NTDRV_PDEVICE *physDev, LPVOID ramp)
+COLORREF CDECL RosDrv_SetDCBrushColor( PDC_ATTR pdcattr, COLORREF crColor )
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+COLORREF CDECL RosDrv_SetDCPenColor( PDC_ATTR pdcattr, COLORREF crColor )
+{
+ UNIMPLEMENTED;
+ return 0;
+}
+
+BOOL CDECL RosDrv_SetDeviceGammaRamp(PDC_ATTR pdcattr, LPVOID ramp)
{
UNIMPLEMENTED;
return FALSE;
Added: branches/arwinss/reactos/dll/win32/winent.drv/gdiobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/gdiobj.c (added)
+++ branches/arwinss/reactos/dll/win32/winent.drv/gdiobj.c [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -1,0 +1,196 @@
+/*
+ * PROJECT: ReactOS
+ * LICENSE: GNU LGPL by FSF v2.1 or any later
+ * FILE: dll/win32/winent.drv/gdidrv.c
+ * PURPOSE: GDI driver stub for ReactOS/Windows
+ * PROGRAMMERS: Aleksey Bragin (aleksey(a)reactos.org)
+ */
+
+/* INCLUDES ***************************************************************/
+
+#include "winent.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(rosgdidrv);
+
+/* GLOBALS ****************************************************************/
+static struct list handle_mapping_list = LIST_INIT( handle_mapping_list );
+static CRITICAL_SECTION handle_mapping_cs;
+static BOOL StockObjectsInitialized = FALSE;
+
+typedef struct _HMAPPING
+{
+ HGDIOBJ hUser;
+ HGDIOBJ hKernel;
+ struct list entry;
+} HMAPPING, *PHMAPPING;
+
+PGDI_TABLE_ENTRY GdiHandleTable = NULL;
+PGDI_SHARED_HANDLE_TABLE GdiSharedHandleTable = NULL;
+HANDLE CurrentProcessId = NULL;
+
+/* FUNCTIONS **************************************************************/
+
+VOID InitHandleMapping()
+{
+ InitializeCriticalSection(&handle_mapping_cs);
+}
+
+VOID AddHandleMapping(HGDIOBJ hKernel, HGDIOBJ hUser)
+{
+ PHMAPPING mapping = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HMAPPING));
+ if(!mapping)
+ return;
+
+ mapping->hKernel = hKernel;
+ mapping->hUser = hUser;
+
+ EnterCriticalSection(&handle_mapping_cs);
+ list_add_tail(&handle_mapping_list, &mapping->entry);
+ LeaveCriticalSection(&handle_mapping_cs);
+}
+
+static PHMAPPING FindHandleMapping(HGDIOBJ hUser)
+{
+ PHMAPPING item;
+
+ LIST_FOR_EACH_ENTRY( item, &handle_mapping_list, HMAPPING, entry )
+ {
+ if (item->hUser == hUser)
+ {
+ return item;
+ }
+ }
+
+ return NULL;
+}
+
+HGDIOBJ MapUserHandle(HGDIOBJ hUser)
+{
+ PHMAPPING mapping;
+
+ /* Map stock objects if not mapped yet */
+ if(!StockObjectsInitialized)
+ {
+ HGDIOBJ hKernel, hUser;
+
+ hKernel = NtGdiGetStockObject(DEFAULT_BITMAP);
+ hUser = GetStockObject( STOCK_LAST+1 );
+
+ /* Make sure that both kernel mode and user mode objects are initialized */
+ if(hKernel && hUser)
+ {
+ AddHandleMapping(NtGdiGetStockObject(DEFAULT_BITMAP), GetStockObject(
STOCK_LAST+1 ));
+ StockObjectsInitialized = TRUE;
+ }
+ }
+
+ mapping = FindHandleMapping(hUser);
+
+ return mapping ? mapping->hKernel : NULL;
+}
+
+VOID RemoveHandleMapping(HGDIOBJ hUser)
+{
+ PHMAPPING mapping;
+
+ mapping = FindHandleMapping(hUser);
+ if(mapping == NULL)
+ return;
+
+ EnterCriticalSection(&handle_mapping_cs);
+ list_remove(&mapping->entry);
+ LeaveCriticalSection(&handle_mapping_cs);
+}
+
+VOID CleanupHandleMapping()
+{
+ PHMAPPING mapping;
+
+ while(!list_empty(&handle_mapping_list))
+ {
+ mapping = LIST_ENTRY(list_head(&handle_mapping_list), HMAPPING, entry);
+ RemoveHandleMapping(mapping->hUser);
+ }
+}
+
+BOOL GdiInitHandleTable()
+{
+ if(GdiHandleTable)
+ return TRUE;
+
+ GdiHandleTable =
NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable;
+ GdiSharedHandleTable =
NtCurrentTeb()->ProcessEnvironmentBlock->GdiSharedHandleTable;
+ CurrentProcessId = NtCurrentTeb()->ClientId.UniqueProcess;
+
+ if(!GdiHandleTable)
+ return FALSE;
+
+ return TRUE;
+}
+
+BOOL GdiGetHandleUserData(HGDIOBJ hGdiObj, DWORD ObjectType, PVOID *UserData)
+{
+ PGDI_TABLE_ENTRY Entry ;
+
+ if(!GdiInitHandleTable())
+ {
+ ERR("GdiInitHandleTable failed!\n");
+ return FALSE;
+ }
+
+ Entry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hGdiObj);
+
+ if((Entry->Type & GDI_ENTRY_BASETYPE_MASK) == ObjectType &&
+ ( (Entry->Type << GDI_ENTRY_UPPER_SHIFT) & GDI_HANDLE_TYPE_MASK
) ==
+ GDI_HANDLE_GET_TYPE(hGdiObj))
+ {
+ HANDLE pid = (HANDLE)((ULONG_PTR)Entry->ProcessId & ~0x1);
+ if(pid == NULL || pid == CurrentProcessId)
+ {
+ //
+ // Need to test if we have Read & Write access to the VM address space.
+ //
+ BOOL Result = TRUE;
+ if(Entry->UserData)
+ {
+ volatile CHAR *Current = (volatile CHAR*)Entry->UserData;
+ _SEH2_TRY
+ {
+ *Current = *Current;
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Result = FALSE;
+ }
+ _SEH2_END
+ }
+ else
+ {
+ Result = FALSE; // Can not be zero.
+ ERR("Objct doesn't have user data handle 0x%x!\n",
hGdiObj);
+ }
+ if (Result) *UserData = Entry->UserData;
+ return Result;
+ }
+ else
+ {
+ ERR("Wrong user data pid handle 0x%x!\n", hGdiObj);
+ }
+ }
+ else
+ {
+ ERR("Wrong object type handle 0x%x!\n", hGdiObj);
+ }
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+}
+
+PDC_ATTR
+GdiGetDcAttr(HDC hdc)
+{
+ PDC_ATTR pdcattr;
+
+ if (!GdiGetHandleUserData((HGDIOBJ)hdc, GDI_OBJECT_TYPE_DC, (PVOID*)&pdcattr))
return NULL;
+ return pdcattr;
+}
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/gdiobj.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/arwinss/reactos/dll/win32/winent.drv/graphics.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/graphics.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/graphics.c [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -48,19 +48,19 @@
return rect;
}
-void CDECL RosDrv_SetDeviceClipping( NTDRV_PDEVICE *physDev, HRGN vis_rgn, HRGN clip_rgn
)
+void CDECL RosDrv_SetDeviceClipping( PDC_ATTR pdcattr, HRGN vis_rgn, HRGN clip_rgn )
{
RGNDATA *data;
DWORD size, i;
RECT *pRects;
- //FIXME("SetDeviceClipping hdc %x\n", physDev->hdc);
+ //FIXME("SetDeviceClipping hdc %x\n", pdcattr->hdc);
/* Update dc region to become a combined region */
- CombineRgn( physDev->region, vis_rgn, clip_rgn, clip_rgn ? RGN_AND : RGN_COPY );
+ CombineRgn( pdcattr->region, vis_rgn, clip_rgn, clip_rgn ? RGN_AND : RGN_COPY );
/* Get region data size */
- if (!(size = GetRegionData( physDev->region, 0, NULL )))
+ if (!(size = GetRegionData( pdcattr->region, 0, NULL )))
return;
/* Allocate memory for it */
@@ -68,7 +68,7 @@
return;
/* Get region data */
- if (!GetRegionData( physDev->region, size, data ))
+ if (!GetRegionData( pdcattr->region, size, data ))
{
HeapFree( GetProcessHeap(), 0, data );
return;
@@ -77,13 +77,13 @@
/* Offset all rects */
pRects = (RECT *)data->Buffer;
for (i=0; i<data->rdh.nCount; i++)
- OffsetRect(&pRects[i], physDev->dc_rect.left, physDev->dc_rect.top);
+ OffsetRect(&pRects[i], pdcattr->dc_rect.left, pdcattr->dc_rect.top);
/* Offset bounding rect */
- OffsetRect(&data->rdh.rcBound, physDev->dc_rect.left,
physDev->dc_rect.top);
+ OffsetRect(&data->rdh.rcBound, pdcattr->dc_rect.left,
pdcattr->dc_rect.top);
/* Set clipping */
- RosGdiSetDeviceClipping(physDev->hKernelDC, data->rdh.nCount, (RECTL
*)data->Buffer, (RECTL *)&data->rdh.rcBound);
+ RosGdiSetDeviceClipping(pdcattr->hKernelDC, data->rdh.nCount, (RECTL
*)data->Buffer, (RECTL *)&data->rdh.rcBound);
/* Free memory and delete clipping region */
HeapFree( GetProcessHeap(), 0, data );
@@ -95,7 +95,7 @@
*
* Performs a world-to-viewport transformation on the specified width.
*/
-INT RosDrv_XWStoDS( NTDRV_PDEVICE *physDev, INT width )
+INT RosDrv_XWStoDS( PDC_ATTR pdcattr, INT width )
{
POINT pt[2];
@@ -103,7 +103,7 @@
pt[0].y = 0;
pt[1].x = width;
pt[1].y = 0;
- LPtoDP( physDev->hdc, pt, 2 );
+ LPtoDP( pdcattr->hdc, pt, 2 );
return pt[1].x - pt[0].x;
}
@@ -112,7 +112,7 @@
*
* Performs a world-to-viewport transformation on the specified height.
*/
-INT RosDrv_YWStoDS( NTDRV_PDEVICE *physDev, INT height )
+INT RosDrv_YWStoDS( PDC_ATTR pdcattr, INT height )
{
POINT pt[2];
@@ -120,28 +120,28 @@
pt[0].y = 0;
pt[1].x = 0;
pt[1].y = height;
- LPtoDP( physDev->hdc, pt, 2 );
+ LPtoDP( pdcattr->hdc, pt, 2 );
return pt[1].y - pt[0].y;
}
-BOOL CDECL RosDrv_LineTo( NTDRV_PDEVICE *physDev, INT x, INT y )
+BOOL CDECL RosDrv_LineTo( PDC_ATTR pdcattr, INT x, INT y )
{
POINT pt[2];
/* Get current cursor position */
- GetCurrentPositionEx( physDev->hdc, &pt[0] );
+ GetCurrentPositionEx( pdcattr->hdc, &pt[0] );
/* Convert both points coordinates to device */
pt[1].x = x;
pt[1].y = y;
- LPtoDP( physDev->hdc, pt, 2 );
+ LPtoDP( pdcattr->hdc, pt, 2 );
/* Draw the line */
- return RosGdiLineTo(physDev->hKernelDC, physDev->dc_rect.left + pt[0].x,
physDev->dc_rect.top + pt[0].y,
- physDev->dc_rect.left + pt[1].x, physDev->dc_rect.top + pt[1].y);
-}
-
-BOOL CDECL RosDrv_Arc( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
+ return RosGdiLineTo(pdcattr->hKernelDC, pdcattr->dc_rect.left + pt[0].x,
pdcattr->dc_rect.top + pt[0].y,
+ pdcattr->dc_rect.left + pt[1].x, pdcattr->dc_rect.top + pt[1].y);
+}
+
+BOOL CDECL RosDrv_Arc( PDC_ATTR pdcattr, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend )
{
POINT pts[4];
@@ -157,19 +157,19 @@
pts[3].x = xend;
pts[3].y = yend;
- LPtoDP(physDev->hdc, pts, 4);
+ LPtoDP(pdcattr->hdc, pts, 4);
for (i=0; i<4; i++)
{
- pts[i].x += physDev->dc_rect.left;
- pts[i].y += physDev->dc_rect.top;
- }
-
- return RosGdiArc(physDev->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y,
+ pts[i].x += pdcattr->dc_rect.left;
+ pts[i].y += pdcattr->dc_rect.top;
+ }
+
+ return RosGdiArc(pdcattr->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y,
pts[2].x, pts[2].y, pts[3].x, pts[3].y, GdiTypeArc);
}
-BOOL CDECL RosDrv_Pie( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
+BOOL CDECL RosDrv_Pie( PDC_ATTR pdcattr, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend )
{
POINT pts[4];
@@ -185,19 +185,19 @@
pts[3].x = xend;
pts[3].y = yend;
- LPtoDP(physDev->hdc, pts, 4);
+ LPtoDP(pdcattr->hdc, pts, 4);
for (i=0; i<4; i++)
{
- pts[i].x += physDev->dc_rect.left;
- pts[i].y += physDev->dc_rect.top;
- }
-
- return RosGdiArc(physDev->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y,
+ pts[i].x += pdcattr->dc_rect.left;
+ pts[i].y += pdcattr->dc_rect.top;
+ }
+
+ return RosGdiArc(pdcattr->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y,
pts[2].x, pts[2].y, pts[3].x, pts[3].y, GdiTypePie);
}
-BOOL CDECL RosDrv_Chord( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT
bottom,
+BOOL CDECL RosDrv_Chord( PDC_ATTR pdcattr, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend )
{
POINT pts[4];
@@ -213,19 +213,19 @@
pts[3].x = xend;
pts[3].y = yend;
- LPtoDP(physDev->hdc, pts, 4);
+ LPtoDP(pdcattr->hdc, pts, 4);
for (i=0; i<4; i++)
{
- pts[i].x += physDev->dc_rect.left;
- pts[i].y += physDev->dc_rect.top;
- }
-
- return RosGdiArc(physDev->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y,
+ pts[i].x += pdcattr->dc_rect.left;
+ pts[i].y += pdcattr->dc_rect.top;
+ }
+
+ return RosGdiArc(pdcattr->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y,
pts[2].x, pts[2].y, pts[3].x, pts[3].y, GdiTypeChord );
}
-BOOL CDECL RosDrv_Ellipse( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT
bottom )
+BOOL CDECL RosDrv_Ellipse( PDC_ATTR pdcattr, INT left, INT top, INT right, INT bottom )
{
POINT pts[2];
DWORD i;
@@ -236,21 +236,21 @@
pts[1].x = right;
pts[1].y = bottom;
- LPtoDP(physDev->hdc, pts, 2);
+ LPtoDP(pdcattr->hdc, pts, 2);
for (i=0; i<2; i++)
{
- pts[i].x += physDev->dc_rect.left;
- pts[i].y += physDev->dc_rect.top;
- }
-
- return RosGdiEllipse(physDev->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y);
-}
-
-BOOL CDECL RosDrv_Rectangle(NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT
bottom)
+ pts[i].x += pdcattr->dc_rect.left;
+ pts[i].y += pdcattr->dc_rect.top;
+ }
+
+ return RosGdiEllipse(pdcattr->hKernelDC, pts[0].x, pts[0].y, pts[1].x, pts[1].y);
+}
+
+BOOL CDECL RosDrv_Rectangle(PDC_ATTR pdcattr, INT left, INT top, INT right, INT bottom)
{
POINT ptBrush;
- RECT rc = get_device_rect( physDev->hdc, left, top, right, bottom );
+ RECT rc = get_device_rect( pdcattr->hdc, left, top, right, bottom );
if ((rc.left == rc.right) || (rc.top == rc.bottom)) return TRUE;
@@ -258,53 +258,53 @@
if (rc.bottom < rc.top) { INT tmp = rc.bottom; rc.bottom = rc.top; rc.top = tmp;
}
/* Update brush origin */
- GetBrushOrgEx(physDev->hdc, &ptBrush);
- ptBrush.x += physDev->dc_rect.left;
- ptBrush.y += physDev->dc_rect.top;
- RosGdiSetBrushOrg(physDev->hKernelDC, ptBrush.x, ptBrush.y);
-
- OffsetRect(&rc, physDev->dc_rect.left, physDev->dc_rect.top);
- RosGdiRectangle(physDev->hKernelDC, &rc);
+ GetBrushOrgEx(pdcattr->hdc, &ptBrush);
+ ptBrush.x += pdcattr->dc_rect.left;
+ ptBrush.y += pdcattr->dc_rect.top;
+ RosGdiSetBrushOrg(pdcattr->hKernelDC, ptBrush.x, ptBrush.y);
+
+ OffsetRect(&rc, pdcattr->dc_rect.left, pdcattr->dc_rect.top);
+ RosGdiRectangle(pdcattr->hKernelDC, &rc);
return TRUE;
}
-BOOL CDECL RosDrv_RoundRect( NTDRV_PDEVICE *physDev, INT left, INT top, INT right,
+BOOL CDECL RosDrv_RoundRect( PDC_ATTR pdcattr, INT left, INT top, INT right,
INT bottom, INT ell_width, INT ell_height )
{
UNIMPLEMENTED;
return FALSE;
}
-COLORREF CDECL RosDrv_SetPixel( NTDRV_PDEVICE *physDev, INT x, INT y, COLORREF color )
+COLORREF CDECL RosDrv_SetPixel( PDC_ATTR pdcattr, INT x, INT y, COLORREF color )
{
POINT ptPixel;
/* Transform to device coordinates */
ptPixel.x = x; ptPixel.y = y;
- LPtoDP(physDev->hdc, &ptPixel, 1);
-
- return RosGdiSetPixel(physDev->hKernelDC, physDev->dc_rect.left + ptPixel.x,
physDev->dc_rect.top + ptPixel.y, color);
-}
-
-COLORREF CDECL RosDrv_GetPixel( NTDRV_PDEVICE *physDev, INT x, INT y )
+ LPtoDP(pdcattr->hdc, &ptPixel, 1);
+
+ return RosGdiSetPixel(pdcattr->hKernelDC, pdcattr->dc_rect.left + ptPixel.x,
pdcattr->dc_rect.top + ptPixel.y, color);
+}
+
+COLORREF CDECL RosDrv_GetPixel( PDC_ATTR pdcattr, INT x, INT y )
{
POINT ptPixel;
/* Transform to device coordinates */
ptPixel.x = x; ptPixel.y = y;
- LPtoDP(physDev->hdc, &ptPixel, 1);
-
- return RosGdiGetPixel(physDev->hKernelDC, physDev->dc_rect.left + ptPixel.x,
physDev->dc_rect.top + ptPixel.y);
-}
-
-BOOL CDECL RosDrv_PaintRgn( NTDRV_PDEVICE *physDev, HRGN hrgn )
+ LPtoDP(pdcattr->hdc, &ptPixel, 1);
+
+ return RosGdiGetPixel(pdcattr->hKernelDC, pdcattr->dc_rect.left + ptPixel.x,
pdcattr->dc_rect.top + ptPixel.y);
+}
+
+BOOL CDECL RosDrv_PaintRgn( PDC_ATTR pdcattr, HRGN hrgn )
{
UNIMPLEMENTED;
return FALSE;
}
-BOOL CDECL RosDrv_Polyline( NTDRV_PDEVICE *physDev, const POINT* pt, INT count )
+BOOL CDECL RosDrv_Polyline( PDC_ATTR pdcattr, const POINT* pt, INT count )
{
register int i;
POINT *points;
@@ -317,19 +317,19 @@
for (i = 0; i < count; i++)
{
POINT tmp = pt[i];
- LPtoDP(physDev->hdc, &tmp, 1);
- points[i].x = physDev->dc_rect.left + tmp.x;
- points[i].y = physDev->dc_rect.top + tmp.y;
+ LPtoDP(pdcattr->hdc, &tmp, 1);
+ points[i].x = pdcattr->dc_rect.left + tmp.x;
+ points[i].y = pdcattr->dc_rect.top + tmp.y;
}
/* Call kernel mode */
- RosGdiPolyline(physDev->hKernelDC, points, count);
+ RosGdiPolyline(pdcattr->hKernelDC, points, count);
HeapFree( GetProcessHeap(), 0, points );
return TRUE;
}
-BOOL CDECL RosDrv_Polygon( NTDRV_PDEVICE *physDev, const POINT* pt, INT count )
+BOOL CDECL RosDrv_Polygon( PDC_ATTR pdcattr, const POINT* pt, INT count )
{
register int i;
POINT *points;
@@ -343,38 +343,38 @@
for (i = 0; i < count; i++)
{
POINT tmp = pt[i];
- LPtoDP(physDev->hdc, &tmp, 1);
- points[i].x = physDev->dc_rect.left + tmp.x;
- points[i].y = physDev->dc_rect.top + tmp.y;
+ LPtoDP(pdcattr->hdc, &tmp, 1);
+ points[i].x = pdcattr->dc_rect.left + tmp.x;
+ points[i].y = pdcattr->dc_rect.top + tmp.y;
}
points[count] = points[0];
/* Update brush origin */
- GetBrushOrgEx(physDev->hdc, &ptBrush);
- ptBrush.x += physDev->dc_rect.left;
- ptBrush.y += physDev->dc_rect.top;
- RosGdiSetBrushOrg(physDev->hKernelDC, ptBrush.x, ptBrush.y);
+ GetBrushOrgEx(pdcattr->hdc, &ptBrush);
+ ptBrush.x += pdcattr->dc_rect.left;
+ ptBrush.y += pdcattr->dc_rect.top;
+ RosGdiSetBrushOrg(pdcattr->hKernelDC, ptBrush.x, ptBrush.y);
/* Call kernel mode */
- RosGdiPolygon(physDev->hKernelDC, points, count+1);
+ RosGdiPolygon(pdcattr->hKernelDC, points, count+1);
HeapFree( GetProcessHeap(), 0, points );
return TRUE;
}
-BOOL CDECL RosDrv_PolyPolygon( NTDRV_PDEVICE *physDev, const POINT* pt, const INT*
counts, UINT polygons)
+BOOL CDECL RosDrv_PolyPolygon( PDC_ATTR pdcattr, const POINT* pt, const INT* counts, UINT
polygons)
{
UNIMPLEMENTED;
return FALSE;
}
-BOOL CDECL RosDrv_PolyPolyline( NTDRV_PDEVICE *physDev, const POINT* pt, const DWORD*
counts, DWORD polylines )
+BOOL CDECL RosDrv_PolyPolyline( PDC_ATTR pdcattr, const POINT* pt, const DWORD* counts,
DWORD polylines )
{
UNIMPLEMENTED;
return FALSE;
}
-BOOL CDECL RosDrv_ExtFloodFill( NTDRV_PDEVICE *physDev, INT x, INT y, COLORREF color,
+BOOL CDECL RosDrv_ExtFloodFill( PDC_ATTR pdcattr, INT x, INT y, COLORREF color,
UINT fillType )
{
POINT ptPixel;
@@ -382,28 +382,28 @@
/* Transform to device coordinates */
ptPixel.x = x; ptPixel.y = y;
- LPtoDP(physDev->hdc, &ptPixel, 1);
-
- return RosGdiExtFloodFill(physDev->hKernelDC, physDev->dc_rect.left +
ptPixel.x, physDev->dc_rect.top + ptPixel.y, color, fillType);
-}
-
-COLORREF CDECL RosDrv_SetBkColor( NTDRV_PDEVICE *physDev, COLORREF color )
-{
- return RosGdiSetBkColor(physDev->hKernelDC, color);
-}
-
-COLORREF CDECL RosDrv_SetTextColor( NTDRV_PDEVICE *physDev, COLORREF color )
-{
- return RosGdiSetTextColor(physDev->hKernelDC, color);
-}
-
-BOOL CDECL RosDrv_GetICMProfile( NTDRV_PDEVICE *physDev, LPDWORD size, LPWSTR filename )
+ LPtoDP(pdcattr->hdc, &ptPixel, 1);
+
+ return RosGdiExtFloodFill(pdcattr->hKernelDC, pdcattr->dc_rect.left +
ptPixel.x, pdcattr->dc_rect.top + ptPixel.y, color, fillType);
+}
+
+COLORREF CDECL RosDrv_SetBkColor( PDC_ATTR pdcattr, COLORREF color )
+{
+ return RosGdiSetBkColor(pdcattr->hKernelDC, color);
+}
+
+COLORREF CDECL RosDrv_SetTextColor( PDC_ATTR pdcattr, COLORREF color )
+{
+ return RosGdiSetTextColor(pdcattr->hKernelDC, color);
+}
+
+BOOL CDECL RosDrv_GetICMProfile( PDC_ATTR pdcattr, LPDWORD size, LPWSTR filename )
{
UNIMPLEMENTED;
return FALSE;
}
-INT CDECL RosDrv_EnumICMProfiles( NTDRV_PDEVICE *physDev, ICMENUMPROCW proc, LPARAM
lparam )
+INT CDECL RosDrv_EnumICMProfiles( PDC_ATTR pdcattr, ICMENUMPROCW proc, LPARAM lparam )
{
UNIMPLEMENTED;
return 0;
Modified: branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -53,26 +53,26 @@
return TRUE;
}
-INT CDECL RosDrv_ChoosePixelFormat(NTDRV_PDEVICE *physDev,
+INT CDECL RosDrv_ChoosePixelFormat(PDC_ATTR pdcattr,
CONST PIXELFORMATDESCRIPTOR *ppfd)
{
if (!glChoosePixelFormat)
if (!InitOGL())
return 0;
- return glChoosePixelFormat(physDev->hdc, ppfd);
+ return glChoosePixelFormat(pdcattr->hdc, ppfd);
}
-INT CDECL RosDrv_GetPixelFormat(NTDRV_PDEVICE *physDev)
+INT CDECL RosDrv_GetPixelFormat(PDC_ATTR pdcattr)
{
if (!glGetPixelFormat)
if (!InitOGL())
return 0;
- return glGetPixelFormat(physDev->hdc);
+ return glGetPixelFormat(pdcattr->hdc);
}
-INT CDECL RosDrv_DescribePixelFormat(NTDRV_PDEVICE *physDev,
+INT CDECL RosDrv_DescribePixelFormat(PDC_ATTR pdcattr,
INT iPixelFormat,
UINT nBytes,
PIXELFORMATDESCRIPTOR *ppfd)
@@ -81,10 +81,10 @@
if (!InitOGL())
return 0;
- return glDescribePixelFormat(physDev->hdc, iPixelFormat, nBytes, ppfd);
+ return glDescribePixelFormat(pdcattr->hdc, iPixelFormat, nBytes, ppfd);
}
-BOOL CDECL RosDrv_SetPixelFormat(NTDRV_PDEVICE *physDev,
+BOOL CDECL RosDrv_SetPixelFormat(PDC_ATTR pdcattr,
INT iPixelFormat,
CONST PIXELFORMATDESCRIPTOR *ppfd)
{
@@ -92,17 +92,17 @@
if (!InitOGL())
return 0;
- return glSetPixelFormat(physDev->hdc, iPixelFormat, ppfd);
+ return glSetPixelFormat(pdcattr->hdc, iPixelFormat, ppfd);
}
-BOOL CDECL RosDrv_SwapBuffers(NTDRV_PDEVICE *physDev)
+BOOL CDECL RosDrv_SwapBuffers(PDC_ATTR pdcattr)
{
if (!glSwapBuffers)
if (!InitOGL())
return 0;
- return glSwapBuffers(physDev->hdc);
+ return glSwapBuffers(pdcattr->hdc);
}
/* EOF */
Modified: branches/arwinss/reactos/dll/win32/winent.drv/winent.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/winent.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/winent.h [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -36,6 +36,7 @@
#include "wine/list.h"
#include "wine/unicode.h"
#include "wine/server.h"
+#include "win32k/ntgdihdl.h"
#include <pseh/pseh2.h>
/* GDI escapes */
@@ -98,27 +99,31 @@
/* clipboard.c */
void NTDRV_InitClipboard(void);
+
+/* gdidrv.c */
+void CDECL RosDrv_SetDeviceClipping( PDC_ATTR pdcattr, HRGN vis_rgn, HRGN clip_rgn );
+
+/* gdiobj.c */
VOID InitHandleMapping();
VOID AddHandleMapping(HGDIOBJ hKernel, HGDIOBJ hUser);
HGDIOBJ MapUserHandle(HGDIOBJ hUser);
VOID RemoveHandleMapping(HGDIOBJ hUser);
VOID CleanupHandleMapping();
-/* gdidrv.c */
-void CDECL RosDrv_SetDeviceClipping( NTDRV_PDEVICE *physDev, HRGN vis_rgn, HRGN clip_rgn
);
+PDC_ATTR GdiGetDcAttr(HDC hdc);
/* graphics.c */
-INT RosDrv_XWStoDS( NTDRV_PDEVICE *physDev, INT width );
-INT RosDrv_YWStoDS( NTDRV_PDEVICE *physDev, INT height );
+INT RosDrv_XWStoDS( PDC_ATTR pdcattr, INT width );
+INT RosDrv_YWStoDS( PDC_ATTR pdcattr, INT height );
HGDIOBJ MapHandle(HGDIOBJ hUser);
/* font.c */
VOID
-FeSelectFont(NTDRV_PDEVICE *physDev, HFONT hFont);
+FeSelectFont(PDC_ATTR pdcattr, HFONT hFont);
BOOL
-FeTextOut( NTDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
+FeTextOut( PDC_ATTR pdcattr, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR wstr, UINT count,
const INT *lpDx );
Modified: branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -12,6 +12,7 @@
<file>event.c</file>
<file>font.c</file>
<file>gdidrv.c</file>
+ <file>gdiobj.c</file>
<file>graphics.c</file>
<file>main.c</file>
<file>userdrv.c</file>
Modified: branches/arwinss/reactos/include/reactos/win32k/ntgdihdl.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/reactos…
==============================================================================
--- branches/arwinss/reactos/include/reactos/win32k/ntgdihdl.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/include/reactos/win32k/ntgdihdl.h [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -242,6 +242,7 @@
DWORD dwCFCount;
} GDI_SHARED_HANDLE_TABLE, *PGDI_SHARED_HANDLE_TABLE;
+#if 0
typedef struct _RGN_ATTR
{
ULONG AttrFlags;
@@ -329,6 +330,19 @@
RGN_ATTR VisRectRegion;
} DC_ATTR, *PDC_ATTR;
+#else
+
+typedef struct _DC_ATTR
+{
+ HDC hdc;
+ HDC hKernelDC;
+ RECT dc_rect; /* DC rectangle relative to drawable */
+ HRGN region; /* Device region (visible region & clip region) */
+ int cache_index; /* cache of a currently selected font */
+} DC_ATTR, *PDC_ATTR;
+
+#endif
+
typedef struct _BRUSH_ATTR /* Used with pen too. */
{
FLONG AttrFlags;
Modified: branches/arwinss/reactos/include/reactos/wine/ntrosgdi.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/reactos…
==============================================================================
--- branches/arwinss/reactos/include/reactos/wine/ntrosgdi.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/include/reactos/wine/ntrosgdi.h [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -7,15 +7,6 @@
#ifndef W32KAPI
#define W32KAPI DECLSPEC_ADDRSAFE
#endif
-
-typedef struct _NTDRV_PDEVICE
-{
- HDC hdc;
- HDC hKernelDC;
- RECT dc_rect; /* DC rectangle relative to drawable */
- HRGN region; /* Device region (visible region & clip region) */
- int cache_index; /* cache of a currently selected font */
-} NTDRV_PDEVICE, *PNTDRV_PDEVICE;
typedef struct
{
Modified: branches/arwinss/reactos/subsystems/win32/win32k/eng/device.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/eng/device.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/eng/device.c [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -1224,7 +1224,7 @@
return (pGdiInfo->cBitsPixel > 8) ? -1 : (1 <<
pGdiInfo->cBitsPixel);
//return pGdiInfo->ulNumColors;
case PDEVICESIZE:
- return sizeof(NTDRV_PDEVICE);
+ return 0;
case CURVECAPS:
return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -56,6 +56,45 @@
return TRUE;
}
+VOID
+FASTCALL
+DC_AllocateDcAttr(HDC hDC)
+{
+ PVOID NewMem = NULL;
+ PDC pDC;
+ HANDLE Pid = NtCurrentProcess();
+ ULONG MemSize = sizeof(DC_ATTR); //PAGE_SIZE it will allocate that size
+
+ NTSTATUS Status = ZwAllocateVirtualMemory(Pid,
+ &NewMem,
+ 0,
+ &MemSize,
+ MEM_COMMIT|MEM_RESERVE,
+ PAGE_READWRITE);
+ {
+ INT Index = GDI_HANDLE_GET_INDEX((HGDIOBJ)hDC);
+ PGDI_TABLE_ENTRY Entry = &GdiHandleTable->Entries[Index];
+ // FIXME: dc could have been deleted!!! use GDIOBJ_InsertUserData
+ if (NT_SUCCESS(Status))
+ {
+ RtlZeroMemory(NewMem, MemSize);
+ Entry->UserData = NewMem;
+ DPRINT("DC_ATTR allocated! 0x%x\n",NewMem);
+ }
+ else
+ {
+ DPRINT("DC_ATTR not allocated!\n");
+ }
+ }
+ pDC = DC_LockDc(hDC);
+
+ if(NewMem)
+ {
+ pDC->pdcattr = NewMem; // Store pointer
+ }
+ DC_UnlockDc(pDC);
+}
+
BOOL APIENTRY RosGdiCreateDC( HDC *pdev, LPCWSTR driver, LPCWSTR device,
LPCWSTR output, const DEVMODEW* initData, ULONG dcType )
{
@@ -75,6 +114,9 @@
/* Set physical device pointer */
pNewDC->ppdev = (PVOID)&PrimarySurface;
+
+ /* Allocate dc shared memory */
+ DC_AllocateDcAttr(hNewDC);
/* Set default fg/bg colors */
pNewDC->crBackgroundClr = RGB(255, 255, 255);
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -19,6 +19,8 @@
BASEOBJECT BaseObject;
PPDEVOBJ ppdev;
+
+ PDC_ATTR pdcattr;
DCLEVEL dclevel;
ULONG type;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/main/init.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/main/init.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/main/init.c [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -77,6 +77,13 @@
list_init(&Win32Process->Classes);
Win32Process->handles = alloc_handle_table(Win32Process, 0);
connect_process_winstation(Win32Process);
+
+ if(Process->Peb != NULL)
+ {
+ /* map the gdi handle table to user land */
+ Process->Peb->GdiSharedHandleTable =
GDI_MapHandleTable(GdiTableSection, Process);
+ Process->Peb->GdiDCAttributeList = GDI_BATCH_LIMIT;
+ }
}
else
{
Modified: branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] Wed Jan 12
12:50:22 2011
@@ -133,7 +133,6 @@
</if>
</directory>
<directory name="swm">
- <file>swmevent.c</file>
<file>winman.c</file>
</directory>
<directory name="wine">