+ wxCHECK_RET( Ok(), "invalid dc" );
+
+ // FreeGetPixelCache();
+
+ XPoint *xpoints1 = new XPoint[n + 1];
+ XPoint *xpoints2 = new XPoint[n + 1];
+ int i;
+ for (i = 0; i < n; i++)
+ {
+ xpoints1[i].x = XLOG2DEV (points[i].x + xoffset);
+ xpoints1[i].y = YLOG2DEV (points[i].y + yoffset);
+ xpoints2[i].x = XLOG2DEV_2 (points[i].x + xoffset);
+ xpoints2[i].y = YLOG2DEV_2 (points[i].y + yoffset);
+ CalcBoundingBox (points[i].x + xoffset, points[i].y + yoffset);
+ }
+
+ // Close figure for XDrawLines (not needed for XFillPolygon)
+ xpoints1[i].x = xpoints1[0].x;
+ xpoints1[i].y = xpoints1[0].y;
+ xpoints2[i].x = xpoints2[0].x;
+ xpoints2[i].y = xpoints2[0].y;
+
+ if (m_brush.Ok() && m_brush.GetStyle () != wxTRANSPARENT)
+ {
+ SetBrush (m_brush);
+ XSetFillRule ((Display*) m_display, (GC) m_gc, fillStyle == wxODDEVEN_RULE ? EvenOddRule : WindingRule);
+ XFillPolygon ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1, n, Complex, 0);
+ XSetFillRule ((Display*) m_display, (GC) m_gc, EvenOddRule); // default mode
+ if (m_window && m_window->GetBackingPixmap())
+ {
+ XSetFillRule ((Display*) m_display,(GC) m_gcBacking,
+ fillStyle == wxODDEVEN_RULE ? EvenOddRule : WindingRule);
+ XFillPolygon ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints2, n, Complex, 0);
+ XSetFillRule ((Display*) m_display,(GC) m_gcBacking, EvenOddRule); // default mode
+ }
+ }
+
+ if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
+ {
+ if (m_autoSetting)
+ SetPen (m_pen);
+ XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1, n + 1, 0);
+
+ if (m_window && m_window->GetBackingPixmap())
+ XDrawLines ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints2, n + 1, 0);
+ }
+
+ delete[]xpoints1;
+ delete[]xpoints2;
+}
+
+void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+{
+ wxCHECK_RET( Ok(), "invalid dc" );
+
+ // FreeGetPixelCache();
+
+ int xd, yd, wfd, hfd, wd, hd;
+
+ xd = XLOG2DEV(x);
+ yd = YLOG2DEV(y);
+ wfd = XLOG2DEVREL(width);
+ wd = wfd - WX_GC_CF;
+ hfd = YLOG2DEVREL(height);
+ hd = hfd - WX_GC_CF;
+
+ if (wfd == 0 || hfd == 0) return;
+ if (wd < 0) { wd = - wd; xd = xd - wd; }
+ if (hd < 0) { hd = - hd; yd = yd - hd; }
+
+ if (m_brush.Ok() && m_brush.GetStyle () != wxTRANSPARENT)
+ {
+ SetBrush (m_brush);
+ XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wfd, hfd);
+
+ if (m_window && m_window->GetBackingPixmap())
+ XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ XLOG2DEV_2 (x), YLOG2DEV_2 (y),
+ wfd, hfd);
+ }
+
+ if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
+ {
+ if (m_autoSetting)
+ SetPen (m_pen);
+ XDrawRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd);
+
+ if (m_window && m_window->GetBackingPixmap())
+ XDrawRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ XLOG2DEV_2 (x), YLOG2DEV_2 (y),
+ wd, hd);
+ }
+ CalcBoundingBox (x, y);
+ CalcBoundingBox (x + width, y + height);
+}
+
+void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
+{
+ wxCHECK_RET( Ok(), "invalid dc" );
+
+ // FreeGetPixelCache();
+
+ // If radius is negative, it's a proportion of the smaller dimension.
+
+ if (radius < 0.0) radius = - radius * ((width < height) ? width : height);
+
+ int xd = XLOG2DEV (x);
+ int yd = YLOG2DEV (y);
+ int rd = XLOG2DEVREL ((long) radius);
+ int wd = XLOG2DEVREL (width) - WX_GC_CF;
+ int hd = YLOG2DEVREL (height) - WX_GC_CF;
+
+ int rw_d = rd * 2;
+ int rh_d = rw_d;
+
+ // If radius is zero use DrawRectangle() instead to avoid
+ // X drawing errors with small radii
+ if (rd == 0)
+ {
+ DrawRectangle( x, y, width, height );
+ return;
+ }
+
+ // Draw nothing if transformed w or h is 0
+ if (wd == 0 || hd == 0) return;
+
+ // CMB: adjust size if outline is drawn otherwise the result is
+ // 1 pixel too wide and high
+ if (m_pen.GetStyle() != wxTRANSPARENT)
+ {
+ wd--;
+ hd--;
+ }
+
+ // CMB: ensure dd is not larger than rectangle otherwise we
+ // get an hour glass shape
+ if (rw_d > wd) rw_d = wd;
+ if (rw_d > hd) rw_d = hd;
+ rd = rw_d / 2;
+
+ // For backing pixmap
+ int xd2 = XLOG2DEV_2 (x);
+ int yd2 = YLOG2DEV_2 (y);
+ int rd2 = XLOG2DEVREL ((long) radius);
+ int wd2 = XLOG2DEVREL (width) ;
+ int hd2 = YLOG2DEVREL (height) ;
+
+ int rw_d2 = rd2 * 2;
+ int rh_d2 = rw_d2;
+
+ if (m_brush.Ok() && m_brush.GetStyle () != wxTRANSPARENT)
+ {
+ SetBrush (m_brush);
+
+ XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd + rd, yd,
+ wd - rw_d, hd);
+ XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd + rd,
+ wd, hd - rh_d);
+
+ // Arcs start from 3 o'clock, positive angles anticlockwise
+ // Top-left
+ XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd,
+ rw_d, rh_d, 90 * 64, 90 * 64);
+ // Top-right
+ XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd + wd - rw_d, yd,
+ // rw_d, rh_d, 0, 90 * 64);
+ rw_d, rh_d, 0, 91 * 64);
+ // Bottom-right
+ XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd + wd - rw_d,
+ yd + hd - rh_d,
+ // rw_d, rh_d, 270 * 64, 90 * 64);
+ rw_d, rh_d, 269 * 64, 92 * 64);
+ // Bottom-left
+ XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd + hd - rh_d,
+ rw_d, rh_d, 180 * 64, 90 * 64);
+
+ if (m_window && m_window->GetBackingPixmap())
+ {
+ XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2 + rd2, yd2, wd2 - rw_d2, hd2);
+ XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2, yd2 + rd2, wd2, hd2 - rh_d2);
+
+ XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2, yd2, rw_d2, rh_d2, 90 * 64, 90 * 64);
+ XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2 + wd2 - rw_d2, yd2,
+ // rw_d2, rh_d2, 0, 90 * 64);
+ rw_d2, rh_d2, 0, 91 * 64);
+ XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2 + wd2 - rw_d2,
+ yd2 + hd2 - rh_d2,
+ // rw_d2, rh_d2, 270 * 64, 90 * 64);
+ rw_d2, rh_d2, 269 * 64, 92 * 64);
+ XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2, yd2 + hd2 - rh_d2,
+ rw_d2, rh_d2, 180 * 64, 90 * 64);
+ }
+ }
+
+ if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
+ {
+ SetPen (m_pen);
+ XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd + rd, yd,
+ xd + wd - rd + 1, yd);
+ XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd + rd, yd + hd,
+ xd + wd - rd, yd + hd);
+
+ XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd + rd,
+ xd, yd + hd - rd);
+ XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd + wd, yd + rd,
+ xd + wd, yd + hd - rd + 1);
+ XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd,
+ rw_d, rh_d, 90 * 64, 90 * 64);
+ XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd + wd - rw_d, yd,
+ // rw_d, rh_d, 0, 90 * 64);
+ rw_d, rh_d, 0, 91 * 64);
+ XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd + wd - rw_d,
+ yd + hd - rh_d,
+ rw_d, rh_d, 269 * 64, 92 * 64);
+ XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd + hd - rh_d,
+ rw_d, rh_d, 180 * 64, 90 * 64);
+
+ if (m_window && m_window->GetBackingPixmap())
+ {
+ XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2 + rd2, yd2,
+ xd2 + wd2 - rd2 + 1, yd2);
+ XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2 + rd2, yd2 + hd2,
+ xd2 + wd2 - rd2, yd2 + hd2);
+
+ XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2, yd2 + rd2,
+ xd2, yd2 + hd2 - rd2);
+ XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2 + wd2, yd2 + rd2,
+ xd2 + wd2, yd2 + hd2 - rd2 + 1);
+ XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2, yd2,
+ rw_d2, rh_d2, 90 * 64, 90 * 64);
+ XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2 + wd2 - rw_d2, yd2,
+ // rw_d2, rh_d2, 0, 90 * 64);
+ rw_d2, rh_d2, 0, 91 * 64);
+ XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2 + wd2 - rw_d2,
+ yd2 + hd2 - rh_d2,
+ rw_d2, rh_d2, 269 * 64, 92 * 64);
+ XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ xd2, yd2 + hd2 - rh_d2,
+ rw_d2, rh_d2, 180 * 64, 90 * 64);
+ }
+ }
+ CalcBoundingBox (x, y);
+ CalcBoundingBox (x + width, y + height);
+
+
+}
+
+void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+{
+ wxCHECK_RET( Ok(), "invalid dc" );
+
+ // Check for negative width and height
+ if (height < 0)
+ {
+ y = y + height;
+ height = - height ;
+ }
+
+ if (width < 0)
+ {
+ x = x + width;
+ width = - width ;
+ }
+
+ // FreeGetPixelCache();
+
+ static const int angle = 23040;
+
+ int xd, yd, wd, hd;
+
+ xd = XLOG2DEV(x);
+ yd = YLOG2DEV(y);
+ wd = XLOG2DEVREL(width) ;
+ hd = YLOG2DEVREL(height) ;
+
+ if (m_brush.Ok() && m_brush.GetStyle () != wxTRANSPARENT)
+ {
+ SetBrush (m_brush);
+ XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, 0, angle);
+ if (m_window && m_window->GetBackingPixmap())
+ XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ XLOG2DEV_2 (x), YLOG2DEV_2 (y),
+ XLOG2DEVREL (width) - WX_GC_CF,
+ YLOG2DEVREL (height) - WX_GC_CF, 0, angle);
+ }
+
+ if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
+ {
+ if (m_autoSetting)
+ SetPen (m_pen);
+ XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, 0, angle);
+ if (m_window && m_window->GetBackingPixmap())
+ XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ XLOG2DEV_2 (x), YLOG2DEV_2 (y),
+ XLOG2DEVREL (width) - WX_GC_CF,
+ YLOG2DEVREL (height) - WX_GC_CF, 0, angle);
+ }
+ CalcBoundingBox (x, y);
+ CalcBoundingBox (x + width, y + height);
+
+}
+
+bool wxWindowDC::CanDrawBitmap() const
+{
+ wxCHECK_MSG( Ok(), FALSE, "invalid dc" );
+
+ return TRUE;
+}
+
+#if 0
+void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
+{
+ // 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 (icon.GetDepth() <= 1)
+ {
+ XCopyPlane ((Display*) m_display, iconPixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ 0, 0, width, height, (int) XLOG2DEV_2 (x), (int) YLOG2DEV_2 (y), 1);
+ }
+ else
+ {
+ XCopyArea ((Display*) m_display, iconPixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ 0, 0, width, height,
+ (int) XLOG2DEV_2 (x), (int) YLOG2DEV_2 (y));
+ }
+ }
+ } else { /* Remote copy (different (Display*) m_displays) */
+ XImage *cache = NULL;
+ if (m_window && m_window->GetBackingPixmap())
+ XCopyRemote((Display*) icon.GetDisplay(), (Display*) m_display, iconPixmap, (Pixmap) m_window->GetBackingPixmap(),
+ (GC) m_gcBacking, 0, 0, width, height,
+ (int) XLOG2DEV_2 (x), (int) YLOG2DEV_2 (y), TRUE, &cache);
+ XCopyRemote((Display*) icon.GetDisplay(), (Display*) m_display, iconPixmap, (Pixmap) m_pixmap, (GC) m_gc,
+ 0, 0, width, height,
+ (int) XLOG2DEV (x), (int) YLOG2DEV (y), FALSE, &cache);
+ }
+ CalcBoundingBox (x, y);
+}
+#endif // 0
+
+// TODO: use scaled Blit e.g. as per John Price's implementation in Contrib/Utilities
+bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask,
+ wxCoord xsrcMask, wxCoord ysrcMask )
+{
+ wxCHECK_MSG( Ok(), FALSE, "invalid dc" );
+
+ wxWindowDC* sourceDC = wxDynamicCast(source, wxWindowDC);
+
+ wxASSERT_MSG( sourceDC, "Blit source DC must be wxWindowDC or derived class." );
+
+ // 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);
+
+ // Do bitmap scaling if necessary
+
+ wxBitmap *scaledBitmap = (wxBitmap*) NULL;
+ Pixmap sourcePixmap = (Pixmap) NULL;
+ double scaleX, scaleY;
+ GetUserScale(& scaleX, & scaleY);
+
+ /* TODO: use the mask origin when drawing transparently */
+ if (xsrcMask == -1 && ysrcMask == -1)
+ {
+ xsrcMask = xsrc; ysrcMask = ysrc;
+ }
+
+ // Sorry, can't scale masks just yet
+ if (!useMask && (scaleX != 1.0 || scaleY != 1.0) && sourceDC->IsKindOf(CLASSINFO(wxMemoryDC)))
+ {
+ wxMemoryDC* memDC = (wxMemoryDC*) sourceDC;
+ wxBitmap& bitmap = memDC->GetBitmap();
+
+ wxASSERT_MSG( (bitmap.Ok()), "Bad source bitmap in wxWindowDC::Blit");
+
+ wxImage image(bitmap);
+ if (!image.Ok())
+ {
+ sourcePixmap = (Pixmap) bitmap.GetPixmap();
+ }
+ else
+ {
+ int scaledW = (int) (bitmap.GetWidth() * scaleX);
+ int scaledH = (int) (bitmap.GetHeight() * scaleY);
+
+ image = image.Scale(scaledW, scaledH);
+ scaledBitmap = new wxBitmap(image.ConvertToBitmap());
+ sourcePixmap = (Pixmap) scaledBitmap->GetPixmap();
+ }
+ }
+ else
+ sourcePixmap = (Pixmap) sourceDC->m_pixmap;
+
+ if (m_pixmap && sourcePixmap)
+ {
+ /* MATTHEW: [9] */
+ int orig = m_logicalFunction;
+
+ SetLogicalFunction (rop);
+
+ if (m_display != sourceDC->m_display)
+ {
+ XImage *cache = NULL;
+
+ if (m_window && m_window->GetBackingPixmap())
+ XCopyRemote((Display*) sourceDC->m_display, (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->GetBitmap();
+ if ( sel.Ok() && sel.GetMask() && sel.GetMask()->GetPixmap() )
+ {
+ XSetClipMask ((Display*) m_display, (GC) m_gc, (Pixmap) sel.GetMask()->GetPixmap());
+ XSetClipOrigin ((Display*) m_display, (GC) m_gc, XLOG2DEV (xdest), YLOG2DEV (ydest));
+ }
+ }
+
+ XCopyRemote((Display*) sourceDC->m_display, (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 )
+ {
+ XSetClipMask ((Display*) m_display, (GC) m_gc, None);
+ XSetClipOrigin ((Display*) m_display, (GC) m_gc, 0, 0);
+ }
+
+ } else
+ {
+ 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)->GetBitmap().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->GetBitmap();
+ if ( sel.Ok() && sel.GetMask() && sel.GetMask()->GetPixmap() )
+ {
+ XSetClipMask ((Display*) m_display, (GC) m_gc, (Pixmap) sel.GetMask()->GetPixmap());
+ 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)->GetBitmap().Ok() && (((wxMemoryDC*)source)->GetBitmap().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 )
+ {
+ 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);
+
+ if (scaledBitmap) delete scaledBitmap;
+
+ return TRUE;
+ }
+ if (scaledBitmap) delete scaledBitmap;
+
+ return FALSE;
+}