From e11f2e1645e5322b8f44112733bd663927cf7783 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 5 Sep 2002 19:59:34 +0000 Subject: [PATCH] Applied patch [ 605188 ] Fix to draw 24 bit bitmaps 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 | 1 + src/msw/dcprint.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 04d174c991..fcdc24fb8a 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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: diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index e2b917ed82..ed38d9fe64 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -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; -- 2.47.2