-void wxWindowDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
-{
- if (!Ok()) return;
-
- if (!icon.Ok()) return;
-
-// FreeGetPixelCache();
-
- // Be sure that foreground pixels (1) of
- // the Icon will be painted with pen colour. [m_pen.SetColour()]
- // Background pixels (0) will be painted with
- // last selected background color. [::SetBackground]
- if (m_pen.Ok() && m_autoSetting)
- SetPen (m_pen);
-
- int width, height;
- Pixmap iconPixmap = (Pixmap) icon.GetPixmap();
- width = icon.GetWidth();
- height = icon.GetHeight();
- if (icon.GetDisplay() == m_display)
- {
- if (icon.GetDepth() <= 1)
- {
- XCopyPlane ((Display*) m_display, iconPixmap, (Pixmap) m_pixmap, (GC) m_gc,
- 0, 0, width, height,
- (int) XLOG2DEV (x), (int) YLOG2DEV (y), 1);
- }
- else
- {
- XCopyArea ((Display*) m_display, iconPixmap, (Pixmap) m_pixmap, (GC) m_gc,
- 0, 0, width, height,
- (int) XLOG2DEV (x), (int) YLOG2DEV (y));
- }
-
-
- if (m_window && m_window->GetBackingPixmap())
+ if (m_display != srcDpy)
+ {
+ XImage *cache = NULL;
+
+ if (m_window && m_window->GetBackingPixmap())
+ XCopyRemote((Display*) srcDpy, (Display*) m_display,
+ (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),
+ (GC) m_gcBacking,
+ source->LogicalToDeviceX (xsrc),
+ source->LogicalToDeviceY (ysrc),
+ source->LogicalToDeviceXRel(width),
+ source->LogicalToDeviceYRel(height),
+ XLOG2DEV_2 (xdest), YLOG2DEV_2 (ydest),
+ True, &cache);
+
+ if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) )
+ {
+ wxMemoryDC *memDC = (wxMemoryDC *)source;
+ wxBitmap& sel = memDC->GetSelectedBitmap();
+ if ( sel.IsOk() && sel.GetMask() && sel.GetMask()->GetBitmap() )
+ {
+ XSetClipMask ((Display*) m_display, (GC) m_gc, (Pixmap) sel.GetMask()->GetBitmap());
+ XSetClipOrigin ((Display*) m_display, (GC) m_gc, XLOG2DEV (xdest), YLOG2DEV (ydest));
+ }
+ }
+
+ XCopyRemote((Display*) srcDpy, (Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_pixmap, (GC) m_gc,
+ source->LogicalToDeviceX (xsrc),
+ source->LogicalToDeviceY (ysrc),
+ source->LogicalToDeviceXRel(width),
+ source->LogicalToDeviceYRel(height),
+ XLOG2DEV (xdest), YLOG2DEV (ydest),
+ False, &cache);
+
+ if ( useMask )
+ {
+ if ( m_clipRegion )
+ XSetRegion ((Display*) m_display, (GC) m_gc,
+ (Region) m_clipRegion);
+ else
+ XSetClipMask ((Display*) m_display, (GC) m_gc, None);
+
+ XSetClipOrigin ((Display*) m_display, (GC) m_gc, 0, 0);
+ }
+
+ } else
+ { //XGCValues values;
+ //XGetGCValues((Display*)m_display, (GC)m_gc, GCForeground, &values);
+
+ if (m_window && m_window->GetBackingPixmap())
+ {
+ // +++ MARKUS (mho@comnets.rwth-aachen): error on blitting bitmaps with depth 1
+ if (source->IsKindOf(CLASSINFO(wxMemoryDC)) && ((wxMemoryDC*) source)->GetSelectedBitmap().GetDepth() == 1)
+ {
+ XCopyPlane ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ source->LogicalToDeviceX (xsrc),
+ source->LogicalToDeviceY (ysrc),
+ source->LogicalToDeviceXRel(width),
+ source->LogicalToDeviceYRel(height),
+ XLOG2DEV_2 (xdest), YLOG2DEV_2 (ydest), 1);
+ }
+ else
+ {
+ XCopyArea ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ source->LogicalToDeviceX (xsrc),
+ source->LogicalToDeviceY (ysrc),
+ source->LogicalToDeviceXRel(width),
+ source->LogicalToDeviceYRel(height),
+ XLOG2DEV_2 (xdest), YLOG2DEV_2 (ydest));
+ }
+ }
+ if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) )
+ {
+ wxMemoryDC *memDC = (wxMemoryDC *)source;
+ wxBitmap& sel = memDC->GetSelectedBitmap();
+ if ( sel.IsOk() && sel.GetMask() && sel.GetMask()->GetBitmap() )
+ {
+ XSetClipMask ((Display*) m_display, (GC) m_gc, (Pixmap) sel.GetMask()->GetBitmap());
+ XSetClipOrigin ((Display*) m_display, (GC) m_gc, XLOG2DEV (xdest), YLOG2DEV (ydest));
+ }
+ }
+
+ // Check if we're copying from a mono bitmap
+ if (source->IsKindOf(CLASSINFO(wxMemoryDC)) &&
+ ((wxMemoryDC*)source)->GetSelectedBitmap().IsOk() &&
+ (((wxMemoryDC*)source)->GetSelectedBitmap().GetDepth () == 1))
+ {
+ XCopyPlane ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_pixmap, (GC) m_gc,
+ source->LogicalToDeviceX (xsrc),
+ source->LogicalToDeviceY (ysrc),
+ source->LogicalToDeviceXRel(width),
+ source->LogicalToDeviceYRel(height),
+ XLOG2DEV (xdest), YLOG2DEV (ydest), 1);
+ }
+ else
+ {
+ XCopyArea ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_pixmap, (GC) m_gc,
+ source->LogicalToDeviceX (xsrc),
+ source->LogicalToDeviceY (ysrc),
+ source->LogicalToDeviceXRel(width),
+ source->LogicalToDeviceYRel(height),
+ XLOG2DEV (xdest), YLOG2DEV (ydest));
+
+ }
+ if ( useMask )
+ {
+ if ( m_clipRegion )
+ XSetRegion ((Display*) m_display, (GC) m_gc,
+ (Region) m_clipRegion);
+ else
+ XSetClipMask ((Display*) m_display, (GC) m_gc, None);
+
+ XSetClipOrigin ((Display*) m_display, (GC) m_gc, 0, 0);
+ }
+
+ } /* Remote/local (Display*) m_display */
+ CalcBoundingBox (xdest, ydest);
+ CalcBoundingBox (xdest + width, ydest + height);
+
+ SetLogicalFunction(orig);
+
+ retVal = true;
+ }
+ if (scaledBitmap) delete scaledBitmap;
+
+ if (oldBackgroundPixel > -1)