#endif
#include "wx/fontutil.h"
+#include "wx/vector.h"
#include "wx/x11/private.h"
#include "wx/x11/dcclient.h"
IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxX11DCImpl)
-wxWindowDCImpl::wxWindowDCImpl( wxDC *owner )
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner )
: wxX11DCImpl( owner )
-{
+{
Init();
}
XSetStipple( xdisplay, gc, (Pixmap) mask);
}
- wxCoord clip_x, clip_y, clip_w, clip_h;
- m_currentClippingRegion.GetBox(clip_x, clip_y, clip_w, clip_h);
- XFillRectangle( xdisplay, new_pixmap, gc, clip_x-xx, clip_y-yy, clip_w, clip_h );
+ wxVector<XRectangle> rects;
+ for ( wxRegionIterator iter(m_currentClippingRegion);
+ iter;
+ ++iter )
+ {
+ XRectangle rect;
+ rect.x = iter.GetX() - xx;
+ rect.y = iter.GetY() - yy;
+ rect.width = iter.GetWidth();
+ rect.height = iter.GetHeight();
+ rects.push_back(rect);
+ }
+
+ XFillRectangles(xdisplay, new_pixmap, gc, &rects[0], rects.size());
XFreeGC( xdisplay, gc );
}
if (src_impl->m_isMemDC)
{
wxBitmap selected = memDC->GetSelectedBitmap();
-
+
if (!selected.IsOk()) return false;
/* we use the "XCopyArea" way to copy a memory dc into
if (use_bitmap_method)
{
wxBitmap selected = memDC->GetSelectedBitmap();
-
+
// scale/translate bitmap size
wxCoord bm_width = selected.GetWidth();
wxCoord bm_height = selected.GetHeight();
// Draw XPixmap or XBitmap, depending on what the wxBitmap contains. For
// drawing a mono-bitmap (XBitmap) we use the current text GC
-
if (is_mono)
XCopyPlane( (Display*) m_display, (Pixmap) use_bitmap.GetBitmap(), (Window) m_x11window,
(GC) m_textGC, xsrc, ysrc, width, height, xx, yy, 1 );
}
else // use_bitmap_method
{
+ wxDCImpl *impl = srcDC->GetImpl();
+ wxWindowDCImpl *x11_impl = wxDynamicCast(impl, wxWindowDCImpl);
+ if (!x11_impl)
+ {
+ SetLogicalFunction( old_logical_func );
+ return false;
+ }
+
if ((width != ww) || (height != hh))
{
/* Draw source window into a bitmap as we cannot scale
// copy including child window contents
XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, IncludeInferiors );
- XCopyArea( (Display*) m_display, (Window) srcDC->GetWindow(), (Window) bitmap.GetPixmap(),
+ XCopyArea( (Display*) m_display, (Window) x11_impl->GetX11Window(), (Window) bitmap.GetPixmap(),
(GC) m_penGC, xsrc, ysrc, width, height, 0, 0 );
XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, ClipByChildren );
else
{
// No scaling and not a memory dc with a mask either
-
// copy including child window contents
XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, IncludeInferiors );
- XCopyArea( (Display*) m_display, (Window) srcDC->GetWindow(), (Window) m_x11window,
+ XCopyArea( (Display*) m_display, (Window) x11_impl->GetX11Window(), (Window) m_x11window,
(GC) m_penGC, xsrc, ysrc, width, height, xx, yy );
XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, ClipByChildren );
}
XSetRegion( (Display*) m_display, (GC) m_bgGC, (Region) m_currentClippingRegion.GetX11Region() );
}
-void wxWindowDCImpl::DoSetClippingRegionAsRegion( const wxRegion& region )
+void wxWindowDCImpl::DoSetDeviceClippingRegion( const wxRegion& region )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );