- gdk_draw_bitmap( m_window, m_textGC, bmap,
- source->DeviceToLogicalX(xsrc),
- source->DeviceToLogicalY(ysrc),
- 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 );
- }
-
- SetLogicalFunction( old_logical_func );
- return TRUE;
+ long xx = XLOG2DEV(xdest);
+ long yy = YLOG2DEV(ydest);
+
+ long ww = XLOG2DEVREL(width);
+ long hh = YLOG2DEVREL(height);
+
+ if ((width != ww) || (height != hh))
+ {
+ /* draw source window into a bitmap as we cannot scale
+ a window in contrast to a bitmap. this would actually
+ work with memory dcs as well, but we'd lose the mask
+ information and waste one step in this process since
+ a memory already has a bitmap. all this is slightly
+ inefficient as we could take an XImage directly from
+ an X window, but we'd then also have to care that
+ the window is not outside the screen (in which case
+ we'd get a BadMatch or what not).
+ Is a double XGetImage and combined XGetPixel and
+ XPutPixel really faster? I'm not sure. look at wxXt
+ for a different implementation of the same problem. */
+
+ wxBitmap bitmap( width, height );
+ gdk_window_copy_area( bitmap.GetPixmap(), m_penGC, 0, 0,
+ srcDC->GetWindow(),
+ xsrc, ysrc, width, height );
+
+ /* scale image */
+
+ wxImage image( bitmap );
+ image = image.Scale( ww, hh );
+
+ /* convert to bitmap */
+
+ bitmap = image.ConvertToBitmap();
+
+ /* draw scaled bitmap */
+
+ gdk_draw_pixmap( m_window, m_penGC, bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 );
+
+ }
+ else
+ {
+ /* no scaling and not a memory dc with a mask either */
+
+ gdk_window_copy_area( m_window, m_penGC, xx, yy,
+ srcDC->GetWindow(),
+ xsrc, ysrc, width, height );