#endif
#include "wx/fontutil.h"
+#include "wx/vector.h"
#include "wx/x11/private.h"
#include "wx/x11/dcclient.h"
#define IS_16_PIX_HATCH(s) ((s)!=wxCROSSDIAG_HATCH && (s)!=wxHORIZONTAL_HATCH && (s)!=wxVERTICAL_HATCH)
static Pixmap hatches[num_hatches];
-static Pixmap *hatch_bitmap = (Pixmap *) NULL;
+static Pixmap *hatch_bitmap = NULL;
//-----------------------------------------------------------------------------
// constants
IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxX11DCImpl)
-wxWindowDCImpl::wxWindowDCImpl( wxDC *owner )
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner )
: wxX11DCImpl( owner )
-{
+{
Init();
}
void wxWindowDCImpl::Init()
{
- m_display = (WXDisplay *) NULL;
- m_penGC = (WXGC *) NULL;
- m_brushGC = (WXGC *) NULL;
- m_textGC = (WXGC *) NULL;
- m_bgGC = (WXGC *) NULL;
- m_cmap = (WXColormap *) NULL;
+ m_display = NULL;
+ m_penGC = NULL;
+ m_brushGC = NULL;
+ m_textGC = NULL;
+ m_bgGC = NULL;
+ m_cmap = NULL;
m_isMemDC = false;
m_isScreenDC = false;
- m_x11window = (WXWindow*) NULL;
+ m_x11window = NULL;
#if wxUSE_UNICODE
m_context = wxTheApp->GetPangoContext();
- m_fontdesc = (PangoFontDescription *)NULL;
+ m_fontdesc = NULL;
#endif
}
}
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
- const wxColour & col, int style);
+ const wxColour & col, wxFloodFillStyle style);
bool wxWindowDCImpl::DoFloodFill(wxCoord x, wxCoord y,
- const wxColour& col, int style)
+ const wxColour& col, wxFloodFillStyle style)
{
return wxDoFloodFill(GetOwner(), x, y, col, style);
}
void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
- int WXUNUSED(fillStyle) )
+ wxPolygonFillMode WXUNUSED(fillStyle) )
{
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
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 );
}
else
XCopyArea( (Display*) m_display, (Pixmap) use_bitmap.GetPixmap(), (Window) m_x11window,
(GC) m_penGC, 0, 0, ww, hh, xx, yy );
-
+
// remove mask again if any
if (setClipMask)
{
// wxUSE_NANOX/!wxUSE_NANOX
bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
- wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func, bool useMask,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc,
+ wxRasterOperationMode logical_func, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask )
{
/* this is the nth try to get this utterly useless function to
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
return true;
}
- int old_logical_func = m_logicalFunction;
+ wxRasterOperationMode old_logical_func = m_logicalFunction;
SetLogicalFunction( logical_func );
if (use_bitmap_method)
{
wxBitmap selected = memDC->GetSelectedBitmap();
-
+
// scale/translate bitmap size
wxCoord bm_width = selected.GetWidth();
wxCoord bm_height = selected.GetHeight();
SetLogicalFunction( old_logical_func );
return false;
}
-
+
if ((width != ww) || (height != hh))
{
/* Draw source window into a bitmap as we cannot scale
default:
{
lineStyle = LineSolid;
- req_dash = (wxX11Dash*)NULL;
+ req_dash = NULL;
req_nb_dash = 0;
break;
}
}
}
-void wxWindowDCImpl::SetLogicalFunction( int function )
+void wxWindowDCImpl::SetLogicalFunction( wxRasterOperationMode function )
{
wxCHECK_RET( IsOk(), wxT("invalid dc") );
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") );