+ m_ok = true;
+
+ wxASSERT_MSG( !m_penGC, wxT("GCs already created") );
+
+ bool done = false;
+
+ if ((isMemDC) && (GetSelectedBitmap().IsOk()))
+ {
+ if (GetSelectedBitmap().GetDepth() == 1)
+ {
+ m_penGC = wxGetPoolGC( m_gdkwindow, wxPEN_MONO );
+ m_brushGC = wxGetPoolGC( m_gdkwindow, wxBRUSH_MONO );
+ m_textGC = wxGetPoolGC( m_gdkwindow, wxTEXT_MONO );
+ m_bgGC = wxGetPoolGC( m_gdkwindow, wxBG_MONO );
+ done = true;
+ }
+ }
+
+ if (!done)
+ {
+ if (m_isScreenDC)
+ {
+ m_penGC = wxGetPoolGC( m_gdkwindow, wxPEN_SCREEN );
+ m_brushGC = wxGetPoolGC( m_gdkwindow, wxBRUSH_SCREEN );
+ m_textGC = wxGetPoolGC( m_gdkwindow, wxTEXT_SCREEN );
+ m_bgGC = wxGetPoolGC( m_gdkwindow, wxBG_SCREEN );
+ }
+#if GTK_CHECK_VERSION(2,12,0)
+ // gdk_screen_get_rgba_colormap was added in 2.8, but this code is for
+ // compositing which requires 2.12
+ else if (gtk_check_version(2,12,0) == NULL &&
+ m_cmap == gdk_screen_get_rgba_colormap(gdk_colormap_get_screen(m_cmap)))
+ {
+ m_penGC = wxGetPoolGC( m_gdkwindow, wxPEN_COLOUR_ALPHA );
+ m_brushGC = wxGetPoolGC( m_gdkwindow, wxBRUSH_COLOUR_ALPHA );
+ m_textGC = wxGetPoolGC( m_gdkwindow, wxTEXT_COLOUR_ALPHA );
+ m_bgGC = wxGetPoolGC( m_gdkwindow, wxBG_COLOUR_ALPHA );
+ }
+#endif
+ else
+ {
+ m_penGC = wxGetPoolGC( m_gdkwindow, wxPEN_COLOUR );
+ m_brushGC = wxGetPoolGC( m_gdkwindow, wxBRUSH_COLOUR );
+ m_textGC = wxGetPoolGC( m_gdkwindow, wxTEXT_COLOUR );
+ m_bgGC = wxGetPoolGC( m_gdkwindow, wxBG_COLOUR );
+ }
+ }
+
+ /* background colour */
+ m_backgroundBrush = *wxWHITE_BRUSH;
+ m_backgroundBrush.GetColour().CalcPixel( m_cmap );
+ const GdkColor *bg_col = m_backgroundBrush.GetColour().GetColor();
+
+ /* m_textGC */
+ m_textForegroundColour.CalcPixel( m_cmap );
+ gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
+
+ m_textBackgroundColour.CalcPixel( m_cmap );
+ gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
+
+ gdk_gc_set_fill( m_textGC, GDK_SOLID );
+
+ gdk_gc_set_colormap( m_textGC, m_cmap );
+
+ /* m_penGC */
+ m_pen.GetColour().CalcPixel( m_cmap );
+ gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
+ gdk_gc_set_background( m_penGC, bg_col );
+
+ gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
+
+ /* m_brushGC */
+ m_brush.GetColour().CalcPixel( m_cmap );
+ gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() );
+ gdk_gc_set_background( m_brushGC, bg_col );
+
+ gdk_gc_set_fill( m_brushGC, GDK_SOLID );
+
+ /* m_bgGC */
+ gdk_gc_set_background( m_bgGC, bg_col );
+ gdk_gc_set_foreground( m_bgGC, bg_col );
+
+ gdk_gc_set_fill( m_bgGC, GDK_SOLID );
+
+ /* ROPs */
+ gdk_gc_set_function( m_textGC, GDK_COPY );
+ gdk_gc_set_function( m_brushGC, GDK_COPY );
+ gdk_gc_set_function( m_penGC, GDK_COPY );
+
+ /* clipping */
+ gdk_gc_set_clip_rectangle( m_penGC, NULL );
+ gdk_gc_set_clip_rectangle( m_brushGC, NULL );
+ gdk_gc_set_clip_rectangle( m_textGC, NULL );
+ gdk_gc_set_clip_rectangle( m_bgGC, NULL );