]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dcprint.cpp
fixed SaveDIB() crash with BW images (patch 1045884)
[wxWidgets.git] / src / msw / dcprint.cpp
index e817ba19894c2c0a1931be86b1d249a3540d9333..91e48e9c5e11bbcf1d24a811c5797f1c36a19d96 100644 (file)
@@ -45,6 +45,7 @@
 
 #include "wx/dcprint.h"
 #include "wx/printdlg.h"
+#include "wx/msw/printdlg.h"
 #include "math.h"
 
 #if wxUSE_COMMON_DIALOGS
@@ -283,10 +284,22 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName)
 // Gets an HDC for the specified printer configuration
 WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
 {
+#if defined(__WXUNIVERSAL__) && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW)
+
+#if 0
+    wxPostScriptPrintNativeData *data =
+        (wxPostScriptPrintNativeData *) printDataConst.GetNativeData();
+    // FIXME: how further ???
+#else
+    return 0;
+#endif
+
+#else // Postscript vs. native Windows
+
     wxWindowsPrintNativeData *data =
         (wxWindowsPrintNativeData *) printDataConst.GetNativeData();
-        
-    data->ConvertFrom( printDataConst );
+
+    data->TransferFrom( printDataConst );
 
     wxChar* driverName = (wxChar*) NULL;
 
@@ -301,7 +314,7 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
 
     LPDEVMODE lpDevMode = (LPDEVMODE) NULL;
 
-    HGLOBAL hDevMode = (HGLOBAL)(DWORD) data->GetNativeData();
+    HGLOBAL hDevMode = (HGLOBAL)(DWORD) data->GetDevMode();
 
     if ( hDevMode )
         lpDevMode = (DEVMODE*) GlobalLock(hDevMode);
@@ -327,6 +340,7 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
         GlobalUnlock(hDevMode);
 
     return (WXHDC) hDC;
+#endif
 }
 
 // ----------------------------------------------------------------------------