Dc.c :
authorJames Tabor <james.tabor@reactos.org>
Sat, 4 Aug 2007 07:37:27 +0000 (07:37 +0000)
committerJames Tabor <james.tabor@reactos.org>
Sat, 4 Aug 2007 07:37:27 +0000 (07:37 +0000)
- Update Get/SetDCBrush/PenColor code.
  * Added dcattr sync flags to Set functions.
  * if'ed out, does compile.
Painting.c :
- Update LP to DP to LP code.
  * Added update flags for Xforms, the best way I understand them.
  * if'ed out.
- Moved Fixme line down and above GetDCObject.

svn path=/trunk/; revision=28150

reactos/dll/win32/gdi32/objects/dc.c
reactos/dll/win32/gdi32/objects/painting.c
reactos/include/psdk/wingdi.h

index 0cbc60d..1e2d4d0 100644 (file)
@@ -544,6 +544,12 @@ GetDCBrushColor(
        HDC hdc
 )
 {
+#if 0
+  PDC_ATTR Dc_Attr;
+  if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return CLR_INVALID;
+  return (COLORREF) Dc_Attr->ulPenClr;
+#endif
   return NtUserGetDCBrushColor(hdc);
 }
 
@@ -556,6 +562,12 @@ GetDCPenColor(
        HDC hdc
 )
 {
+#if 0
+  PDC_ATTR Dc_Attr;
+  if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return CLR_INVALID;
+  return (COLORREF) Dc_Attr->ulPenClr;
+#endif
   return NtUserGetDCPenColor(hdc);
 }
 
@@ -569,6 +581,24 @@ SetDCBrushColor(
        COLORREF crColor
 )
 {
+#if 0
+  PDC_ATTR Dc_Attr;
+  COLORREF OldColor = CLR_INVALID;
+
+  if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return OldColor;
+  else
+  {
+    OldColor = (COLORREF) Dc_Attr->ulBrushClr;
+    Dc_Attr->ulBrushClr = (ULONG) crColor;
+
+    if ( Dc_Attr->crBrushClr != crColor ) // if same, don't force a copy.
+    {
+       Dc_Attr->ulDirty_ |= DIRTY_FILL;
+       Dc_Attr->crBrushClr = crColor;
+    }
+  }
+  return OldColor;
+#endif
   return NtUserSetDCBrushColor(hdc, crColor);
 }
 
@@ -582,6 +612,24 @@ SetDCPenColor(
        COLORREF crColor
 )
 {
+#if 0
+  PDC_ATTR Dc_Attr;
+  COLORREF OldColor = CLR_INVALID;
+
+  if (!GdiGetHandleUserData((HGDIOBJ) hdc, (PVOID) &Dc_Attr)) return OldColor;
+  else
+  {
+     OldColor = (COLORREF) Dc_Attr->ulPenClr;
+     Dc_Attr->ulPenClr = (ULONG) crColor;
+
+    if ( Dc_Attr->crPenClr != crColor )
+    {
+       Dc_Attr->ulDirty_ |= DIRTY_LINE;
+       Dc_Attr->crPenClr = crColor;
+    }
+  }
+  return OldColor;
+#endif
   return NtUserSetDCPenColor(hdc, crColor);
 }
 
index 6cb531c..5a56201 100644 (file)
@@ -18,7 +18,6 @@
           __asm fistp out
 #endif
 
-#if 0 /* FIXME: enable this as soon as we have working usermode gdi */
 LONG
 FASTCALL
 EFtoF( EFLOAT_S * efp)
@@ -93,14 +92,26 @@ BOOL
 STDCALL
 DPtoLP ( HDC hDC, LPPOINT Points, INT Count )
 {
+#if 0
   INT i;
   PDC_ATTR Dc_Attr;
  
   if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return FALSE;
 
-  for ( i = 0; i < Count; i++ )
-    CoordCnvP ( &Dc_Attr->mxDevicetoWorld, &Points[i] );
+  if (Dc_Attr->flXform & ( DEVICE_TO_WORLD_INVALID | // Force a full recalibration!
+                           PAGE_XLATE_CHANGED      | // Changes or Updates have been made,
+                           PAGE_EXTENTS_CHANGED    | // do processing in kernel space.
+                           WORLD_XFORM_CHANGED )
+#endif
+    return NtGdiTransformPoints( hDC, Points, Points, Count, 0); // Last is 0 or 2
+#if 0
+  else
+  {
+    for ( i = 0; i < Count; i++ )
+      CoordCnvP ( &Dc_Attr->mxDevicetoWorld, &Points[i] );
+  }
   return TRUE;
+#endif
 }
 
 
@@ -108,16 +119,28 @@ BOOL
 STDCALL
 LPtoDP ( HDC hDC, LPPOINT Points, INT Count )
 {
+#if 0
   INT i;
   PDC_ATTR Dc_Attr;
  
   if (!GdiGetHandleUserData((HGDIOBJ) hDC, (PVOID) &Dc_Attr)) return FALSE;
 
-  for ( i = 0; i < Count; i++ )
-    CoordCnvP ( &Dc_Attr->mxWorldToDevice, &Points[i] );
+  if (Dc_Attr->flXform & ( PAGE_XLATE_CHANGED   |  // Check for Changes and Updates
+                           PAGE_EXTENTS_CHANGED |
+                           WORLD_XFORM_CHANGED )
+#endif
+    return NtGdiTransformPoints( hDC, Points, Points, Count, 0);
+#if 0
+  else
+  {
+    for ( i = 0; i < Count; i++ )
+      CoordCnvP ( &Dc_Attr->mxWorldToDevice, &Points[i] );
+  }
   return TRUE;
+#endif
 }
 
+#if 0 /* FIXME: enable this as soon as we have working usermode gdi */
 
 // Will move to dc.c
 HGDIOBJ
index 6798812..35feb20 100644 (file)
@@ -2753,6 +2753,10 @@ HGDIOBJ WINAPI GetCurrentObject(HDC,UINT);
 BOOL WINAPI GetCurrentPositionEx(HDC,LPPOINT);
 HCURSOR WINAPI GetCursor(void);
 BOOL WINAPI GetDCOrgEx(HDC,LPPOINT);
+#if (_WIN32_WINNT >= 0x0500)
+COLORREF WINAPI GetDCBrushColor(HDC);
+COLORREF WINAPI GetDCPenColor(HDC);
+#endif
 int WINAPI GetDeviceCaps(HDC,int);
 BOOL WINAPI GetDeviceGammaRamp(HDC,PVOID);
 UINT WINAPI GetDIBColorTable(HDC,UINT,UINT,RGBQUAD*);