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
This commit is contained in:
@@ -285,6 +285,7 @@ wxMSW:
|
|||||||
provided in wxFontData
|
provided in wxFontData
|
||||||
- Added wxTE_LEFT, wxTE_CENTRE and wxTE_RIGHT flags for text
|
- Added wxTE_LEFT, wxTE_CENTRE and wxTE_RIGHT flags for text
|
||||||
control alignment.
|
control alignment.
|
||||||
|
- Bitmap printing uses 24 bits now, not 8.
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
@@ -416,6 +416,10 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
|
|||||||
#define GDI_ERROR -1
|
#define GDI_ERROR -1
|
||||||
#endif
|
#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,
|
void wxPrinterDC::DoDrawBitmap(const wxBitmap &bmp,
|
||||||
wxCoord x, wxCoord y,
|
wxCoord x, wxCoord y,
|
||||||
bool useMask)
|
bool useMask)
|
||||||
@@ -430,7 +434,11 @@ void wxPrinterDC::DoDrawBitmap(const wxBitmap &bmp,
|
|||||||
BITMAPINFO *info = (BITMAPINFO *) malloc( sizeof( BITMAPINFOHEADER ) + 256 * sizeof(RGBQUAD ) );
|
BITMAPINFO *info = (BITMAPINFO *) malloc( sizeof( BITMAPINFOHEADER ) + 256 * sizeof(RGBQUAD ) );
|
||||||
memset( info, 0, sizeof( BITMAPINFOHEADER ) );
|
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 );
|
void* bits = malloc( iBitsSize );
|
||||||
|
|
||||||
@@ -438,7 +446,11 @@ void wxPrinterDC::DoDrawBitmap(const wxBitmap &bmp,
|
|||||||
info->bmiHeader.biWidth = width;
|
info->bmiHeader.biWidth = width;
|
||||||
info->bmiHeader.biHeight = height;
|
info->bmiHeader.biHeight = height;
|
||||||
info->bmiHeader.biPlanes = 1;
|
info->bmiHeader.biPlanes = 1;
|
||||||
|
#if wxUSE_DRAWBITMAP_24BITS
|
||||||
|
info->bmiHeader.biBitCount = 24;
|
||||||
|
#else
|
||||||
info->bmiHeader.biBitCount = 8;
|
info->bmiHeader.biBitCount = 8;
|
||||||
|
#endif
|
||||||
info->bmiHeader.biCompression = BI_RGB;
|
info->bmiHeader.biCompression = BI_RGB;
|
||||||
|
|
||||||
ScreenHDC display;
|
ScreenHDC display;
|
||||||
|
Reference in New Issue
Block a user