Refactored BitBlt, implementing everything now.
authorArmin Novak <armin.novak@gmail.com>
Fri, 5 Aug 2016 17:38:46 +0000 (19:38 +0200)
committerArmin Novak <armin.novak@thincast.com>
Thu, 6 Oct 2016 11:43:08 +0000 (13:43 +0200)
client/X11/xf_gdi.c
client/X11/xf_graphics.c
include/freerdp/gdi/gdi.h
include/freerdp/graphics.h
libfreerdp/cache/glyph.c
libfreerdp/gdi/bitmap.c
libfreerdp/gdi/brush.c
libfreerdp/gdi/brush.h
libfreerdp/gdi/gdi.c
libfreerdp/gdi/graphics.c

index 5b39b69..7204f70 100644 (file)
@@ -160,7 +160,7 @@ static BOOL xf_set_rop3(xfContext* xfc, UINT32 rop3)
                        function = GXequiv;
                        break;
 
-               case GDI_D:
+               case GDI_DSTCOPY:
                        function = GXnoop;
                        break;
 
index 16ce967..10c28e1 100644 (file)
@@ -318,7 +318,7 @@ out:
 }
 
 /* Glyph Class */
-static BOOL xf_Glyph_New(rdpContext* context, rdpGlyph* glyph)
+static BOOL xf_Glyph_New(rdpContext* context, const rdpGlyph* glyph)
 {
        int scanline;
        XImage* image;
@@ -354,7 +354,7 @@ static void xf_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
        free(glyph);
 }
 
-static BOOL xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, UINT32 x,
+static BOOL xf_Glyph_Draw(rdpContext* context, const rdpGlyph* glyph, UINT32 x,
                           UINT32 y)
 {
        xfGlyph* xf_glyph;
index 295314f..a674777 100644 (file)
 #define GDI_R2_WHITE                   0x10  /* D = 1 */
 
 /* Ternary Raster Operations (ROP3) */
-#define GDI_SRCCOPY                    0x00CC0020 /* D = S */
-#define GDI_SRCPAINT                   0x00EE0086 /* D = S | D */
-#define GDI_SRCAND                     0x008800C6 /* D = S & D */
-#define GDI_SRCINVERT                  0x00660046 /* D = S ^ D */
-#define GDI_SRCERASE                   0x00440328 /* D = S & ~D */
-#define GDI_NOTSRCCOPY                 0x00330008 /* D = ~S */
-#define GDI_NOTSRCERASE                        0x001100A6 /* D = ~S & ~D */
-#define GDI_MERGECOPY                  0x00C000CA /* D = S & P */
-#define GDI_MERGEPAINT                 0x00BB0226 /* D = ~S | D */
-#define GDI_PATCOPY                    0x00F00021 /* D = P */
-#define GDI_PATPAINT                   0x00FB0A09 /* D = D | (P | ~S) */
+#define GDI_BLACKNESS          0x00000042
+#define GDI_DPSoon                     0x00010289
+#define GDI_DPSona                     0x00020C89
+#define GDI_PSon                       0x000300AA
+#define GDI_SDPona                     0x00040C88
+#define GDI_DPon                       0x000500A9
+#define GDI_PDSxnon                    0x00060865
+#define GDI_PDSaon                     0x000702C5
+#define GDI_SDPnaa                     0x00080F08
+#define GDI_PDSxon                     0x00090245
+#define GDI_DPna                       0x000A0329
+#define GDI_PSDnaon                    0x000B0B2A
+#define GDI_SPna                       0x000C0324
+#define GDI_PDSnaon                    0x000D0B25
+#define GDI_PDSonon                    0x000E08A5
+#define GDI_Pn                         0x000F0001
+#define GDI_PDSona                     0x00100C85
+#define GDI_NOTSRCERASE                0x001100A6
+#define GDI_SDPxnon                    0x00120868
+#define GDI_SDPaon                     0x001302C8
+#define GDI_DPSxnon                    0x00140869
+#define GDI_DPSaon                     0x001502C9
+#define GDI_PSDPSanaxx         0x00165CCA
+#define GDI_SSPxDSxaxn         0x00171D54
+#define GDI_SPxPDxa                    0x00180D59
+#define GDI_SDPSanaxn          0x00191CC8
+#define GDI_PDSPaox                    0x001A06C5
+#define GDI_SDPSxaxn           0x001B0768
+#define GDI_PSDPaox                    0x001C06CA
+#define GDI_DSPDxaxn           0x001D0766
+#define GDI_PDSox                      0x001E01A5
+#define GDI_PDSoan                     0x001F0385
+#define GDI_DPSnaa                     0x00200F09
+#define GDI_SDPxon                     0x00210248
+#define GDI_DSna                       0x00220326
+#define GDI_SPDnaon                    0x00230B24
+#define GDI_SPxDSxa                    0x00240D55
+#define GDI_PDSPanaxn          0x00251CC5
+#define GDI_SDPSaox                    0x002606C8
+#define GDI_SDPSxnox           0x00271868
+#define GDI_DPSxa                      0x00280369
+#define GDI_PSDPSaoxxn         0x002916CA
+#define GDI_DPSana                     0x002A0CC9
+#define GDI_SSPxPDxaxn         0x002B1D58
+#define GDI_SPDSoax                    0x002C0784
+#define GDI_PSDnox                     0x002D060A
+#define GDI_PSDPxox                    0x002E064A
+#define GDI_PSDnoan                    0x002F0E2A
+#define GDI_PSna                       0x0030032A
+#define GDI_SDPnaon                    0x00310B28
+#define GDI_SDPSoox                    0x00320688
+#define GDI_NOTSRCCOPY         0x00330008
+#define GDI_SPDSaox                    0x003406C4
+#define GDI_SPDSxnox           0x00351864
+#define GDI_SDPox                      0x003601A8
+#define GDI_SDPoan                     0x00370388
+#define GDI_PSDPoax                    0x0038078A
+#define GDI_SPDnox                     0x00390604
+#define GDI_SPDSxox                    0x003A0644
+#define GDI_SPDnoan                    0x003B0E24
+#define GDI_PSx                        0x003C004A
+#define GDI_SPDSonox           0x003D18A4
+#define GDI_SPDSnaox           0x003E1B24
+#define GDI_PSan                       0x003F00EA
+#define GDI_PSDnaa                     0x00400F0A
+#define GDI_DPSxon                     0x00410249
+#define GDI_SDxPDxa                    0x00420D5D
+#define GDI_SPDSanaxn          0x00431CC4
+#define GDI_SRCERASE           0x00440328
+#define GDI_DPSnaon                    0x00450B29
+#define GDI_DSPDaox                    0x004606C6
+#define GDI_PSDPxaxn           0x0047076A
+#define GDI_SDPxa                      0x00480368
+#define GDI_PDSPDaoxxn         0x004916C5
+#define GDI_DPSDoax                    0x004A0789
+#define GDI_PDSnox                     0x004B0605
+#define GDI_SDPana                     0x004C0CC8
+#define GDI_SSPxDSxoxn         0x004D1954
+#define GDI_PDSPxox                    0x004E0645
+#define GDI_PDSnoan                    0x004F0E25
+#define GDI_PDna                       0x00500325
+#define GDI_DSPnaon                    0x00510B26
+#define GDI_DPSDaox                    0x005206C9
+#define GDI_SPDSxaxn           0x00530764
+#define GDI_DPSonon                    0x005408A9
+#define GDI_DSTINVERT          0x00550009
+#define GDI_DPSox                      0x005601A9
+#define GDI_DPSoan                     0x00570389
+#define GDI_PDSPoax                    0x00580785
+#define GDI_DPSnox                     0x00590609
+#define GDI_PATINVERT          0x005A0049
+#define GDI_DPSDonox           0x005B18A9
+#define GDI_DPSDxox                    0x005C0649
+#define GDI_DPSnoan                    0x005D0E29
+#define GDI_DPSDnaox           0x005E1B29
+#define GDI_DPan                       0x005F00E9
+#define GDI_PDSxa                      0x00600365
+#define GDI_DSPDSaoxxn         0x006116C6
+#define GDI_DSPDoax                    0x00620786
+#define GDI_SDPnox                     0x00630608
+#define GDI_SDPSoax                    0x00640788
+#define GDI_DSPnox                     0x00650606
+#define GDI_SRCINVERT          0x00660046
+#define GDI_SDPSonox           0x006718A8
+#define GDI_DSPDSonoxxn                0x006858A6
+#define GDI_PDSxxn                     0x00690145
+#define GDI_DPSax                      0x006A01E9
+#define GDI_PSDPSoaxxn         0x006B178A
+#define GDI_SDPax                      0x006C01E8
+#define GDI_PDSPDoaxxn         0x006D1785
+#define GDI_SDPSnoax           0x006E1E28
+#define GDI_PDSxnan                    0x006F0C65
+#define GDI_PDSana                     0x00700CC5
+#define GDI_SSDxPDxaxn         0x00711D5C
+#define GDI_SDPSxox                    0x00720648
+#define GDI_SDPnoan                    0x00730E28
+#define GDI_DSPDxox                    0x00740646
+#define GDI_DSPnoan                    0x00750E26
+#define GDI_SDPSnaox           0x00761B28
+#define GDI_DSan                       0x007700E6
+#define GDI_PDSax                      0x007801E5
+#define GDI_DSPDSoaxxn         0x00791786
+#define GDI_DPSDnoax           0x007A1E29
+#define GDI_SDPxnan                    0x007B0C68
+#define GDI_SPDSnoax           0x007C1E24
+#define GDI_DPSxnan                    0x007D0C69
+#define GDI_SPxDSxo                    0x007E0955
+#define GDI_DPSaan                     0x007F03C9
+#define GDI_DPSaa                      0x008003E9
+#define GDI_SPxDSxon           0x00810975
+#define GDI_DPSxna                     0x00820C49
+#define GDI_SPDSnoaxn          0x00831E04
+#define GDI_SDPxna                     0x00840C48
+#define GDI_PDSPnoaxn          0x00851E05
+#define GDI_DSPDSoaxx          0x008617A6
+#define GDI_PDSaxn                     0x008701C5
+#define GDI_SRCAND                     0x008800C6
+#define GDI_SDPSnaoxn          0x00891B08
+#define GDI_DSPnoa                     0x008A0E06
+#define GDI_DSPDxoxn           0x008B0666
+#define GDI_SDPnoa                     0x008C0E08
+#define GDI_SDPSxoxn           0x008D0668
+#define GDI_SSDxPDxax          0x008E1D7C
+#define GDI_PDSanan                    0x008F0CE5
+#define GDI_PDSxna                     0x00900C45
+#define GDI_SDPSnoaxn          0x00911E08
+#define GDI_DPSDPoaxx          0x009217A9
+#define GDI_SPDaxn                     0x009301C4
+#define GDI_PSDPSoaxx          0x009417AA
+#define GDI_DPSaxn                     0x009501C9
+#define GDI_DPSxx                      0x00960169
+#define GDI_PSDPSonoxx         0x0097588A
+#define GDI_SDPSonoxn          0x00981888
+#define GDI_DSxn                       0x00990066
+#define GDI_DPSnax                     0x009A0709
+#define GDI_SDPSoaxn           0x009B07A8
+#define GDI_SPDnax                     0x009C0704
+#define GDI_DSPDoaxn           0x009D07A6
+#define GDI_DSPDSaoxx          0x009E16E6
+#define GDI_PDSxan                     0x009F0345
+#define GDI_DPa                        0x00A000C9
+#define GDI_PDSPnaoxn          0x00A11B05
+#define GDI_DPSnoa                     0x00A20E09
+#define GDI_DPSDxoxn           0x00A30669
+#define GDI_PDSPonoxn          0x00A41885
+#define GDI_PDxn                       0x00A50065
+#define GDI_DSPnax                     0x00A60706
+#define GDI_PDSPoaxn           0x00A707A5
+#define GDI_DPSoa                      0x00A803A9
+#define GDI_DPSoxn                     0x00A90189
+#define GDI_DSTCOPY                    0x00AA0029
+#define GDI_DPSono                     0x00AB0889
+#define GDI_SPDSxax                    0x00AC0744
+#define GDI_DPSDaoxn           0x00AD06E9
+#define GDI_DSPnao                     0x00AE0B06
+#define GDI_DPno                       0x00AF0229
+#define GDI_PDSnoa                     0x00B00E05
+#define GDI_PDSPxoxn           0x00B10665
+#define GDI_SSPxDSxox          0x00B21974
+#define GDI_SDPanan                    0x00B30CE8
+#define GDI_PSDnax                     0x00B4070A
+#define GDI_DPSDoaxn           0x00B507A9
+#define GDI_DPSDPaoxx          0x00B616E9
+#define GDI_SDPxan                     0x00B70348
+#define GDI_PSDPxax                    0x00B8074A
+#define GDI_DSPDaoxn           0x00B906E6
+#define GDI_DPSnao                     0x00BA0B09
+#define GDI_MERGEPAINT         0x00BB0226
+#define GDI_SPDSanax           0x00BC1CE4
+#define GDI_SDxPDxan           0x00BD0D7D
+#define GDI_DPSxo                      0x00BE0269
+#define GDI_DPSano                     0x00BF08C9
+#define GDI_MERGECOPY          0x00C000CA
+#define GDI_SPDSnaoxn          0x00C11B04
+#define GDI_SPDSonoxn          0x00C21884
+#define GDI_PSxn                       0x00C3006A
+#define GDI_SPDnoa                     0x00C40E04
+#define GDI_SPDSxoxn           0x00C50664
+#define GDI_SDPnax                     0x00C60708
+#define GDI_PSDPoaxn           0x00C707AA
+#define GDI_SDPoa                      0x00C803A8
+#define GDI_SPDoxn                     0x00C90184
+#define GDI_DPSDxax                    0x00CA0749
+#define GDI_SPDSaoxn           0x00CB06E4
+#define GDI_SRCCOPY                    0x00CC0020
+#define GDI_SDPono                     0x00CD0888
+#define GDI_SDPnao                     0x00CE0B08
+#define GDI_SPno                       0x00CF0224
+#define GDI_PSDnoa                     0x00D00E0A
+#define GDI_PSDPxoxn           0x00D1066A
+#define GDI_PDSnax                     0x00D20705
+#define GDI_SPDSoaxn           0x00D307A4
+#define GDI_SSPxPDxax          0x00D41D78
+#define GDI_DPSanan                    0x00D50CE9
+#define GDI_PSDPSaoxx          0x00D616EA
+#define GDI_DPSxan                     0x00D70349
+#define GDI_PDSPxax                    0x00D80745
+#define GDI_SDPSaoxn           0x00D906E8
+#define GDI_DPSDanax           0x00DA1CE9
+#define GDI_SPxDSxan           0x00DB0D75
+#define GDI_SPDnao                     0x00DC0B04
+#define GDI_SDno                       0x00DD0228
+#define GDI_SDPxo                      0x00DE0268
+#define GDI_SDPano                     0x00DF08C8
+#define GDI_PDSoa                      0x00E003A5
+#define GDI_PDSoxn                     0x00E10185
+#define GDI_DSPDxax                    0x00E20746
+#define GDI_PSDPaoxn           0x00E306EA
+#define GDI_SDPSxax                    0x00E40748
+#define GDI_PDSPaoxn           0x00E506E5
+#define GDI_SDPSanax           0x00E61CE8
+#define GDI_SPxPDxan           0x00E70D79
+#define GDI_SSPxDSxax          0x00E81D74
+#define GDI_DSPDSanaxxn                0x00E95CE6
+#define GDI_DPSao                      0x00EA02E9
+#define GDI_DPSxno                     0x00EB0849
+#define GDI_SDPao                      0x00EC02E8
+#define GDI_SDPxno                     0x00ED0848
+#define GDI_SRCPAINT           0x00EE0086
+#define GDI_SDPnoo                     0x00EF0A08
+#define GDI_PATCOPY                    0x00F00021
+#define GDI_PDSono                     0x00F10885
+#define GDI_PDSnao                     0x00F20B05
+#define GDI_PSno                       0x00F3022A
+#define GDI_PSDnao                     0x00F40B0A
+#define GDI_PDno                       0x00F50225
+#define GDI_PDSxo                      0x00F60265
+#define GDI_PDSano                     0x00F708C5
+#define GDI_PDSao                      0x00F802E5
+#define GDI_PDSxno                     0x00F90845
+#define GDI_DPo                                0x00FA0089
+#define GDI_PATPAINT           0x00FB0A09
 #define GDI_PSo                                0x00FC008A
 #define GDI_PSDnoo                     0x00FD0A0A
 #define GDI_DPSoo                      0x00FE02A9
-#define GDI_DSPDoax                    0x00620786
-#define GDI_PATINVERT                  0x005A0049 /* D = P ^ D */
-#define GDI_DSTINVERT                  0x00550009 /* D = ~D */
-#define GDI_BLACKNESS                  0x00000042 /* D = 0 */
-#define GDI_WHITENESS                  0x00FF0062 /* D = 1 */
-#define GDI_DSPDxax                    0x00E20746 /* D = (S & P) | (~S & D) */
-#define GDI_PSDPxax                    0x00B8074A /* D = (S & D) | (~S & P) */
-#define GDI_SPna                       0x000C0324 /* D = S & ~P */
-#define GDI_DSna                       0x00220326 /* D = D & ~S */
-#define GDI_DPa                                0x00A000C9 /* D = D & P */
-#define GDI_PDxn                       0x00A50065 /* D = D ^ ~P */
-
-#define GDI_DSxn                       0x00990066 /* D = ~(D ^ S) */
-#define GDI_PSDnox                     0x002D060A /* D = P ^ (S | ~D) */
-#define GDI_PSDPxox                    0x002E064A
-#define GDI_PSDPxoxn                   0x00D1066A
-#define GDI_PSDPaox                    0x001C06CA
-#define GDI_PDSona                     0x00100C85 /* D = P & ~(D | S) */
-#define GDI_DSPDxox                    0x00740646 /* D = D ^ (S | ( P ^ D)) */
-#define GDI_DPSDonox                   0x005B18A9 /* D = D ^ (P | ~(S | D)) */
-#define GDI_SPDSxax                    0x00AC0744 /* D = S ^ (P & (D ^ S)) */
-
-#define GDI_DPon                       0x000500A9 /* D = ~(D | P) */
-#define GDI_DPna                       0x000A0329 /* D = D & ~P */
-#define GDI_Pn                         0x000F0001 /* D = ~P */
-#define GDI_PDna                       0x00500325 /* D = P &~D */
-#define GDI_DPan                       0x005F00E9 /* D = ~(D & P) */
-#define GDI_DSan                       0x007700E6 /* D = ~(D & S) */
-#define GDI_DSxn                       0x00990066 /* D = ~(D ^ S) */
-#define GDI_DPa                                0x00A000C9 /* D = D & P */
-#define GDI_D                          0x00AA0029 /* D = D */
-#define GDI_DPno                       0x00AF0229 /* D = D | ~P */
-#define GDI_SDno                       0x00DD0228 /* D = S | ~D */
-#define GDI_PDno                       0x00F50225 /* D = P | ~D */
-#define GDI_DPo                                0x00FA0089 /* D = D | P */
-#define GDI_todo                       0xFFFFFFFF /* TODO: Find out which ROP this implements */
+#define GDI_WHITENESS          0x00FF0062
+#define GDI_GLYPH_ORDER                0xFFFFFFFF
+
 
 /* Brush Styles */
 #define GDI_BS_SOLID                   0x00
index 2d74554..f1290ae 100644 (file)
@@ -116,10 +116,10 @@ struct rdp_pointer
 FREERDP_API rdpPointer* Pointer_Alloc(rdpContext* context);
 
 /* Glyph Class */
-typedef BOOL (*pGlyph_New)(rdpContext* context, rdpGlyph* glyph);
+typedef BOOL (*pGlyph_New)(rdpContext* context, const rdpGlyph* glyph);
 typedef void (*pGlyph_Free)(rdpContext* context, rdpGlyph* glyph);
-typedef BOOL (*pGlyph_Draw)(rdpContext* context, rdpGlyph* glyph, UINT32 x,
-                            UINT32 y);
+typedef BOOL (*pGlyph_Draw)(rdpContext* context, const rdpGlyph* glyph,
+                            UINT32 x, UINT32 y);
 typedef BOOL (*pGlyph_BeginDraw)(rdpContext* context, UINT32 x, UINT32 y,
                                  UINT32 width, UINT32 height, UINT32 bgcolor,
                                  UINT32 fgcolor, BOOL fOpRedundant);
index a3b9464..6b132ac 100644 (file)
@@ -44,7 +44,7 @@ static void glyph_cache_fragment_put(rdpGlyphCache* glyph, UINT32 index,
                                      UINT32 count, void* entry);
 
 static BOOL update_process_glyph(rdpContext* context, const BYTE* data,
-                                 UINT32* index,        UINT32* x, UINT32* y,
+                                 UINT32* index,        INT32* x, INT32* y,
                                  UINT32 cacheId, UINT32 ulCharInc, UINT32 flAccel)
 {
        INT32 offset;
@@ -80,7 +80,7 @@ static BOOL update_process_glyph(rdpContext* context, const BYTE* data,
 
                if (flAccel & SO_VERTICAL)
                        *y += offset;
-               else
+               else if (flAccel & SO_HORIZONTAL)
                        *x += offset;
        }
 
@@ -101,11 +101,11 @@ static BOOL update_process_glyph_fragments(rdpContext* context,
         UINT32 length, UINT32 cacheId,
         UINT32 ulCharInc, UINT32 flAccel,
         UINT32 bgcolor, UINT32 fgcolor,
-        UINT32 x, UINT32 y,
-        UINT32 bkX, UINT32 bkY,
-        UINT32 bkWidth, UINT32 bkHeight,
-        UINT32 opX, UINT32 opY,
-        UINT32 opWidth, UINT32 opHeight,
+        INT32 x, INT32 y,
+        INT32 bkX, INT32 bkY,
+        INT32 bkWidth, INT32 bkHeight,
+        INT32 opX, INT32 opY,
+        INT32 opWidth, INT32 opHeight,
         BOOL fOpRedundant)
 {
        UINT32 n;
index a1b48e6..09e9f00 100644 (file)
@@ -165,1666 +165,121 @@ HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, UINT32 nWidth,
        return hBitmap;
 }
 
-static BOOL BitBlt_SRCCOPY(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                           UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                           UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
+static BOOL op_not(UINT32* stack, UINT32* stackp)
 {
-       HGDI_BITMAP hSrcBmp;
-       HGDI_BITMAP hDstBmp;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       if ((nHeight == 0) || (nWidth == 0))
-               return TRUE;
-
-       hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject;
-       hDstBmp = (HGDI_BITMAP) hdcDest->selectedObject;
-
-       if (!hDstBmp || !hSrcBmp)
-               return FALSE;
-
-       return freerdp_image_copy(hDstBmp->data, hDstBmp->format, hDstBmp->scanline,
-                                 nXDest, nYDest, nWidth, nHeight,
-                                 hSrcBmp->data, hSrcBmp->format, hSrcBmp->scanline,
-                                 nXSrc, nYSrc, palette);
-}
-
-static BOOL BitBlt_NOTSRCCOPY(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                              UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                              UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                              hdcSrc, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
-
-                       if (srcp && dstp)
-                       {
-                               UINT32 color = ReadColor(srcp, hdcSrc->format);
-                               color = ConvertColor(color, hdcSrc->format, hdcDest->format,
-                                                    palette);
-                               color = ~color;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_SRCERASE(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                            UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                            UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-
-       /* SDna */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                              hdcSrc, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
-
-                       if (srcp && dstp)
-                       {
-                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                               UINT32 color;
-                               colorA = ConvertColor(colorA, hdcSrc->format, hdcDest->format,
-                                                     palette);
-                               color = ~colorA & colorB;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_NOTSRCERASE(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                               UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                               UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-
-       /* DSon */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                              hdcSrc, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
-
-                       if (srcp && dstp)
-                       {
-                               UINT32 color;
-                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                     hdcDest->format, palette);
-                               color = ~colorA | colorB;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_SRCINVERT(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                             UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                             UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-
-       /* DSx */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                              hdcSrc, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
-
-                       if (srcp && dstp)
-                       {
-                               UINT32 color;
-                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                     hdcDest->format, palette);
-                               color = colorA ^ colorB;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_SRCAND(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                          UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                          UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-
-       /* DSa */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                              hdcSrc, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
-
-                       if (srcp && dstp)
-                       {
-                               UINT32 color;
-                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                     hdcDest->format, palette);
-                               color = colorA & colorB;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_SRCPAINT(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                            UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                            UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-
-       /* DSo */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                              hdcSrc, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
-
-                       if (srcp && dstp)
-                       {
-                               UINT32 color;
-                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                     hdcDest->format, palette);
-                               color = colorA | colorB;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_DSPDxax(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                           UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                           UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-       UINT32 color;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               dstColor = (colorB ^ colorA) & (color ^ colorB);
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 color = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               dstColor = (colorB ^ colorA) & (color ^ colorB);
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_DPno(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-       UINT32 color;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = ~colorB | color;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (patp && dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorA = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               dstColor = ~colorB | colorA;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_DPo(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                       UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                       UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-       UINT32 color;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = colorB | color;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (patp && dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorA = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = colorB | colorA;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_Pn(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                      UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                      UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-       UINT32 color;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (dstp)
-                                       {
-                                               UINT32 dstColor = ~color;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 color = ReadColor(patp, hdcDest->format);
-                                               dstColor = ~color;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_DPon(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-       UINT32 color;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = colorB | ~color;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (patp && dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorA = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = colorB | ~colorA;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_DPan(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-       UINT32 color;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = colorB & ~color;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorA = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = colorB & ~colorA;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_SDno(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                              hdcSrc, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
-
-                       if (srcp && dstp)
-                       {
-                               UINT32 dstColor;
-                               UINT32 colorA = ReadColor(srcp, hdcDest->format);
-                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                     hdcDest->format, palette);
-                               dstColor = ~colorA | colorB;
-                               WriteColor(dstp, hdcDest->format, dstColor);
-                       }
-               }
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_DPna(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-       UINT32 color;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = ~colorB & color;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (patp && dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorA = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = ~colorB & colorA;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_PDno(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-       UINT32 color;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = colorB | ~color;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (patp && dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorA = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = colorB | ~colorA;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_PDna(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-       UINT32 color;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = colorB & ~color;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (patp && dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorA = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               dstColor = colorB & ~colorA;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_DSPDxox(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                           UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                           UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y, color;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->textColor;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 dstColor;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               dstColor = (colorA ^ colorB) | (color ^ colorB);
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp && patp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(patp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA ^ colorB) | (colorB ^ colorC);
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_PSDPxox(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                           UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                           UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y, colorC;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       colorC = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA ^ colorC) | (colorB ^ colorC);
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(patp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA ^ colorC) | (colorB ^ colorC);
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_PSDPaox(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                           UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                           UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y, colorC;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       colorC = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA & colorC) | (colorB ^ colorC);
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(patp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA & colorC) | (colorB ^ colorC);
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_PSDPxoxn(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                            UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                            UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y, colorC;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       colorC = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA ^ colorC) | (colorB ^ ~colorC);
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(patp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA ^ colorC) | (colorB ^ ~colorC);
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_PSDPxax(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                           UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                           UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y, colorC;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       colorC = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA ^ colorC) & (colorB ^ colorC);
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(patp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA ^ colorC) & (colorB ^ colorC);
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_PSDnox(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                          UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                          UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y, colorA;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       colorA = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorB = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorC = ReadColor(dstp, hdcDest->format);
-                                               colorB = ConvertColor(colorB, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (~colorA | colorB) ^ colorC;
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp && patp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorB = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorC = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorA = ReadColor(patp, hdcDest->format);
-                                               colorB = ConvertColor(colorB, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (~colorA | colorB) ^ colorC;
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_PDSona(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                          UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                          UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y, colorA;
-
-       if (!hdcDest || !hdcSrc)
+       if (!stack || !stackp)
                return FALSE;
 
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       colorA = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               colorC = ConvertColor(colorC, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA | ~colorB) & colorC;
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp && patp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorA = ReadColor(patp, hdcDest->format);
-                                               colorC = ConvertColor(colorC, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA | ~colorB) & colorC;
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
-       return TRUE;
-}
-
-static BOOL BitBlt_DPSDonox(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                            UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                            UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y, colorB;
-
-       if (!hdcDest || !hdcSrc)
+       if (*stackp < 1)
                return FALSE;
 
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       colorB = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               colorC = ConvertColor(colorC, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA | ~colorB | colorC) ^ colorA;
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp && patp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(patp, hdcDest->format);
-                                               colorC = ConvertColor(colorC, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = (colorA | ~colorB | colorC) ^ colorA;
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
-
+       stack[(*stackp) - 1] = ~stack[(*stackp) - 1];
        return TRUE;
 }
 
-static BOOL BitBlt_SPDSxax(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                           UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                           UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
+static BOOL op_and(UINT32* stack, UINT32* stackp)
 {
-       UINT32 x, y, color;
-
-       if (!hdcDest || !hdcSrc)
+       if (!stack || !stackp)
                return FALSE;
 
-       /* D = S ^ (P & (D ^ S)) */
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 colorD;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               colorD = (colorA ^ color) & (colorB ^ colorA);
-                                               WriteColor(dstp, hdcDest->format, colorD);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp && patp)
-                                       {
-                                               UINT32 colorD;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               UINT32 color = ReadColor(patp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               colorD = (colorA ^ color) & (colorB ^ colorA);
-                                               WriteColor(dstp, hdcDest->format, colorD);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
+       if (*stackp < 2)
+               return FALSE;
 
+       (*stackp)--;
+       stack[(*stackp) - 1] &= stack[(*stackp)];
        return TRUE;
 }
 
-static BOOL BitBlt_SPna(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
+static BOOL op_or(UINT32* stack, UINT32* stackp)
 {
-       UINT32 x, y, colorB;
-
-       if (!hdcDest || !hdcSrc)
+       if (!stack || !stackp)
                return FALSE;
 
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       colorB = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = ~colorA & colorB;
-                                               color = ConvertColor(color, hdcSrc->format, hdcDest->format, palette);
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && patp && dstp)
-                                       {
-                                               UINT32 color;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 colorB = ReadColor(patp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = ~colorA & colorB;
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
+       if (*stackp < 2)
+               return FALSE;
 
+       (*stackp)--;
+       stack[(*stackp) - 1] |= stack[(*stackp)];
        return TRUE;
 }
 
-static BOOL BitBlt_DSna(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
+static BOOL op_xor(UINT32* stack, UINT32* stackp)
 {
-       UINT32 x, y;
-
-       if (!hdcDest || !hdcSrc)
+       if (!stack || !stackp)
                return FALSE;
 
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                              hdcSrc, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
-
-                       if (srcp && dstp)
-                       {
-                               UINT32 color;
-                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                     hdcDest->format, palette);
-                               color = colorA & ~colorB;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
+       if (*stackp < 2)
+               return FALSE;
 
+       (*stackp)--;
+       stack[(*stackp) - 1] ^= stack[(*stackp)];
        return TRUE;
 }
 
-static BOOL BitBlt_DSxn(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
+static UINT32 process_rop(UINT32 src, UINT32 dst, UINT32 pat, const char* rop,
+                          UINT32 format)
 {
-       UINT32 x, y;
-
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
+       DWORD stack[10];
+       DWORD stackp = 0;
 
-       for (y = 0; y < nHeight; y++)
+       while (*rop != '\0')
        {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                              hdcSrc, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
-
-                       if (srcp && dstp)
-                       {
-                               UINT32 color;
-                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                     hdcDest->format, palette);
-                               color = ~colorA ^ colorB;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
+               char op = *rop++;
 
-       return TRUE;
-}
+               switch (op)
+               {
+                       case '0':
+                               stack[stackp++] = GetColor(format, 0, 0, 0, 0xFF);
+                               break;
 
-static BOOL BitBlt_DSan(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
+                       case '1':
+                               stack[stackp++] = GetColor(format, 0xFF, 0xFF, 0xFF, 0xFF);
+                               break;
 
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
+                       case 'D':
+                               stack[stackp++] = dst;
+                               break;
 
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                              hdcSrc, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
+                       case 'S':
+                               stack[stackp++] = src;
+                               break;
 
-                       if (srcp && dstp)
-                       {
-                               UINT32 color;
-                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                     hdcDest->format, palette);
-                               color = ~colorA & colorB;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
+                       case 'P':
+                               stack[stackp++] = pat;
+                               break;
 
-       return TRUE;
-}
+                       case 'x':
+                               op_xor(stack, &stackp);
+                               break;
 
-static BOOL BitBlt_D(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                     UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                     UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
+                       case 'a':
+                               op_and(stack, &stackp);
+                               break;
 
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
+                       case 'o':
+                               op_or(stack, &stackp);
+                               break;
 
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                              hdcDest, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
+                       case 'n':
+                               op_not(stack, &stackp);
+                               break;
 
-                       if (srcp && dstp)
-                       {
-                               UINT32 color = ReadColor(srcp, hdcSrc->format);
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
+                       default:
+                               break;
                }
        }
 
-       return TRUE;
+       return stack[0];
 }
 
-static BOOL BitBlt_MERGECOPY(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                             UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                             UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
+BOOL BitBlt_process(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
+                    UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
+                    UINT32 nXSrc, UINT32 nYSrc, const char* rop)
 {
        UINT32 x, y;
        UINT32 color;
 
-       /* PSa */
+       /* DPSnoo */
        if (!hdcDest || !hdcSrc)
                return FALSE;
 
@@ -1837,18 +292,16 @@ static BOOL BitBlt_MERGECOPY(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
                        {
                                for (x = 0; x < nWidth; x++)
                                {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
+                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
+                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
 
                                        if (srcp && dstp)
                                        {
+                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
+                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
                                                UINT32 dstColor;
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               dstColor = color = colorA & color;
+                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
+                                               dstColor = process_rop(colorC, colorA, color, rop, hdcDest->format);
                                                WriteColor(dstp, hdcDest->format, dstColor);
                                        }
                                }
@@ -1861,21 +314,19 @@ static BOOL BitBlt_MERGECOPY(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
                        {
                                for (x = 0; x < nWidth; x++)
                                {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(
-                                                              hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
+                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
+                                       const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
+                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
 
                                        if (srcp && patp && dstp)
                                        {
-                                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
+                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
                                                UINT32 colorB = ReadColor(patp, hdcDest->format);
-                                               colorA = ConvertColor(colorA, hdcSrc->format,
-                                                                     hdcDest->format, palette);
-                                               color = colorA & colorB;
-                                               WriteColor(dstp, hdcDest->format, color);
+                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
+                                               UINT32 dstColor;
+                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
+                                               dstColor = process_rop(colorC, colorA, colorB, rop, hdcDest->format);
+                                               WriteColor(dstp, hdcDest->format, dstColor);
                                        }
                                }
                        }
@@ -1886,39 +337,6 @@ static BOOL BitBlt_MERGECOPY(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
        return TRUE;
 }
 
-static BOOL BitBlt_MERGEPAINT(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                              UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                              UINT32 nXSrc, UINT32 nYSrc, const gdiPalette* palette)
-{
-       UINT32 x, y;
-
-       /* DSno */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
-
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                       if (srcp && dstp)
-                       {
-                               UINT32 colorA = ReadColor(srcp, hdcSrc->format);
-                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                               UINT32 color;
-                               colorA = ConvertColor(colorA, hdcSrc->format, hdcDest->format,
-                                                     palette);
-                               color = colorA | ~colorB;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
-
-       return TRUE;
-}
-
 /**
  * Perform a bit blit operation on the given pixel buffers.\n
  * @msdn{dd183370}
@@ -1940,10 +358,6 @@ BOOL gdi_BitBlt(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
        if (!hdcDest)
                return FALSE;
 
-       if (gdi_PatBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, rop,
-                      hdcSrc, nXSrc, nYSrc))
-               return TRUE;
-
        if (hdcSrc != NULL)
        {
                if (!gdi_ClipCoords(hdcDest, &nXDest, &nYDest, &nWidth, &nHeight, &nXSrc,
@@ -1959,142 +373,7 @@ BOOL gdi_BitBlt(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
        if (!gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight))
                return FALSE;
 
-       switch (rop)
-       {
-               case GDI_SRCCOPY:
-                       return BitBlt_SRCCOPY(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                             hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_SPna:
-                       return BitBlt_SPna(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_DSna:
-                       return BitBlt_DSna(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_DSPDxax:
-                       return BitBlt_DSPDxax(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                             hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_DSPDxox:
-                       return BitBlt_DSPDxox(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                             hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_PSDPxox:
-                       return BitBlt_PSDPxox(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                             hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_PSDPaox:
-                       return BitBlt_PSDPaox(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                             hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_PSDPxoxn:
-                       return BitBlt_PSDPxoxn(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                              hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_PSDPxax:
-                       return BitBlt_PSDPxax(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                             hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_SPDSxax:
-                       return BitBlt_SPDSxax(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                             hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_NOTSRCCOPY:
-                       return BitBlt_NOTSRCCOPY(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                                hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_SRCERASE:
-                       return BitBlt_SRCERASE(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                              hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_NOTSRCERASE:
-                       return BitBlt_NOTSRCERASE(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                                 hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_SRCINVERT:
-                       return BitBlt_SRCINVERT(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                               hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_SRCAND:
-                       return BitBlt_SRCAND(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                            hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_SRCPAINT:
-                       return BitBlt_SRCPAINT(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                              hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_MERGECOPY:
-                       return BitBlt_MERGECOPY(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                               hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_MERGEPAINT:
-                       return BitBlt_MERGEPAINT(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                                hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_DPno:
-                       return BitBlt_DPno(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_DPna:
-                       return BitBlt_DPna(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_SDno:
-                       return BitBlt_SDno(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_PDno:
-                       return BitBlt_PDno(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_PDna:
-                       return BitBlt_PDna(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_DPo:
-                       return BitBlt_DPo(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                         hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_Pn:
-                       return BitBlt_Pn(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                        hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_DPon:
-                       return BitBlt_DPon(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_DPan:
-                       return BitBlt_DPan(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_DSxn:
-                       return BitBlt_DSxn(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_DSan:
-                       return BitBlt_DSan(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_PSDnox:
-                       return BitBlt_PSDnox(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                            hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_PDSona:
-                       return BitBlt_PDSona(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                            hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_DPSDonox:
-                       return BitBlt_DPSDonox(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                              hdcSrc, nXSrc, nYSrc, palette);
-
-               case GDI_D:
-                       return BitBlt_D(hdcDest, nXDest, nYDest, nWidth, nHeight,
-                                       hdcSrc, nXSrc, nYSrc, palette);
-
-               default:
-                       WLog_ERR(TAG,  "BitBlt: unknown rop: %s", gdi_rop_to_string(rop));
-                       return FALSE;
-       }
+       return BitBlt_process(hdcDest, nXDest, nYDest,
+                             nWidth, nHeight, hdcSrc,
+                             nXSrc, nYSrc, gdi_rop_to_string(rop));
 }
index b9c370f..9b86c96 100644 (file)
 
 const char* gdi_rop_to_string(UINT32 code)
 {
-       static char buffer[1024];
-
        switch (code)
        {
-               /* Binary Raster Operations (ROP2) */
-               case GDI_R2_BLACK:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_BLACK [%08X]", code);
-                       break;
+               case GDI_BLACKNESS:
+                       return "0";
 
-               case GDI_R2_NOTMERGEPEN:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_NOTMERGEPEN [%08X]", code);
-                       break;
+               case GDI_DPSoon:
+                       return "DPSoon";
 
-               case GDI_R2_MASKNOTPEN:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_MASKNOTPEN [%08X]", code);
-                       break;
+               case GDI_DPSona:
+                       return "DPSona";
 
-               case GDI_R2_NOTCOPYPEN:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_NOTCOPYPEN [%08X]", code);
-                       break;
+               case GDI_PSon:
+                       return "PSon";
 
-               case GDI_R2_MASKPENNOT:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_MASKPENNOT [%08X]", code);
-                       break;
+               case GDI_SDPona:
+                       return "SDPona";
 
-               case GDI_R2_NOT:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_NOT [%08X]", code);
-                       break;
+               case GDI_DPon:
+                       return "DPon";
 
-               case GDI_R2_XORPEN:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_XORPEN [%08X]", code);
-                       break;
+               case GDI_PDSxnon:
+                       return "PDSxnon";
 
-               case GDI_R2_NOTMASKPEN:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_NOTMASKPEN [%08X]", code);
-                       break;
+               case GDI_PDSaon:
+                       return "PDSaon";
 
-               case GDI_R2_MASKPEN:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_MASKPEN [%08X]", code);
-                       break;
+               case GDI_SDPnaa:
+                       return "SDPnaa";
 
-               case GDI_R2_NOTXORPEN:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_NOTXORPEN [%08X]", code);
-                       break;
+               case GDI_PDSxon:
+                       return "PDSxon";
 
-               case GDI_R2_NOP:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_NOP [%08X]", code);
-                       break;
+               case GDI_DPna:
+                       return "DPna";
 
-               case GDI_R2_MERGENOTPEN:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_MERGENOTPEN [%08X]", code);
-                       break;
+               case GDI_PSDnaon:
+                       return "PSDnaon";
 
-               case GDI_R2_COPYPEN:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_COPYPEN [%08X]", code);
-                       break;
+               case GDI_SPna:
+                       return "SPna";
 
-               case GDI_R2_MERGEPENNOT:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_MERGEPENNOT [%08X]", code);
-                       break;
+               case GDI_PDSnaon:
+                       return "PDSnaon";
 
-               case GDI_R2_MERGEPEN:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_MERGEPEN [%08X]", code);
-                       break;
+               case GDI_PDSonon:
+                       return "PDSonon";
 
-               case GDI_R2_WHITE:
-                       _snprintf(buffer, sizeof(buffer), "GDI_R2_WHITE [%08X]", code);
-                       break;
+               case GDI_Pn:
+                       return "Pn";
 
-               /* Ternary Raster Operations (ROP3) */
-               case GDI_SRCCOPY:
-                       _snprintf(buffer, sizeof(buffer), "GDI_SRCCOPY [%08X]", code);
-                       break;
+               case GDI_PDSona:
+                       return "PDSona";
 
-               case GDI_SRCPAINT:
-                       _snprintf(buffer, sizeof(buffer), "GDI_SRCPAINT [%08X]", code);
-                       break;
+               case GDI_NOTSRCERASE:
+                       return "DSon";
 
-               case GDI_SRCAND :
-                       _snprintf(buffer, sizeof(buffer), "GDI_SRCAND    [%08X]", code);
-                       break;
+               case GDI_SDPxnon:
+                       return "SDPxnon";
 
-               case GDI_SRCINVERT:
-                       _snprintf(buffer, sizeof(buffer), "GDI_SRCINVERT [%08X]", code);
-                       break;
+               case GDI_SDPaon:
+                       return "SDPaon";
 
-               case GDI_SRCERASE:
-                       _snprintf(buffer, sizeof(buffer), "GDI_SRCERASE [%08X]", code);
-                       break;
+               case GDI_DPSxnon:
+                       return "DPSxnon";
 
-               case GDI_NOTSRCCOPY:
-                       _snprintf(buffer, sizeof(buffer), "GDI_NOTSRCCOPY [%08X]", code);
-                       break;
+               case GDI_DPSaon:
+                       return "DPSaon";
 
-               case GDI_NOTSRCERASE:
-                       _snprintf(buffer, sizeof(buffer), "GDI_NOTSRCERASE [%08X]", code);
-                       break;
+               case GDI_PSDPSanaxx:
+                       return "PSDPSanaxx";
 
-               case GDI_MERGECOPY:
-                       _snprintf(buffer, sizeof(buffer), "GDI_MERGECOPY [%08X]", code);
-                       break;
+               case GDI_SSPxDSxaxn:
+                       return "SSPxDSxaxn";
 
-               case GDI_MERGEPAINT:
-                       _snprintf(buffer, sizeof(buffer), "GDI_MERGEPAINT [%08X]", code);
-                       break;
+               case GDI_SPxPDxa:
+                       return "SPxPDxa";
 
-               case GDI_PATCOPY:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PATCOPY [%08X]", code);
-                       break;
+               case GDI_SDPSanaxn:
+                       return "SDPSanaxn";
 
-               case GDI_PATPAINT:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PATPAINT [%08X]", code);
-                       break;
+               case GDI_PDSPaox:
+                       return "PDSPaox";
 
-               case GDI_PATINVERT:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PATINVERT [%08X]", code);
-                       break;
+               case GDI_SDPSxaxn:
+                       return "SDPSxaxn";
 
-               case GDI_DSTINVERT:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DSTINVERT [%08X]", code);
-                       break;
+               case GDI_PSDPaox:
+                       return "PSDPaox";
 
-               case GDI_BLACKNESS:
-                       _snprintf(buffer, sizeof(buffer), "GDI_BLACKNESS [%08X]", code);
-                       break;
+               case GDI_DSPDxaxn:
+                       return "DSPDxaxn";
 
-               case GDI_WHITENESS:
-                       _snprintf(buffer, sizeof(buffer), "GDI_WHITENESS [%08X]", code);
-                       break;
+               case GDI_PDSox:
+                       return "PDSox";
 
-               case GDI_DSPDxax:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DSPDxax [%08X]", code);
-                       break;
+               case GDI_PDSoan:
+                       return "PDSoan";
 
-               case GDI_PSDPxax:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PSDPxax [%08X]", code);
-                       break;
+               case GDI_DPSnaa:
+                       return "DPSnaa";
 
-               case GDI_SPna:
-                       _snprintf(buffer, sizeof(buffer), "GDI_SPna [%08X]", code);
-                       break;
+               case GDI_SDPxon:
+                       return "SDPxon";
 
                case GDI_DSna:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DSna [%08X]", code);
-                       break;
+                       return "DSna";
 
-               case GDI_DPa:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DPa [%08X]", code);
-                       break;
+               case GDI_SPDnaon:
+                       return "SPDnaon";
 
-               case GDI_PDxn:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PDxn [%08X]", code);
-                       break;
+               case GDI_SPxDSxa:
+                       return "SPxDSxa";
 
-               case GDI_DSxn:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DSxn [%08X]", code);
-                       break;
+               case GDI_PDSPanaxn:
+                       return "PDSPanaxn";
 
-               case GDI_PSDnox:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PSDnox [%08X]", code);
-                       break;
+               case GDI_SDPSaox:
+                       return "SDPSaox";
 
-               case GDI_PDSona:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PDSona [%08X]", code);
-                       break;
+               case GDI_SDPSxnox:
+                       return "SDPSxnox";
 
-               case GDI_PSDPaox:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PSDPaox [%08X]", code);
-                       break;
+               case GDI_DPSxa:
+                       return "DPSxa";
+
+               case GDI_PSDPSaoxxn:
+                       return "PSDPSaoxxn";
+
+               case GDI_DPSana:
+                       return "DPSana";
+
+               case GDI_SSPxPDxaxn:
+                       return "SSPxPDxaxn";
+
+               case GDI_SPDSoax:
+                       return "SPDSoax";
+
+               case GDI_PSDnox:
+                       return "PSDnox";
 
                case GDI_PSDPxox:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PSDPxox [%08X]", code);
-                       break;
+                       return "PSDPxox";
 
-               case GDI_PSDPxoxn:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PSDPxoxn [%08X]", code);
-                       break;
+               case GDI_PSDnoan:
+                       return "PSDnoan";
 
-               case GDI_DSPDxox:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DSPDxox [%08X]", code);
-                       break;
+               case GDI_PSna:
+                       return "PSna";
 
-               case GDI_DPSDonox:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DPSDonox [%08X]", code);
-                       break;
+               case GDI_SDPnaon:
+                       return "SDPnaon";
 
-               case GDI_SPDSxax:
-                       _snprintf(buffer, sizeof(buffer), "GDI_SPDSxax [%08X]", code);
-                       break;
+               case GDI_SDPSoox:
+                       return "SDPSoox";
 
-               case GDI_DPon:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DPon [%08X]", code);
-                       break;
+               case GDI_NOTSRCCOPY:
+                       return "Sn";
 
-               case GDI_DPna:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DPna [%08X]", code);
-                       break;
+               case GDI_SPDSaox:
+                       return "SPDSaox";
 
-               case GDI_Pn:
-                       _snprintf(buffer, sizeof(buffer), "GDI_Pn [%08X]", code);
-                       break;
+               case GDI_SPDSxnox:
+                       return "SPDSxnox";
+
+               case GDI_SDPox:
+                       return "SDPox";
+
+               case GDI_SDPoan:
+                       return "SDPoan";
+
+               case GDI_PSDPoax:
+                       return "PSDPoax";
+
+               case GDI_SPDnox:
+                       return "SPDnox";
+
+               case GDI_SPDSxox:
+                       return "SPDSxox";
+
+               case GDI_SPDnoan:
+                       return "SPDnoan";
+
+               case GDI_PSx:
+                       return "PSx";
+
+               case GDI_SPDSonox:
+                       return "SPDSonox";
+
+               case GDI_SPDSnaox:
+                       return "SPDSnaox";
+
+               case GDI_PSan:
+                       return "PSan";
+
+               case GDI_PSDnaa:
+                       return "PSDnaa";
+
+               case GDI_DPSxon:
+                       return "DPSxon";
+
+               case GDI_SDxPDxa:
+                       return "SDxPDxa";
+
+               case GDI_SPDSanaxn:
+                       return "SPDSanaxn";
+
+               case GDI_SRCERASE:
+                       return "SDna";
+
+               case GDI_DPSnaon:
+                       return "DPSnaon";
+
+               case GDI_DSPDaox:
+                       return "DSPDaox";
+
+               case GDI_PSDPxaxn:
+                       return "PSDPxaxn";
+
+               case GDI_SDPxa:
+                       return "SDPxa";
+
+               case GDI_PDSPDaoxxn:
+                       return "PDSPDaoxxn";
+
+               case GDI_DPSDoax:
+                       return "DPSDoax";
+
+               case GDI_PDSnox:
+                       return "PDSnox";
+
+               case GDI_SDPana:
+                       return "SDPana";
+
+               case GDI_SSPxDSxoxn:
+                       return "SSPxDSxoxn";
+
+               case GDI_PDSPxox:
+                       return "PDSPxox";
+
+               case GDI_PDSnoan:
+                       return "PDSnoan";
 
                case GDI_PDna:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PDna [%08X]", code);
-                       break;
+                       return "PDna";
+
+               case GDI_DSPnaon:
+                       return "DSPnaon";
+
+               case GDI_DPSDaox:
+                       return "DPSDaox";
+
+               case GDI_SPDSxaxn:
+                       return "SPDSxaxn";
+
+               case GDI_DPSonon:
+                       return "DPSonon";
+
+               case GDI_DSTINVERT:
+                       return "Dn";
+
+               case GDI_DPSox:
+                       return "DPSox";
+
+               case GDI_DPSoan:
+                       return "DPSoan";
+
+               case GDI_PDSPoax:
+                       return "PDSPoax";
+
+               case GDI_DPSnox:
+                       return "DPSnox";
+
+               case GDI_PATINVERT:
+                       return "DPx";
+
+               case GDI_DPSDonox:
+                       return "DPSDonox";
+
+               case GDI_DPSDxox:
+                       return "DPSDxox";
+
+               case GDI_DPSnoan:
+                       return "DPSnoan";
+
+               case GDI_DPSDnaox:
+                       return "DPSDnaox";
 
                case GDI_DPan:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DPan [%08X]", code);
-                       break;
+                       return "DPan";
+
+               case GDI_PDSxa:
+                       return "PDSxa";
+
+               case GDI_DSPDSaoxxn:
+                       return "DSPDSaoxxn";
+
+               case GDI_DSPDoax:
+                       return "DSPDoax";
+
+               case GDI_SDPnox:
+                       return "SDPnox";
+
+               case GDI_SDPSoax:
+                       return "SDPSoax";
+
+               case GDI_DSPnox:
+                       return "DSPnox";
+
+               case GDI_SRCINVERT:
+                       return "DSx";
+
+               case GDI_SDPSonox:
+                       return "SDPSonox";
+
+               case GDI_DSPDSonoxxn:
+                       return "DSPDSonoxxn";
+
+               case GDI_PDSxxn:
+                       return "PDSxxn";
+
+               case GDI_DPSax:
+                       return "DPSax";
+
+               case GDI_PSDPSoaxxn:
+                       return "PSDPSoaxxn";
+
+               case GDI_SDPax:
+                       return "SDPax";
+
+               case GDI_PDSPDoaxxn:
+                       return "PDSPDoaxxn";
+
+               case GDI_SDPSnoax:
+                       return "SDPSnoax";
+
+               case GDI_PDSxnan:
+                       return "PDSxnan";
+
+               case GDI_PDSana:
+                       return "PDSana";
+
+               case GDI_SSDxPDxaxn:
+                       return "SSDxPDxaxn";
+
+               case GDI_SDPSxox:
+                       return "SDPSxox";
+
+               case GDI_SDPnoan:
+                       return "SDPnoan";
+
+               case GDI_DSPDxox:
+                       return "DSPDxox";
+
+               case GDI_DSPnoan:
+                       return "DSPnoan";
+
+               case GDI_SDPSnaox:
+                       return "SDPSnaox";
 
                case GDI_DSan:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DSan [%08X]", code);
-                       break;
+                       return "DSan";
 
-               case GDI_D:
-                       _snprintf(buffer, sizeof(buffer), "GDI_D [%08X]", code);
-                       break;
+               case GDI_PDSax:
+                       return "PDSax";
 
-               case GDI_DPno:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DPno [%08X]", code);
-                       break;
+               case GDI_DSPDSoaxxn:
+                       return "DSPDSoaxxn";
 
-               case GDI_SDno:
-                       _snprintf(buffer, sizeof(buffer), "GDI_SDno [%08X]", code);
-                       break;
+               case GDI_DPSDnoax:
+                       return "DPSDnoax";
 
-               case GDI_PDno:
-                       _snprintf(buffer, sizeof(buffer), "GDI_PDno [%08X]", code);
-                       break;
+               case GDI_SDPxnan:
+                       return "SDPxnan";
 
-               case GDI_DPo:
-                       _snprintf(buffer, sizeof(buffer), "GDI_DPo [%08X]", code);
-                       break;
+               case GDI_SPDSnoax:
+                       return "SPDSnoax";
 
-               default:
-                       _snprintf(buffer, sizeof(buffer), "UNKNOWN [%02X]", code);
-                       break;
-       }
+               case GDI_DPSxnan:
+                       return "DPSxnan";
 
-       return buffer;
-}
+               case GDI_SPxDSxo:
+                       return "SPxDSxo";
 
-/**
- * Create a new solid brush.\n
- * @msdn{dd183518}
- * @param crColor brush color
- * @return new brush
- */
+               case GDI_DPSaan:
+                       return "DPSaan";
 
-HGDI_BRUSH gdi_CreateSolidBrush(UINT32 crColor)
-{
-       HGDI_BRUSH hBrush = (HGDI_BRUSH) calloc(1, sizeof(GDI_BRUSH));
+               case GDI_DPSaa:
+                       return "DPSaa";
 
-       if (!hBrush)
-               return NULL;
+               case GDI_SPxDSxon:
+                       return "SPxDSxon";
 
-       hBrush->objectType = GDIOBJECT_BRUSH;
-       hBrush->style = GDI_BS_SOLID;
-       hBrush->color = crColor;
-       return hBrush;
-}
+               case GDI_DPSxna:
+                       return "DPSxna";
 
-/**
- * Create a new pattern brush.\n
- * @msdn{dd183508}
- * @param hbmp pattern bitmap
- * @return new brush
- */
+               case GDI_SPDSnoaxn:
+                       return "SPDSnoaxn";
 
-HGDI_BRUSH gdi_CreatePatternBrush(HGDI_BITMAP hbmp)
-{
-       HGDI_BRUSH hBrush = (HGDI_BRUSH) calloc(1, sizeof(GDI_BRUSH));
+               case GDI_SDPxna:
+                       return "SDPxna";
 
-       if (!hBrush)
-               return NULL;
+               case GDI_PDSPnoaxn:
+                       return "PDSPnoaxn";
 
-       hBrush->objectType = GDIOBJECT_BRUSH;
-       hBrush->style = GDI_BS_PATTERN;
-       hBrush->pattern = hbmp;
-       return hBrush;
-}
+               case GDI_DSPDSoaxx:
+                       return "DSPDSoaxx";
 
-HGDI_BRUSH gdi_CreateHatchBrush(HGDI_BITMAP hbmp)
-{
-       HGDI_BRUSH hBrush = (HGDI_BRUSH) calloc(1, sizeof(GDI_BRUSH));
+               case GDI_PDSaxn:
+                       return "PDSaxn";
 
-       if (!hBrush)
-               return NULL;
+               case GDI_SRCAND:
+                       return "DSa";
 
-       hBrush->objectType = GDIOBJECT_BRUSH;
-       hBrush->style = GDI_BS_HATCHED;
-       hBrush->pattern = hbmp;
-       return hBrush;
-}
+               case GDI_SDPSnaoxn:
+                       return "SDPSnaoxn";
 
-UINT32 gdi_GetBrushStyle(HGDI_DC hdc)
-{
-       if (!hdc || !hdc->brush)
-               return GDI_BS_NULL;
+               case GDI_DSPnoa:
+                       return "DSPnoa";
 
-       return hdc->brush->style;
-}
+               case GDI_DSPDxoxn:
+                       return "DSPDxoxn";
 
-/**
- * Perform a pattern blit operation on the given pixel buffer.\n
- * @msdn{dd162778}
- * @param hdc device context
- * @param nXLeft x1
- * @param nYLeft y1
- * @param nWidth width
- * @param nHeight height
- * @param rop raster operation code
- * @return nonzero if successful, 0 otherwise
- */
-static BOOL BitBlt_DPa(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                       UINT32 nWidth, UINT32 nHeight)
-{
-       UINT32 x, y;
+               case GDI_SDPnoa:
+                       return "SDPnoa";
 
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                       if (dstp && patp)
-                       {
-                               UINT32 colorA = ReadColor(patp, hdcDest->format);
-                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                               UINT32 color = colorB & colorA;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
+               case GDI_SDPSxoxn:
+                       return "SDPSxoxn";
 
-       return TRUE;
-}
+               case GDI_SSDxPDxax:
+                       return "SSDxPDxax";
 
-static BOOL BitBlt_PDxn(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight)
-{
-       UINT32 x, y;
+               case GDI_PDSanan:
+                       return "PDSanan";
 
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
-                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                       if (dstp && patp)
-                       {
-                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                               UINT32 colorB = ReadColor(patp, hdcDest->format);
-                               UINT32 color = ~colorA ^ colorB;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
+               case GDI_PDSxna:
+                       return "PDSxna";
 
-       return TRUE;
-}
+               case GDI_SDPSnoaxn:
+                       return "SDPSnoaxn";
 
-static BOOL BitBlt_PATINVERT(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                             UINT32 nWidth, UINT32 nHeight)
-{
-       UINT32 x, y;
-       UINT32 color;
+               case GDI_DPSDPoaxx:
+                       return "DPSDPoaxx";
 
-       /* DPx */
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (dstp)
-                                       {
-                                               UINT32 dstColor = ReadColor(dstp, hdcDest->format);
-                                               dstColor ^= color;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
+               case GDI_SPDaxn:
+                       return "SPDaxn";
 
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (patp && dstp)
-                                       {
-                                               UINT32 colorA = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(dstp, hdcDest->format);
-                                               UINT32 color = colorA ^ colorB;
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
+               case GDI_PSDPSoaxx:
+                       return "PSDPSoaxx";
 
-       return TRUE;
-}
+               case GDI_DPSaxn:
+                       return "DPSaxn";
 
-static BOOL BitBlt_PATPAINT(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                            UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                            UINT32 nXSrc, UINT32 nYSrc)
-{
-       UINT32 x, y;
-       UINT32 color;
+               case GDI_DPSxx:
+                       return "DPSxx";
 
-       /* DPSnoo */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
+               case GDI_PSDPSonoxx:
+                       return "PSDPSonoxx";
 
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 dstColor;
-                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
-                                               dstColor = ~colorA | color | colorC;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
+               case GDI_SDPSonoxn:
+                       return "SDPSonoxn";
 
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && patp && dstp)
-                                       {
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 dstColor;
-                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
-                                               dstColor = ~colorA | colorB | colorC;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
+               case GDI_DSxn:
+                       return "DSxn";
 
-       return TRUE;
-}
+               case GDI_DPSnax:
+                       return "DPSnax";
 
-static BOOL BitBlt_PSo(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                       UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                       UINT32 nXSrc, UINT32 nYSrc)
-{
-       UINT32 x, y;
-       UINT32 color;
+               case GDI_SDPSoaxn:
+                       return "SDPSoaxn";
 
-       /* DPSnoo */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
+               case GDI_SPDnax:
+                       return "SPDnax";
 
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 colorC = ReadColor(srcp, hdcDest->format);
-                                               UINT32 dstColor = color | colorC;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
+               case GDI_DSPDoaxn:
+                       return "DSPDoaxn";
 
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && patp && dstp)
-                                       {
-                                               UINT32 colorB = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 dstColor;
-                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
-                                               dstColor = colorB | colorC;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
+               case GDI_DSPDSaoxx:
+                       return "DSPDSaoxx";
 
-       return TRUE;
-}
+               case GDI_PDSxan:
+                       return "PDSxan";
 
-static BOOL BitBlt_DSPnoo(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                          UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                          UINT32 nXSrc, UINT32 nYSrc)
-{
-       UINT32 x, y;
-       UINT32 color;
+               case GDI_DPa:
+                       return "DPa";
 
-       /* DPSnoo */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
+               case GDI_PDSPnaoxn:
+                       return "PDSPnaoxn";
 
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 dstColor;
-                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
-                                               dstColor = ~colorA | colorC | color;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
+               case GDI_DPSnoa:
+                       return "DPSnoa";
 
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && patp && dstp)
-                                       {
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 dstColor;
-                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
-                                               dstColor = ~colorA | colorB | colorC;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
+               case GDI_DPSDxoxn:
+                       return "DPSDxoxn";
 
-       return TRUE;
-}
+               case GDI_PDSPonoxn:
+                       return "PDSPonoxn";
 
-static BOOL BitBlt_DSPDoax(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                           UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                           UINT32 nXSrc, UINT32 nYSrc)
-{
-       UINT32 x, y;
-       UINT32 color;
+               case GDI_PDxn:
+                       return "PDxn";
 
-       /* DPSnoo */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
+               case GDI_DSPnax:
+                       return "DSPnax";
 
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 dstColor;
-                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
-                                               dstColor = colorA | colorC & color ^ colorA;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
+               case GDI_PDSPoaxn:
+                       return "PDSPoaxn";
 
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && patp && dstp)
-                                       {
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 dstColor;
-                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
-                                               dstColor = dstColor = colorA | colorC & colorB ^ colorA;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
+               case GDI_DPSoa:
+                       return "DPSoa";
 
-       return TRUE;
-}
+               case GDI_DPSoxn:
+                       return "DPSoxn";
 
-static BOOL BitBlt_todo(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                        UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                        UINT32 nXSrc, UINT32 nYSrc)
-{
-       UINT32 x, y;
-       UINT32 color;
+               case GDI_DSTCOPY:
+                       return "D";
 
-       /* DPSnoo */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
+               case GDI_DPSono:
+                       return "DPSono";
 
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 dstColor;
-                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
-                                               dstColor = (color & colorC) | (colorA & ~colorC);
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
+               case GDI_SPDSxax:
+                       return "SPDSxax";
 
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && patp && dstp)
-                                       {
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 dstColor;
-                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
-                                               dstColor = (colorB & colorC) | (colorA & ~colorC);
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
+               case GDI_DPSDaoxn:
+                       return "DPSDaoxn";
 
-       return TRUE;
-}
+               case GDI_DSPnao:
+                       return "DSPnao";
 
-static BOOL BitBlt_DPSoo(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                         UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
-                         UINT32 nXSrc, UINT32 nYSrc)
-{
-       UINT32 x, y;
-       UINT32 color;
+               case GDI_DPno:
+                       return "DPno";
 
-       /* DPSnoo */
-       if (!hdcDest || !hdcSrc)
-               return FALSE;
+               case GDI_PDSnoa:
+                       return "PDSnoa";
 
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
-
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && dstp)
-                                       {
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 dstColor;
-                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
-                                               dstColor = color | colorA | colorC;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
+               case GDI_PDSPxoxn:
+                       return "PDSPxoxn";
 
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);
-                                       const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
-
-                                       if (srcp && patp && dstp)
-                                       {
-                                               UINT32 colorA = ReadColor(dstp, hdcDest->format);
-                                               UINT32 colorB = ReadColor(patp, hdcDest->format);
-                                               UINT32 colorC = ReadColor(srcp, hdcSrc->format);
-                                               UINT32 dstColor;
-                                               colorC = ConvertColor(colorC, hdcSrc->format, hdcDest->format, NULL);
-                                               dstColor = colorB | colorA | colorC;
-                                               WriteColor(dstp, hdcDest->format, dstColor);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
+               case GDI_SSPxDSxox:
+                       return "SSPxDSxox";
 
-       return TRUE;
-}
+               case GDI_SDPanan:
+                       return "SDPanan";
 
-static BOOL BitBlt_PATCOPY(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                           UINT32 nWidth, UINT32 nHeight)
-{
-       UINT32 x, y, xOffset = 0, yOffset = 0, color;
+               case GDI_PSDnax:
+                       return "PSDnax";
 
-       /* P */
-       switch (gdi_GetBrushStyle(hdcDest))
-       {
-               case GDI_BS_SOLID:
-                       color = hdcDest->brush->color;
+               case GDI_DPSDoaxn:
+                       return "DPSDoaxn";
 
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x, nYDest + y);
+               case GDI_DPSDPaoxx:
+                       return "DPSDPaoxx";
 
-                                       if (dstp)
-                                               WriteColor(dstp, hdcDest->format, color);
-                               }
-                       }
+               case GDI_SDPxan:
+                       return "SDPxan";
 
-                       break;
+               case GDI_PSDPxax:
+                       return "PSDPxax";
 
-               case GDI_BS_HATCHED:
-                       xOffset = 0;
-                       yOffset = 2; /* +2 added after comparison to mstsc */
+               case GDI_DSPDaoxn:
+                       return "DSPDaoxn";
 
-               default:
-                       for (y = 0; y < nHeight; y++)
-                       {
-                               for (x = 0; x < nWidth; x++)
-                               {
-                                       const BYTE* patp = gdi_get_brush_pointer(
-                                                              hdcDest, nXDest + x + xOffset,
-                                                              nYDest + y + yOffset);
-                                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                                        hdcDest, nXDest + x,
-                                                        nYDest + y);
-
-                                       if (patp && dstp)
-                                       {
-                                               UINT32 color = ReadColor(patp, hdcDest->format);
-                                               WriteColor(dstp, hdcDest->format, color);
-                                       }
-                               }
-                       }
-
-                       break;
-       }
+               case GDI_DPSnao:
+                       return "DPSnao";
 
-       return TRUE;
-}
+               case GDI_MERGEPAINT:
+                       return "DSno";
 
-static BOOL BitBlt_DSTINVERT(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                             UINT32 nWidth, UINT32 nHeight)
-{
-       UINT32 x, y;
+               case GDI_SPDSanax:
+                       return "SPDSanax";
 
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       BYTE* dstp = gdi_get_bitmap_pointer(
-                                        hdcDest, nXDest + x, nYDest + y);
-
-                       if (dstp)
-                       {
-                               UINT32 color = ReadColor(dstp, hdcDest->format);
-                               color = ~color;
-                               WriteColor(dstp, hdcDest->format, color);
-                       }
-               }
-       }
+               case GDI_SDxPDxan:
+                       return "SDxPDxan";
 
-       return TRUE;
-}
+               case GDI_DPSxo:
+                       return "DPSxo";
 
-static BOOL BitBlt_BLACKNESS(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                             UINT32 nWidth, UINT32 nHeight)
-{
-       UINT32 x, y;
-       const UINT32 color = GetColor(hdcDest->format, 0, 0, 0, 0xFF);
+               case GDI_DPSano:
+                       return "DPSano";
 
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
+               case GDI_MERGECOPY:
+                       return "PSa";
 
-                       if (dstp)
-                               WriteColor(dstp, hdcDest->format, color);
-               }
-       }
+               case GDI_SPDSnaoxn:
+                       return "SPDSnaoxn";
 
-       return TRUE;
-}
+               case GDI_SPDSonoxn:
+                       return "SPDSonoxn";
 
-static BOOL BitBlt_WHITENESS(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
-                             UINT32 nWidth, UINT32 nHeight)
-{
-       UINT32 x, y;
-       const UINT32 color = GetColor(hdcDest->format, 0xFF, 0xFF, 0xFF, 0xFF);
+               case GDI_PSxn:
+                       return "PSxn";
 
-       for (y = 0; y < nHeight; y++)
-       {
-               for (x = 0; x < nWidth; x++)
-               {
-                       BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);
+               case GDI_SPDnoa:
+                       return "SPDnoa";
 
-                       if (dstp)
-                               WriteColor(dstp, hdcDest->format, color);
-               }
-       }
+               case GDI_SPDSxoxn:
+                       return "SPDSxoxn";
 
-       return TRUE;
-}
+               case GDI_SDPnax:
+                       return "SDPnax";
 
-BOOL gdi_PatBlt(HGDI_DC hdc, UINT32 nXLeft, UINT32 nYLeft,
-                UINT32 nWidth, UINT32 nHeight, DWORD rop,
-                HGDI_DC hdcSrc, UINT32 nXSrc, UINT32 nYSrc)
-{
-       WLog_VRB(TAG, "%s [%s] x=%lu, y=%lu, w=%lu, h=%lu [x=%lu, y=%lu] %s %s",
-                __FUNCTION__, gdi_rop_to_string(rop), nXLeft, nYLeft,
-                nWidth, nHeight, nXSrc, nYSrc, hdc ? GetColorFormatName(hdc->format) : "NULL",
-                hdcSrc ? GetColorFormatName(hdcSrc->format) : "NULL");
+               case GDI_PSDPoaxn:
+                       return "PSDPoaxn";
 
-       if (!gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL))
-               return TRUE;
+               case GDI_SDPoa:
+                       return "SDPoa";
 
-       if (!gdi_InvalidateRegion(hdc, nXLeft, nYLeft, nWidth, nHeight))
-               return FALSE;
+               case GDI_SPDoxn:
+                       return "SPDoxn";
+
+               case GDI_DPSDxax:
+                       return "DPSDxax";
+
+               case GDI_SPDSaoxn:
+                       return "SPDSaoxn";
+
+               case GDI_SRCCOPY:
+                       return "S";
+
+               case GDI_SDPono:
+                       return "SDPono";
+
+               case GDI_SDPnao:
+                       return "SDPnao";
+
+               case GDI_SPno:
+                       return "SPno";
+
+               case GDI_PSDnoa:
+                       return "PSDnoa";
+
+               case GDI_PSDPxoxn:
+                       return "PSDPxoxn";
+
+               case GDI_PDSnax:
+                       return "PDSnax";
+
+               case GDI_SPDSoaxn:
+                       return "SPDSoaxn";
+
+               case GDI_SSPxPDxax:
+                       return "SSPxPDxax";
+
+               case GDI_DPSanan:
+                       return "DPSanan";
+
+               case GDI_PSDPSaoxx:
+                       return "PSDPSaoxx";
+
+               case GDI_DPSxan:
+                       return "DPSxan";
+
+               case GDI_PDSPxax:
+                       return "PDSPxax";
+
+               case GDI_SDPSaoxn:
+                       return "SDPSaoxn";
+
+               case GDI_DPSDanax:
+                       return "DPSDanax";
+
+               case GDI_SPxDSxan:
+                       return "SPxDSxan";
+
+               case GDI_SPDnao:
+                       return "SPDnao";
+
+               case GDI_SDno:
+                       return "SDno";
+
+               case GDI_SDPxo:
+                       return "SDPxo";
+
+               case GDI_SDPano:
+                       return "SDPano";
+
+               case GDI_PDSoa:
+                       return "PDSoa";
+
+               case GDI_PDSoxn:
+                       return "PDSoxn";
+
+               case GDI_DSPDxax:
+                       return "DSPDxax";
+
+               case GDI_PSDPaoxn:
+                       return "PSDPaoxn";
+
+               case GDI_SDPSxax:
+                       return "SDPSxax";
+
+               case GDI_PDSPaoxn:
+                       return "PDSPaoxn";
+
+               case GDI_SDPSanax:
+                       return "SDPSanax";
+
+               case GDI_SPxPDxan:
+                       return "SPxPDxan";
+
+               case GDI_SSPxDSxax:
+                       return "SSPxDSxax";
+
+               case GDI_DSPDSanaxxn:
+                       return "DSPDSanaxxn";
+
+               case GDI_DPSao:
+                       return "DPSao";
+
+               case GDI_DPSxno:
+                       return "DPSxno";
+
+               case GDI_SDPao:
+                       return "SDPao";
+
+               case GDI_SDPxno:
+                       return "SDPxno";
+
+               case GDI_SRCPAINT:
+                       return "DSo";
+
+               case GDI_SDPnoo:
+                       return "SDPnoo";
+
+               case GDI_PATCOPY:
+                       return "P";
+
+               case GDI_PDSono:
+                       return "PDSono";
+
+               case GDI_PDSnao:
+                       return "PDSnao";
+
+               case GDI_PSno:
+                       return "PSno";
+
+               case GDI_PSDnao:
+                       return "PSDnao";
+
+               case GDI_PDno:
+                       return "PDno";
+
+               case GDI_PDSxo:
+                       return "PDSxo";
+
+               case GDI_PDSano:
+                       return "PDSano";
+
+               case GDI_PDSao:
+                       return "PDSao";
+
+               case GDI_PDSxno:
+                       return "PDSxno";
+
+               case GDI_DPo:
+                       return "DPo";
 
-       switch (rop)
-       {
                case GDI_PATPAINT:
-                       return BitBlt_PATPAINT(hdc, nXLeft, nYLeft, nWidth, nHeight,
-                                              hdcSrc, nXSrc, nYSrc);
+                       return "DPSnoo";
 
                case GDI_PSo:
-                       return BitBlt_PSo(hdc, nXLeft, nYLeft, nWidth, nHeight,
-                                         hdcSrc, nXSrc, nYSrc);
+                       return "PSo";
 
                case GDI_PSDnoo:
-                       return BitBlt_DSPnoo(hdc, nXLeft, nYLeft, nWidth, nHeight,
-                                            hdcSrc, nXSrc, nYSrc);
+                       return "PSDnoo";
 
                case GDI_DPSoo:
-                       return BitBlt_DPSoo(hdc, nXLeft, nYLeft, nWidth, nHeight,
-                                           hdcSrc, nXSrc, nYSrc);
+                       return "DPSoo";
 
-               case GDI_DSPDoax:
-                       return BitBlt_DSPDoax(hdc, nXLeft, nYLeft, nWidth, nHeight,
-                                             hdcSrc, nXSrc, nYSrc);
+               case GDI_WHITENESS:
+                       return "1";
 
-               case GDI_todo:
-                       return BitBlt_todo(hdc, nXLeft, nYLeft, nWidth, nHeight,
-                                          hdcSrc, nXSrc, nYSrc);
+               case GDI_GLYPH_ORDER:
+                       return "SPaDSnao";
 
-               case GDI_PATCOPY:
-                       return BitBlt_PATCOPY(hdc, nXLeft, nYLeft, nWidth, nHeight);
+               default:
+                       return "";
+       }
+}
 
-               case GDI_PATINVERT:
-                       return BitBlt_PATINVERT(hdc, nXLeft, nYLeft, nWidth, nHeight);
+/**
+* Create a new solid brush.\n
+* @msdn{dd183518}
+* @param crColor brush color
+* @return new brush
+*/
+HGDI_BRUSH gdi_CreateSolidBrush(UINT32 crColor)
+{
+       HGDI_BRUSH hBrush = (HGDI_BRUSH) calloc(1, sizeof(GDI_BRUSH));
 
-               case GDI_DSTINVERT:
-                       return BitBlt_DSTINVERT(hdc, nXLeft, nYLeft, nWidth, nHeight);
+       if (!hBrush)
+               return NULL;
 
-               case GDI_BLACKNESS:
-                       return BitBlt_BLACKNESS(hdc, nXLeft, nYLeft, nWidth, nHeight);
+       hBrush->objectType = GDIOBJECT_BRUSH;
+       hBrush->style = GDI_BS_SOLID;
+       hBrush->color = crColor;
+       return hBrush;
+}
+/**
+* Create a new pattern brush.\n
+* @msdn{dd183508}
+* @param hbmp pattern bitmap
+* @return new brush
+*/
+HGDI_BRUSH gdi_CreatePatternBrush(HGDI_BITMAP hbmp)
+{
+       HGDI_BRUSH hBrush = (HGDI_BRUSH) calloc(1, sizeof(GDI_BRUSH));
 
-               case GDI_WHITENESS:
-                       return BitBlt_WHITENESS(hdc, nXLeft, nYLeft, nWidth, nHeight);
+       if (!hBrush)
+               return NULL;
 
-               case GDI_DPa:
-                       return BitBlt_DPa(hdc, nXLeft, nYLeft, nWidth, nHeight);
+       hBrush->objectType = GDIOBJECT_BRUSH;
+       hBrush->style = GDI_BS_PATTERN;
+       hBrush->pattern = hbmp;
+       return hBrush;
+}
+HGDI_BRUSH gdi_CreateHatchBrush(HGDI_BITMAP hbmp)
+{
+       HGDI_BRUSH hBrush = (HGDI_BRUSH) calloc(1, sizeof(GDI_BRUSH));
 
-               case GDI_PDxn:
-                       return BitBlt_PDxn(hdc, nXLeft, nYLeft, nWidth, nHeight);
+       if (!hBrush)
+               return NULL;
 
-               default:
-                       break;
-       }
+       hBrush->objectType = GDIOBJECT_BRUSH;
+       hBrush->style = GDI_BS_HATCHED;
+       hBrush->pattern = hbmp;
+       return hBrush;
+}
+UINT32 gdi_GetBrushStyle(HGDI_DC hdc)
+{
+       if (!hdc || !hdc->brush)
+               return GDI_BS_NULL;
 
-       return FALSE;
+       return hdc->brush->style;
 }
index 5a2c273..28fd6e4 100644 (file)
@@ -35,9 +35,6 @@ HGDI_BRUSH gdi_CreateSolidBrush(UINT32 crColor);
 HGDI_BRUSH gdi_CreatePatternBrush(HGDI_BITMAP hbmp);
 HGDI_BRUSH gdi_CreateHatchBrush(HGDI_BITMAP hbmp);
 UINT32 gdi_GetBrushStyle(HGDI_DC hdc);
-BOOL gdi_PatBlt(HGDI_DC hdc, UINT32 nXLeft, UINT32 nYLeft,
-                UINT32 nWidth, UINT32 nHeight, DWORD rop,
-                HGDI_DC hdcSrc, UINT32 nXSRc, UINT32 nYSrc);
 
 #ifdef __cplusplus
 }
index 1979aba..6dbc68a 100644 (file)
@@ -670,9 +670,9 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
                hbrush->nXOrg = brush->x;
                hbrush->nYOrg = brush->y;
                gdi->drawing->hdc->brush = hbrush;
-               ret = gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
-                                patblt->nWidth, patblt->nHeight, rop,
-                                gdi->primary->hdc, nXSrc, nYSrc);
+               ret = gdi_BitBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
+                                patblt->nWidth, patblt->nHeight,
+                                gdi->primary->hdc, nXSrc, nYSrc, rop, &gdi->palette);
        }
 
 out_error:
@@ -1021,7 +1021,7 @@ static BOOL gdi_surface_bits(rdpContext* context,
                case RDP_CODEC_ID_REMOTEFX:
                        {
                                if (!rfx_process_message(context->codecs->rfx, cmd->bitmapData,
-                                                        PIXEL_FORMAT_BGRX32,
+                                                        PIXEL_FORMAT_BGRX32,
                                                         cmd->bitmapDataLength,
                                                         0, 0,
                                                         gdi->primary_buffer, gdi->dstFormat,
index ec3d477..55e341d 100644 (file)
@@ -201,7 +201,7 @@ static BOOL gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap,
 }
 
 /* Glyph Class */
-static BOOL gdi_Glyph_New(rdpContext* context, rdpGlyph* glyph)
+static BOOL gdi_Glyph_New(rdpContext* context, const rdpGlyph* glyph)
 {
        BYTE* data;
        gdiGlyph* gdi_glyph;
@@ -254,7 +254,7 @@ static void gdi_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
        }
 }
 
-static BOOL gdi_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, UINT32 x,
+static BOOL gdi_Glyph_Draw(rdpContext* context, const rdpGlyph* glyph, UINT32 x,
                            UINT32 y)
 {
        gdiGlyph* gdi_glyph;
@@ -267,7 +267,7 @@ static BOOL gdi_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, UINT32 x,
        gdi_glyph = (gdiGlyph*) glyph;
        return gdi_BitBlt(gdi->drawing->hdc, x, y, gdi_glyph->bitmap->width,
                          gdi_glyph->bitmap->height, gdi_glyph->hdc, 0, 0,
-                         GDI_todo, &context->gdi->palette);
+                         GDI_GLYPH_ORDER, &context->gdi->palette);
 }
 
 static BOOL gdi_Glyph_BeginDraw(rdpContext* context, UINT32 x, UINT32 y,