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
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
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;
#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)
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 );
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;
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;
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);