]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 605188 ] Fix to draw 24 bit bitmaps
authorJulian Smart <julian@anthemion.co.uk>
Thu, 5 Sep 2002 19:59:34 +0000 (19:59 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 5 Sep 2002 19:59:34 +0000 (19:59 +0000)
Derry Bryson

Fix to wxPrinterDC::DrawBitmap() to print 24 bit bitmaps
at 24 bits rather than 8 bits.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/msw/dcprint.cpp

index 04d174c99125d901d5b5ac7c7d92dd7a06e5acbd..fcdc24fb8ab68ca765c2008d9fb6e31bed73f269 100644 (file)
@@ -285,6 +285,7 @@ wxMSW:
   provided in wxFontData
 - Added wxTE_LEFT, wxTE_CENTRE and wxTE_RIGHT flags for text
   control alignment.
+- Bitmap printing uses 24 bits now, not 8.
 
 wxGTK:
 
index e2b917ed82b79f3ae54e8d4fac7f452b2b7ec4e9..ed38d9fe6479936e9264a6f2e2c6290cd00dda69 100644 (file)
@@ -416,6 +416,10 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
 #define GDI_ERROR -1
 #endif
 
+// Just in case we want to go back to using 8 bits for
+// any reason: set this to 0 for 8 bits.
+#define wxUSE_DRAWBITMAP_24BITS 1
+
 void wxPrinterDC::DoDrawBitmap(const wxBitmap &bmp,
                                wxCoord x, wxCoord y,
                                bool useMask)
@@ -430,7 +434,11 @@ void wxPrinterDC::DoDrawBitmap(const wxBitmap &bmp,
         BITMAPINFO *info = (BITMAPINFO *) malloc( sizeof( BITMAPINFOHEADER ) + 256 * sizeof(RGBQUAD ) );
         memset( info, 0, sizeof( BITMAPINFOHEADER ) );
 
-        int iBitsSize = ((width + 3 ) & ~3 ) * height;
+#if wxUSE_DRAWBITMAP_24BITS
+        int iBitsSize = ((width + 3 ) & ~3 ) * height * 3;
+#else
+        int iBitsSize = ((width + 3 ) & ~3 ) * height ;
+#endif
 
         void* bits = malloc( iBitsSize );
 
@@ -438,7 +446,11 @@ void wxPrinterDC::DoDrawBitmap(const wxBitmap &bmp,
         info->bmiHeader.biWidth = width;
         info->bmiHeader.biHeight = height;
         info->bmiHeader.biPlanes = 1;
+#if wxUSE_DRAWBITMAP_24BITS
+        info->bmiHeader.biBitCount = 24;
+#else
         info->bmiHeader.biBitCount = 8;
+#endif        
         info->bmiHeader.biCompression = BI_RGB;
 
         ScreenHDC display;