wxPaintDC::~wxPaintDC(void)
{
+ Destroy();
}
void wxPaintDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
}
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
- wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool WXUNUSED(useMask) )
+ wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool useMask )
{
if (!Ok()) return FALSE;
if (csrc->m_isMemDC)
{
wxMemoryDC* srcDC = (wxMemoryDC*)source;
- GdkBitmap* bmap = srcDC->m_selected.GetBitmap();
+ GdkPixmap* bmap = srcDC->m_selected.GetPixmap();
if (bmap)
{
- gdk_draw_bitmap( m_window, m_textGC, bmap,
+ long xx = XLOG2DEV(xdest);
+ long yy = YLOG2DEV(ydest);
+
+ GdkBitmap *mask = (GdkBitmap *) NULL;
+ if (srcDC->m_selected.GetMask()) mask = srcDC->m_selected.GetMask()->GetBitmap();
+
+ if (useMask && mask)
+ {
+ gdk_gc_set_clip_mask( m_penGC, mask );
+ gdk_gc_set_clip_origin( m_penGC, xx, yy );
+ }
+
+ gdk_draw_pixmap( m_window, m_penGC, bmap,
source->DeviceToLogicalX(xsrc),
source->DeviceToLogicalY(ysrc),
- XLOG2DEV(xdest),
- YLOG2DEV(ydest),
+ xx,
+ yy,
source->DeviceToLogicalXRel(width),
source->DeviceToLogicalYRel(height) );
+
+ if (useMask && mask)
+ {
+ gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL );
+ gdk_gc_set_clip_origin( m_penGC, 0, 0 );
+ }
+
return TRUE;
}
}
void wxPaintDC::SetUpDC(void)
{
+ Destroy();
m_ok = TRUE;
m_logicalFunction = wxCOPY;
- if (m_penGC) gdk_gc_unref( m_penGC );
m_penGC = gdk_gc_new( m_window );
- if (m_brushGC) gdk_gc_unref( m_brushGC );
m_brushGC = gdk_gc_new( m_window );
- if (m_textGC) gdk_gc_unref( m_textGC );
m_textGC = gdk_gc_new( m_window );
- if (m_bgGC) gdk_gc_unref( m_bgGC );
m_bgGC = gdk_gc_new( m_window );
SetTextForeground( m_textForegroundColour );
SetTextBackground( m_textBackgroundColour );
}
}
+void wxPaintDC::Destroy(void)
+{
+ if (m_penGC) gdk_gc_unref( m_penGC );
+ m_penGC = (GdkGC*) NULL;
+ if (m_brushGC) gdk_gc_unref( m_brushGC );
+ m_brushGC = (GdkGC*) NULL;
+ if (m_textGC) gdk_gc_unref( m_textGC );
+ m_textGC = (GdkGC*) NULL;
+ if (m_bgGC) gdk_gc_unref( m_bgGC );
+ m_bgGC = (GdkGC*) NULL;
+}
+
GdkWindow *wxPaintDC::GetWindow(void)
{
return m_window;