compatible DC/Bitmap fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



as Marcus reported, the console was only working in black & white
the cause of the error comes from the following flow

1/ GetDC (physical and/or display)
2/ CreateCompatibleDC (on DC gotten from 1/)
3/ CreateCompatibleBitmap (on DC gotten from 2/)

the trouble is as follows :
- when a mem DC is created, its bits per pixel is always set to 1 
(the x11 driver sets in fact its bits per pixel count to the depth of
the bitmap set before creation in driver, which is the DEFAULT_BITMAP
(1x1 monochrome)
- when the compatible bitmap is created, its depth is set to the one
of the DC in parameter, hence 1

creating the bitmap in 3 with either a non memory DC or with 
CreateBitmap with the correct depth solves the issue

I'm not 100% sure the attached patch is the best way to solve this
issue (it mostly tests in CreateCompatibleBitmap that the DC isn't
a memory one, if so, it gets the depth from the funcs attached to
the DC)

feel free to propose a better solution, if any. This lets the console
blush again

A+
-- 
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle
Name: ccbmem
ChangeLog: fixed CreateCompatibleBitmap on memory DC
GenDate: 2001/12/01 20:06:31 UTC
ModifiedFiles: objects/bitmap.c
AddedFiles: 
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/objects/bitmap.c,v
retrieving revision 1.44
diff -u -u -r1.44 bitmap.c
--- objects/bitmap.c	2001/07/25 00:43:36	1.44
+++ objects/bitmap.c	2001/12/01 12:21:15
@@ -181,9 +181,11 @@
     } else {
         /* MS doc says if width or height is 0, return 1-by-1 pixel, monochrome bitmap */
         if (!width || !height) 
-	   hbmpRet = CreateBitmap( 1, 1, 1, 1, NULL );
-	else 
-	   hbmpRet = CreateBitmap( width, height, 1, dc->bitsPerPixel, NULL );
+            hbmpRet = CreateBitmap( 1, 1, 1, 1, NULL );
+	else if ((dc->flags & DC_MEMORY) && dc->funcs->pGetDeviceCaps)
+            hbmpRet = CreateBitmap( width, height, 1, dc->funcs->pGetDeviceCaps(dc, BITSPIXEL), NULL);
+        else
+            hbmpRet = CreateBitmap( width, height, 1, dc->bitsPerPixel, NULL );
 	if(dc->funcs->pCreateBitmap)
 	    dc->funcs->pCreateBitmap( hbmpRet );
     }

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux