]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dcclient.cpp
initialize GdkColor so code which incorrectly accesses it will work as well as it...
[wxWidgets.git] / src / gtk / dcclient.cpp
index bd8d184fc17359969c8d12b129223d3ebf3ff2c8..53f8ebfad92c585a394c25bc23566e02a037ca62 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef WX_PRECOMP
     #include "wx/log.h"
     #include "wx/dcmemory.h"
+    #include "wx/math.h" // for floating-point functions
 #endif
 
 #include "wx/image.h"
@@ -28,8 +29,6 @@
 #include "wx/gtk/win_gtk.h"
 #include "wx/gtk/private.h"
 
-#include "wx/math.h" // for floating-point functions
-
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 #include <gdk/gdkprivate.h>
@@ -369,7 +368,11 @@ void wxWindowDC::SetUpDC()
     /* background colour */
     m_backgroundBrush = *wxWHITE_BRUSH;
     m_backgroundBrush.GetColour().CalcPixel( m_cmap );
-    GdkColor *bg_col = m_backgroundBrush.GetColour().GetColor();
+#ifdef __WXGTK24__
+    const GdkColor *bg_col = m_backgroundBrush.GetColour().GetColor();
+#else
+          GdkColor *bg_col = m_backgroundBrush.GetColour().GetColor();
+#endif
 
     /* m_textGC */
     m_textForegroundColour.CalcPixel( m_cmap );
@@ -1586,16 +1589,17 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
 
 void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle )
 {
+    if (!m_window || text.empty())
+        return;
+
+    wxCHECK_RET( Ok(), wxT("invalid window dc") );
+
     if ( wxIsNullDouble(angle) )
     {
         DrawText(text, x, y);
         return;
     }
 
-    wxCHECK_RET( Ok(), wxT("invalid window dc") );
-
-    if (!m_window) return;
-
     wxCoord w;
     wxCoord h;