Author: tkreuzer
Date: Fri Nov 30 05:14:58 2007
New Revision: 30906
URL:
http://svn.reactos.org/svn/reactos?rev=30906&view=rev
Log:
Beginning of an implementation of SelectObject, using NtGdiSelectBitmap, NtGdiSelectBrush,
NtGdiselectFont, NtGdiSelectPen and ExtSelectClipRgn instead of NtGdiSelectObject.
Todo: Do most stuff in user mode
Modified:
trunk/reactos/dll/win32/gdi32/misc/hacks.c
trunk/reactos/dll/win32/gdi32/objects/dc.c
Modified: trunk/reactos/dll/win32/gdi32/misc/hacks.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/hacks…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/misc/hacks.c (original)
+++ trunk/reactos/dll/win32/gdi32/misc/hacks.c Fri Nov 30 05:14:58 2007
@@ -48,17 +48,6 @@
NULL);
}
-/*
- * @implemented
- *
- */
-HGDIOBJ
-STDCALL
-SelectObject(HDC hdc,
- HGDIOBJ hgdiobj)
-{
- return NtGdiSelectObject(hdc,hgdiobj);
-}
/*
* @implemented
Modified: trunk/reactos/dll/win32/gdi32/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/dc…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/dc.c (original)
+++ trunk/reactos/dll/win32/gdi32/objects/dc.c Fri Nov 30 05:14:58 2007
@@ -1333,3 +1333,58 @@
}
+/*
+ * @implemented
+ *
+ */
+HGDIOBJ
+STDCALL
+SelectObject(HDC hDC,
+ HGDIOBJ hGdiObj)
+{
+ PDC_ATTR pDc_Attr;
+// HGDIOBJ hOldObj = NULL;
+
+ if(!GdiGetHandleUserData(hDC, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr))
+ {
+ SetLastError(ERROR_INVALID_HANDLE);
+ return NULL;
+ }
+
+ hGdiObj = GdiFixUpHandle(hGdiObj);
+ if (!GdiIsHandleValid(hGdiObj))
+ {
+ return NULL;
+ }
+
+ UINT uType = GDI_HANDLE_GET_TYPE(hGdiObj);
+
+ switch (uType)
+ {
+ case GDI_OBJECT_TYPE_PALETTE:
+ SetLastError(ERROR_INVALID_FUNCTION);
+ return NULL;
+
+ case GDI_OBJECT_TYPE_REGION:
+ return (HGDIOBJ)ExtSelectClipRgn(hDC, hGdiObj, RGN_COPY);
+
+ case GDI_OBJECT_TYPE_BITMAP:
+ return NtGdiSelectBitmap(hDC, hGdiObj);
+
+ case GDI_OBJECT_TYPE_BRUSH:
+ return NtGdiSelectBrush(hDC, hGdiObj);
+
+ case GDI_OBJECT_TYPE_PEN:
+ case GDI_OBJECT_TYPE_EXTPEN:
+ return NtGdiSelectPen(hDC, hGdiObj);
+
+ case GDI_OBJECT_TYPE_FONT:
+ return NtGdiSelectFont(hDC, hGdiObj);
+
+ }
+
+ return NULL;
+}
+
+
+