update for HEAD-2003091401
[reactos.git] / subsys / win32k / eng / surface.c
index dfa33be..6c5e9a7 100644 (file)
@@ -1,4 +1,23 @@
 /*
+ *  ReactOS W32 Subsystem
+ *  Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/* $Id$
+ * 
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
  * PURPOSE:           GDI Driver Surace Functions
@@ -14,6 +33,7 @@
 
 #include <ddk/winddi.h>
 #include <win32k/dc.h>
+#include <win32k/gdiobj.h>
 #include <include/dib.h>
 #include <include/object.h>
 #include <include/paint.h>
@@ -23,7 +43,7 @@
 #define NDEBUG
 #include <win32k/debug1.h>
 
-INT BitsPerFormat(ULONG Format)
+INT FASTCALL BitsPerFormat(ULONG Format)
 {
   switch(Format)
   {
@@ -39,7 +59,7 @@ INT BitsPerFormat(ULONG Format)
   }
 }
 
-ULONG BitmapFormat(WORD Bits, DWORD Compression)
+ULONG FASTCALL BitmapFormat(WORD Bits, DWORD Compression)
 {
   switch(Compression)
   {
@@ -79,12 +99,20 @@ static VOID Dummy_VLine(PSURFOBJ SurfObj, LONG x, LONG y1, LONG y2, ULONG c)
 static BOOLEAN Dummy_BitBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf,
                             SURFGDI *DestGDI,  SURFGDI *SourceGDI,
                             PRECTL  DestRect,  POINTL  *SourcePoint,
-                            XLATEOBJ *ColorTranslation)
+                           PBRUSHOBJ BrushObj, POINTL* BrushOrign,
+                            XLATEOBJ *ColorTranslation, ULONG Rop4)
 {
   return FALSE;
 }
 
-VOID InitializeFuncs(SURFGDI *SurfGDI, ULONG BitmapFormat)
+#define SURF_METHOD(c,n) DIB_##c##_##n
+#define SET_SURFGDI(c)\
+ SurfGDI->DIB_PutPixel=SURF_METHOD(c,PutPixel);\
+ SurfGDI->DIB_HLine=SURF_METHOD(c,HLine);\
+ SurfGDI->DIB_VLine=SURF_METHOD(c,VLine);\
+ SurfGDI->DIB_BitBlt=SURF_METHOD(c,BitBlt);
+
+VOID FASTCALL InitializeFuncs(SURFGDI *SurfGDI, ULONG BitmapFormat)
 {
   SurfGDI->BitBlt   = NULL;
   SurfGDI->CopyBits = NULL;
@@ -94,48 +122,12 @@ VOID InitializeFuncs(SURFGDI *SurfGDI, ULONG BitmapFormat)
 
   switch(BitmapFormat)
     {
-    case BMF_1BPP:
-      SurfGDI->DIB_PutPixel = DIB_1BPP_PutPixel;
-      SurfGDI->DIB_HLine    = DIB_1BPP_HLine;
-      SurfGDI->DIB_VLine    = DIB_1BPP_VLine;
-      SurfGDI->DIB_BitBlt   = DIB_1BPP_BitBlt;
-      break;
-
-    case BMF_4BPP:
-      SurfGDI->DIB_PutPixel = DIB_4BPP_PutPixel;
-      SurfGDI->DIB_HLine    = DIB_4BPP_HLine;
-      SurfGDI->DIB_VLine    = DIB_4BPP_VLine;
-      SurfGDI->DIB_BitBlt   = DIB_4BPP_BitBlt;
-      break;
-
-    case BMF_8BPP:
-      SurfGDI->DIB_PutPixel = DIB_8BPP_PutPixel;
-      SurfGDI->DIB_HLine    = DIB_8BPP_HLine;
-      SurfGDI->DIB_VLine    = DIB_8BPP_VLine;
-      SurfGDI->DIB_BitBlt   = DIB_8BPP_BitBlt;
-      break;
-
-    case BMF_16BPP:
-      SurfGDI->DIB_PutPixel = DIB_16BPP_PutPixel;
-      SurfGDI->DIB_HLine    = DIB_16BPP_HLine;
-      SurfGDI->DIB_VLine    = DIB_16BPP_VLine;
-      SurfGDI->DIB_BitBlt   = DIB_16BPP_BitBlt;
-      break;
-
-    case BMF_24BPP:
-      SurfGDI->DIB_PutPixel = DIB_24BPP_PutPixel;
-      SurfGDI->DIB_HLine    = DIB_24BPP_HLine;
-      SurfGDI->DIB_VLine    = DIB_24BPP_VLine;
-      SurfGDI->DIB_BitBlt   = DIB_24BPP_BitBlt;
-      break;
-
-    case BMF_32BPP:
-      SurfGDI->DIB_PutPixel = DIB_32BPP_PutPixel;
-      SurfGDI->DIB_HLine    = DIB_32BPP_HLine;
-      SurfGDI->DIB_VLine    = DIB_32BPP_VLine;
-      SurfGDI->DIB_BitBlt   = DIB_32BPP_BitBlt;
-      break;
-
+    case BMF_1BPP:  SET_SURFGDI(1BPP) break;
+    case BMF_4BPP:  SET_SURFGDI(4BPP) break;
+    case BMF_8BPP:  SET_SURFGDI(8BPP) break;
+    case BMF_16BPP: SET_SURFGDI(16BPP) break;
+    case BMF_24BPP: SET_SURFGDI(24BPP) break;
+    case BMF_32BPP: SET_SURFGDI(32BPP) break;
     case BMF_4RLE:
     case BMF_8RLE:
       /* Not supported yet, fall through to unrecognized case */
@@ -151,6 +143,9 @@ VOID InitializeFuncs(SURFGDI *SurfGDI, ULONG BitmapFormat)
     }
 }
 
+/*
+ * @implemented
+ */
 HBITMAP STDCALL
 EngCreateDeviceBitmap(IN DHSURF dhsurf,
                      IN SIZEL Size,
@@ -166,6 +161,9 @@ EngCreateDeviceBitmap(IN DHSURF dhsurf,
   return NewBitmap;
 }
 
+/*
+ * @implemented
+ */
 HBITMAP STDCALL
 EngCreateBitmap(IN SIZEL Size,
                IN LONG Width,
@@ -177,7 +175,6 @@ EngCreateBitmap(IN SIZEL Size,
   SURFOBJ *SurfObj;
   SURFGDI *SurfGDI;
 
-
   NewBitmap = (PVOID)CreateGDIHandle(sizeof(SURFGDI), sizeof(SURFOBJ));
   if( !ValidEngHandle( NewBitmap ) )
        return 0;
@@ -224,6 +221,9 @@ EngCreateBitmap(IN SIZEL Size,
   return NewBitmap;
 }
 
+/*
+ * @unimplemented
+ */
 HSURF STDCALL
 EngCreateDeviceSurface(IN DHSURF dhsurf,
                       IN SIZEL Size,
@@ -255,7 +255,7 @@ EngCreateDeviceSurface(IN DHSURF dhsurf,
   return NewSurface;
 }
 
-PFN DriverFunction(DRVENABLEDATA *DED, ULONG DriverFunc)
+PFN FASTCALL DriverFunction(DRVENABLEDATA *DED, ULONG DriverFunc)
 {
   ULONG i;
 
@@ -267,6 +267,9 @@ PFN DriverFunction(DRVENABLEDATA *DED, ULONG DriverFunc)
   return NULL;
 }
 
+/*
+ * @implemented
+ */
 BOOL STDCALL
 EngAssociateSurface(IN HSURF Surface,
                    IN HDEV Dev,
@@ -306,6 +309,9 @@ EngAssociateSurface(IN HSURF Surface,
   return TRUE;
 }
 
+/*
+ * @implemented
+ */
 BOOL STDCALL
 EngDeleteSurface(IN HSURF Surface)
 {
@@ -313,6 +319,9 @@ EngDeleteSurface(IN HSURF Surface)
   return TRUE;
 }
 
+/*
+ * @implemented
+ */
 BOOL STDCALL
 EngEraseSurface(SURFOBJ *Surface,
                RECTL *Rect,
@@ -321,15 +330,33 @@ EngEraseSurface(SURFOBJ *Surface,
   return FillSolid(Surface, Rect, iColor);
 }
 
+/*
+ * @unimplemented
+ */
 SURFOBJ * STDCALL
 EngLockSurface(IN HSURF Surface)
 {
-  // FIXME: Call GDI_LockObject (see subsys/win32k/objects/gdi.c)
+  /*
+   * FIXME - don't know if GDIOBJ_LockObj's return value is a SURFOBJ or not...
+   * also, what is HSURF's correct magic #?
+   */
+#ifdef TODO
+  GDIOBJ_LockObj ( Surface, GDI_OBJECT_TYPE_DONTCARE );
+#endif
   return (SURFOBJ*)AccessUserObject((ULONG)Surface);
 }
 
+/*
+ * @unimplemented
+ */
 VOID STDCALL
 EngUnlockSurface(IN SURFOBJ *Surface)
 {
-  // FIXME: Call GDI_UnlockObject
+  /*
+   * FIXME what is HSURF's correct magic #?
+   */
+#ifdef TODO
+  GDIOBJ_UnlockObj ( Surface->hsurf, GDI_OBJECT_TYPE_DONTCARE );
+#endif
 }
+/* EOF */