implemented GetCurrentObject()
authorThomas Bluemel <thomas@reactsoft.com>
Sun, 25 Apr 2004 15:31:43 +0000 (15:31 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Sun, 25 Apr 2004 15:31:43 +0000 (15:31 +0000)
svn path=/trunk/; revision=9217

reactos/include/defines.h
reactos/lib/gdi32/misc/stubs.c
reactos/lib/gdi32/objects/dc.c
reactos/subsys/win32k/objects/dc.c

index e71c521..3c6b00d 100644 (file)
@@ -1092,19 +1092,20 @@ extern "C" {
 #define TRUETYPE_FONTTYPE      (4)
 
 /* EnumObjects, GetCurrentObject, GetObjectType */
-#define OBJ_BRUSH      (2)
 #define OBJ_PEN        (1)
+#define OBJ_BRUSH      (2)
+#define OBJ_DC (3)
+#define OBJ_METADC     (4)
 #define OBJ_PAL        (5)
 #define OBJ_FONT       (6)
 #define OBJ_BITMAP     (7)
-#define OBJ_EXTPEN     (11)
 #define OBJ_REGION     (8)
-#define OBJ_DC (3)
-#define OBJ_MEMDC      (10)
 #define OBJ_METAFILE   (9)
-#define OBJ_METADC     (4)
-#define OBJ_ENHMETAFILE        (13)
+#define OBJ_MEMDC      (10)
+#define OBJ_EXTPEN     (11)
 #define OBJ_ENHMETADC  (12)
+#define OBJ_ENHMETAFILE        (13)
+#define OBJ_COLORSPACE (14)
 
 /* EnumPrinters */
 
index 016457c..ab3eeb8 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.55 2004/04/25 14:46:53 weiden Exp $
+/* $Id: stubs.c,v 1.56 2004/04/25 15:31:43 weiden Exp $
  *
  * reactos/lib/gdi32/misc/stubs.c
  *
@@ -256,21 +256,6 @@ GetMetaRgn(
 }
 
 
-/*
- * @unimplemented
- */
-HGDIOBJ
-STDCALL
-GetCurrentObject(
-       HDC     a0,
-       UINT    a1
-       )
-{
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 0;
-}
-
-
 /*
  * @unimplemented
  */
index d9e1dc8..643333a 100644 (file)
@@ -1030,3 +1030,16 @@ FixBrushOrgEx(
   return FALSE;
 }
 
+
+/*
+ * @implemented
+ */
+HGDIOBJ
+STDCALL
+GetCurrentObject(
+       HDC     hdc,
+       UINT    uObjectType
+       )
+{
+  return NtGdiGetCurrentObject(hdc, uObjectType);
+}
index f930ace..78e6494 100644 (file)
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: dc.c,v 1.130 2004/04/25 12:51:53 weiden Exp $
+/* $Id: dc.c,v 1.131 2004/04/25 15:31:43 weiden Exp $
  *
  * DC.C - Device context functions
  *
 #define NDEBUG
 #include <win32k/debug1.h>
 
+#ifndef OBJ_COLORSPACE
+#define OBJ_COLORSPACE (14)
+#endif
+
 static GDIDEVICE PrimarySurface;
 
 /* FIXME: DCs should probably be thread safe  */
@@ -962,7 +966,43 @@ DC_GET_VAL( HRGN, NtGdiGetClipRgn, w.hClipRgn )
 HGDIOBJ STDCALL
 NtGdiGetCurrentObject(HDC  hDC, UINT  ObjectType)
 {
-  UNIMPLEMENTED;
+  HGDIOBJ SelObject;
+  DC *dc;
+  
+  if(!(dc = DC_LockDc(hDC)))
+  {
+    SetLastWin32Error(ERROR_INVALID_HANDLE);
+    return NULL;
+  }
+  
+  switch(ObjectType)
+  {
+    case OBJ_PEN:
+      SelObject = dc->w.hPen;
+      break;
+    case OBJ_BRUSH:
+      SelObject = dc->w.hBrush;
+      break;
+    case OBJ_PAL:
+      DPRINT1("FIXME: NtGdiGetCurrentObject() ObjectType OBJ_PAL not supported yet!\n");
+      break;
+    case OBJ_FONT:
+      SelObject = dc->w.hFont;
+      break;
+    case OBJ_BITMAP:
+      SelObject = dc->w.hBitmap;
+      break;
+    case OBJ_COLORSPACE:
+      DPRINT1("FIXME: NtGdiGetCurrentObject() ObjectType OBJ_COLORSPACE not supported yet!\n");
+      break;
+    default:
+      SelObject = NULL;
+      SetLastWin32Error(ERROR_INVALID_PARAMETER);
+      break;
+  }
+  
+  DC_UnlockDc(hDC);
+  return SelObject;
 }
 
 DC_GET_VAL_EX ( GetCurrentPositionEx, w.CursPosX, w.CursPosY, POINT, x, y )