+// compare to current clipping region
+bool wxWindowDCImpl::IsOutsideOfClippingRegion(int x, int y, int w, int h)
+{
+    if (m_currentClippingRegion.IsNull())
+        return false;
+
+    wxRegion region(x, y, w, h);
+    region.Intersect( m_currentClippingRegion );
+    return region.IsEmpty();
+}
+
+void wxWindowDCImpl::RemoveClipMask(GdkGC *gc)
+{
+    gdk_gc_set_clip_mask(gc, NULL);
+    gdk_gc_set_clip_origin(gc, 0, 0);
+    if (!m_currentClippingRegion.IsNull())
+        gdk_gc_set_clip_region(gc, m_currentClippingRegion.GetRegion());
+}
+
+// For drawing a mono-bitmap (XBitmap) we use the current text GC
+void wxWindowDCImpl::DoDrawMonoBitmap(const wxBitmap& bitmap,
+                                      int bmp_w, int bmp_h,
+                                      int xsrc, int ysrc,
+                                      int xdest, int ydest,
+                                      int width, int height)
+{
+    GdkPixmap *bitmap2
+        = gdk_pixmap_new( wxGetRootWindow()->window, bmp_w, bmp_h, -1 );
+    GdkGC *gc = gdk_gc_new( bitmap2 );
+    gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() );
+    gdk_gc_set_background( gc, m_textBackgroundColour.GetColor() );
+    gdk_wx_draw_bitmap(bitmap2, gc, bitmap.GetPixmap(), 0, 0);
+
+    gdk_draw_drawable(m_gdkwindow, m_textGC, bitmap2, xsrc, ysrc, xdest, ydest,
+                      width, height);
+
+    g_object_unref (bitmap2);
+    g_object_unref (gc);
+}
+
+// Returns a new mask that is the intersection of the old mask
+// and m_currentClippingRegion with proper offsets
+GdkBitmap* wxWindowDCImpl::GetClippedMask(GdkBitmap* mask, int w, int h,
+                                          int x, int y,
+                                          int xsrcMask, int ysrcMask)
+{
+    // create monochrome bitmap that will be used as the new mask
+    GdkBitmap *new_mask = gdk_pixmap_new( wxGetRootWindow()->window, w, h, 1 );
+
+    GdkColor c0, c1;
+    c0.pixel = 0;
+    c1.pixel = 1;
+    GdkGC *gc = gdk_gc_new( new_mask );
+
+    // zero-ing new_mask
+    gdk_gc_set_foreground( gc, &c0 );
+    gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, w, h );
+
+    // clipping region
+    gdk_gc_set_clip_region( gc, m_currentClippingRegion.GetRegion() );
+    gdk_gc_set_clip_origin( gc, -x, -y );
+
+    // copy the old mask to the new_mask in the clip region area
+    gdk_gc_set_background( gc, &c0 );
+    gdk_gc_set_foreground( gc, &c1 );
+    gdk_gc_set_fill( gc, GDK_OPAQUE_STIPPLED );
+    gdk_gc_set_ts_origin( gc, -xsrcMask, -ysrcMask );
+    gdk_gc_set_stipple( gc, mask );
+    gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, w, h );
+
+    g_object_unref (gc);
+    return new_mask;
+}
+