X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7ba4fbebbc40bdf9c140f4c9ba9977fbf810527d..05159a2750ed2cc5945a85bc5fc6849ad1a30e75:/src/msw/dcprint.cpp diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index 6ed8cdc9b1..e04d74c88d 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -194,7 +194,7 @@ bool wxPrinterDC::StartDoc(const wxString& message) if (ret <= 0) { DWORD lastError = GetLastError(); - wxLogDebug(wxT("wxDC::StartDoc failed with error: %d\n"), lastError); + wxLogDebug(wxT("wxDC::StartDoc failed with error: %ld\n"), lastError); } #endif @@ -224,16 +224,18 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName) deviceName.clear(); LPDEVNAMES lpDevNames; - LPSTR lpszDriverName; - LPSTR lpszDeviceName; - LPSTR lpszPortName; + LPTSTR lpszDriverName; + LPTSTR lpszDeviceName; + LPTSTR lpszPortName; PRINTDLG pd; // Cygwin has trouble believing PRINTDLG is 66 bytes - thinks it is 68 #ifdef __GNUWIN32__ + memset(&pd, 0, 66); pd.lStructSize = 66; // sizeof(PRINTDLG); #else + memset(&pd, 0, sizeof(PRINTDLG)); pd.lStructSize = sizeof(PRINTDLG); #endif @@ -256,9 +258,9 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName) if (pd.hDevNames) { lpDevNames = (LPDEVNAMES)GlobalLock(pd.hDevNames); - lpszDriverName = (LPSTR)lpDevNames + lpDevNames->wDriverOffset; - lpszDeviceName = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset; - lpszPortName = (LPSTR)lpDevNames + lpDevNames->wOutputOffset; + lpszDriverName = (LPTSTR)lpDevNames + lpDevNames->wDriverOffset; + lpszDeviceName = (LPTSTR)lpDevNames + lpDevNames->wDeviceOffset; + lpszPortName = (LPTSTR)lpDevNames + lpDevNames->wOutputOffset; deviceName = lpszDeviceName; portName = lpszPortName; @@ -414,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) @@ -428,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 ) & ~3 ) * height; +#else + int iBitsSize = ((width + 3 ) & ~3 ) * height ; +#endif void* bits = malloc( iBitsSize ); @@ -436,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; @@ -472,7 +486,8 @@ bool wxPrinterDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop, bool useMask) + int WXUNUSED(rop), bool useMask, + wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(ysrcMask)) { bool success = TRUE; @@ -496,7 +511,7 @@ bool wxPrinterDC::DoBlit(wxCoord xdest, wxCoord ydest, HBRUSH brush = ::CreateSolidBrush(::GetPixel(dc_src, x, y)); rect.left = xdest + x; rect.right = rect.left + 1; - rect.top = ydest + y; + rect.top = ydest + y; rect.bottom = rect.top + 1; ::FillRect(GetHdc(), &rect, brush); ::DeleteObject(brush);