#include <math.h>
+#ifdef __VMS__
+#pragma message disable nosimpint
+#endif
#include <Xm/Xm.h>
+#ifdef __VMS__
+#pragma message enable nosimpint
+#endif
#include "wx/motif/private.h"
+#ifdef __EMX__
+ #include <float.h> // for M_PI
+#endif // __EMX__
+
#include "bdiag.xbm"
#include "fdiag.xbm"
#include "cdiag.xbm"
// constants
// ----------------------------------------------------------------------------
-#define RAD2DEG 57.2957795131
-
// Fudge factor (VZ: what??)
#define WX_GC_CF 1
// macros
// ----------------------------------------------------------------------------
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
-#endif
// ----------------------------------------------------------------------------
// prototypes
// implementation
// ============================================================================
+/*
+ * compare two doubles and return the larger rounded
+ * to the nearest int
+ */
+static int roundmax(double a, double b)
+{
+ return (int)((a > b ? a : b) + 0.5);
+}
+
+/*
+ * compare two doubles and return the smaller rounded
+ * to the nearest int
+ */
+static int roundmin(double a, double b)
+{
+ return (int)((a < b ? a : b) - 0.5);
+}
+
+
// ----------------------------------------------------------------------------
// wxWindowDC
// ----------------------------------------------------------------------------
m_currentPenWidth = 1;
m_currentPenJoin = -1;
m_currentPenDashCount = -1;
- m_currentPenDash = (char*) NULL;
+ m_currentPenDash = (wxMOTIFDash*) NULL;
m_currentStyle = -1;
m_currentFill = -1;
// m_currentBkMode = wxTRANSPARENT;
wxASSERT_MSG( (window != (wxWindow*) NULL), "You must pass a valid wxWindow to wxWindowDC/wxClientDC/wxPaintDC constructor." );
m_window = window;
+ m_font = window->GetFont();
m_gc = (WXGC) 0;
m_gcBacking = (WXGC) 0;
m_backgroundPixel = -1;
m_currentPenWidth = 1;
m_currentPenJoin = -1;
m_currentPenDashCount = -1;
- m_currentPenDash = (char*) NULL;
+ m_currentPenDash = (wxMOTIFDash*) NULL;
m_currentStyle = -1;
m_currentFill = -1;
// m_currentBkMode = wxTRANSPARENT;
gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
gcvalues.background = WhitePixel (display, DefaultScreen (display));
gcvalues.graphics_exposures = False;
+ gcvalues.subwindow_mode = IncludeInferiors;
gcvalues.line_width = 1;
m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)),
- GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth,
+ GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
&gcvalues);
if (m_window->GetBackingPixmap())
{
m_gcBacking = (WXGC) XCreateGC (display, RootWindow (display,
DefaultScreen (display)),
- GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth,
+ GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
&gcvalues);
}
m_userRegion = (WXRegion) 0;
}
-void wxWindowDC::DoFloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
+void wxWindowDC::DoFloodFill( wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1),
const wxColour& WXUNUSED(col), int WXUNUSED(style) )
{
wxFAIL_MSG("not implemented");
}
-bool wxWindowDC::DoGetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
+bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
{
- wxFAIL_MSG("not implemented");
-
- return FALSE;
+ // Generic (and therefore rather inefficient) method.
+ // Could be improved.
+ wxMemoryDC memdc;
+ wxBitmap bitmap(1, 1);
+ memdc.SelectObject(bitmap);
+ memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
+ memdc.SelectObject(wxNullBitmap);
+ wxImage image(bitmap);
+ col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
+ return TRUE;
}
-void wxWindowDC::DoDrawLine( long x1, long y1, long x2, long y2 )
+void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
{
wxCHECK_RET( Ok(), "invalid dc" );
CalcBoundingBox(x2, y2);
}
-void wxWindowDC::DoCrossHair( long x, long y )
+void wxWindowDC::DoCrossHair( wxCoord x, wxCoord y )
{
wxCHECK_RET( Ok(), "invalid dc" );
}
}
-void wxWindowDC::DoDrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
+void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc )
{
wxCHECK_RET( Ok(), "invalid dc" );
int xxc_2 = XLOG2DEV_2 (xc);
int yyc_2 = YLOG2DEV_2 (yc);
- long dx = xx1 - xxc;
- long dy = yy1 - yyc;
- double radius = sqrt (dx * dx + dy * dy);
- long r = (long) radius;
+ wxCoord dx = xx1 - xxc;
+ wxCoord dy = yy1 - yyc;
+ double radius = sqrt ((double)(dx * dx + dy * dy));
+ wxCoord r = (wxCoord) radius;
double radius1, radius2;
CalcBoundingBox (x2, y2);
}
-void wxWindowDC::DoDrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
+void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double sa, double ea )
{
wxCHECK_RET( Ok(), "invalid dc" );
CalcBoundingBox (x + width, y + height);
}
-void wxWindowDC::DoDrawPoint( long x, long y )
+void wxWindowDC::DoDrawPoint( wxCoord x, wxCoord y )
{
wxCHECK_RET( Ok(), "invalid dc" );
CalcBoundingBox (x, y);
}
-void wxWindowDC::DoDrawLines( int n, wxPoint points[], long xoffset, long yoffset )
+void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset )
{
wxCHECK_RET( Ok(), "invalid dc" );
}
void wxWindowDC::DoDrawPolygon( int n, wxPoint points[],
- long xoffset, long yoffset, int fillStyle )
+ wxCoord xoffset, wxCoord yoffset, int fillStyle )
{
wxCHECK_RET( Ok(), "invalid dc" );
delete[]xpoints2;
}
-void wxWindowDC::DoDrawRectangle( long x, long y, long width, long height )
+void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
wxCHECK_RET( Ok(), "invalid dc" );
CalcBoundingBox (x + width, y + height);
}
-void wxWindowDC::DoDrawRoundedRectangle( long x, long y, long width, long height, double radius )
+void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
{
wxCHECK_RET( Ok(), "invalid dc" );
}
-void wxWindowDC::DoDrawEllipse( long x, long y, long width, long height )
+void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
wxCHECK_RET( Ok(), "invalid dc" );
}
#if 0
-void wxWindowDC::DoDrawIcon( const wxIcon &icon, long x, long y)
+void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
{
// FreeGetPixelCache();
#endif // 0
// TODO: use scaled Blit e.g. as per John Price's implementation in Contrib/Utilities
-bool wxWindowDC::DoBlit( long xdest, long ydest, long width, long height,
- wxDC *source, long xsrc, long ysrc, int rop, bool useMask )
+bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask )
{
wxCHECK_MSG( Ok(), FALSE, "invalid dc" );
return FALSE;
}
-void wxWindowDC::DoDrawText( const wxString &text, long x, long y )
+void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
{
wxCHECK_RET( Ok(), "invalid dc" );
XLOG2DEV_2 (x), YLOG2DEV_2 (y) + ascent, (char*) (const char*) text, slen);
}
+ wxCoord w, h;
+ GetTextExtent (text, &w, &h);
+ CalcBoundingBox (x + w, y + h);
+ CalcBoundingBox (x, y);
+}
+
+void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle )
+{
+ if (angle == 0.0)
+ {
+ DrawText(text, x, y);
+ return;
+ }
+
+ wxCHECK_RET( Ok(), "invalid dc" );
+
+ // Since X draws from the baseline of the text, must add the text height
+ int cx = 0;
+ int cy = 0;
+ int ascent = 0;
+ int slen;
+
+ slen = strlen(text);
+
+ if (m_font.Ok())
+ {
+ // Calculate text extent.
+ WXFontStructPtr pFontStruct = m_font.GetFontStruct(m_userScaleY*m_logicalScaleY, m_display);
+ int direction, descent;
+ XCharStruct overall_return;
+#if 0
+ if (use16)
+ (void)XTextExtents16((XFontStruct*) pFontStruct, (XChar2b *)(const char*) text, slen, &direction,
+ &ascent, &descent, &overall_return);
+ else
+#endif // 0
+ (void)XTextExtents((XFontStruct*) pFontStruct, (char*) (const char*) text, slen, &direction,
+ &ascent, &descent, &overall_return);
+
+ cx = overall_return.width;
+ cy = ascent + descent;
+ }
+
+ wxBitmap src(cx, cy);
+ wxMemoryDC dc;
+ dc.SelectObject(src);
+ dc.SetFont(GetFont());
+ dc.SetBackground(*wxWHITE_BRUSH);
+ dc.SetBrush(*wxBLACK_BRUSH);
+ dc.Clear();
+ dc.DrawText(text, 0, 0);
+ dc.SetFont(wxNullFont);
+
+ // Calculate the size of the rotated bounding box.
+ double dx = cos(angle / 180.0 * M_PI);
+ double dy = sin(angle / 180.0 * M_PI);
+ double x4 = -cy * dy;
+ double y4 = cy * dx;
+ double x3 = cx * dx;
+ double y3 = cx * dy;
+ double x2 = x3 + x4;
+ double y2 = y3 + y4;
+ double x1 = x;
+ double y1 = y;
+
+ // Create image from the source bitmap after writing the text into it.
+ wxImage image(src);
+
+ int minx = roundmin(0, roundmin(x4, roundmin(x2, x3)));
+ int miny = roundmin(0, roundmin(y4, roundmin(y2, y3)));
+ int maxx = roundmax(0, roundmax(x4, roundmax(x2, x3)));
+ int maxy = roundmax(0, roundmax(y4, roundmax(y2, y3)));
+
+ // This rotates counterclockwise around the top left corner.
+ for (int rx = minx; rx < maxx; rx++)
+ {
+ for (int ry = miny; ry < maxy; ry++)
+ {
+ // transform dest coords to source coords
+ int sx = (int) (rx * dx + ry * dy + 0.5);
+ int sy = (int) (ry * dx - rx * dy + 0.5);
+ if (sx >= 0 && sx < cx && sy >= 0 && sy < cy)
+ {
+ // draw black pixels, ignore white ones (i.e. transparent b/g)
+ if (image.GetRed(sx, sy) == 0)
+ {
+ DrawPoint((wxCoord) (x1 + maxx - rx), (wxCoord) (cy + y1 - ry));
+ }
+ else
+ {
+ // Background
+ //DrawPoint(x1 + maxx - rx, cy + y1 + maxy - ry);
+ }
+ }
+ }
+ }
+
+#if 0
+ // First draw a rectangle representing the text background, if a text
+ // background is specified
+ if (m_textBackgroundColour.Ok () && (m_backgroundMode != wxTRANSPARENT))
+ {
+ wxColour oldPenColour = m_currentColour;
+ m_currentColour = m_textBackgroundColour;
+ bool sameColour = (oldPenColour.Ok () && m_textBackgroundColour.Ok () &&
+ (oldPenColour.Red () == m_textBackgroundColour.Red ()) &&
+ (oldPenColour.Blue () == m_textBackgroundColour.Blue ()) &&
+ (oldPenColour.Green () == m_textBackgroundColour.Green ()));
+
+ // This separation of the big && test required for gcc2.7/HP UX 9.02
+ // or pixel value can be corrupted!
+ sameColour = (sameColour &&
+ (oldPenColour.GetPixel() == m_textBackgroundColour.GetPixel()));
+
+ if (!sameColour || !GetOptimization())
+ {
+ int pixel = m_textBackgroundColour.AllocColour(m_display);
+ m_currentColour = m_textBackgroundColour;
+
+ // Set the GC to the required colour
+ if (pixel > -1)
+ {
+ XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
+ if (m_window && m_window->GetBackingPixmap())
+ XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel);
+ }
+ }
+ else
+ m_textBackgroundColour = oldPenColour ;
+
+ XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y), cx, cy);
+ if (m_window && m_window->GetBackingPixmap())
+ XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
+ XLOG2DEV_2 (x), YLOG2DEV_2 (y), cx, cy);
+ }
+#endif
+
long w, h;
+ // XXX use pixmap size
GetTextExtent (text, &w, &h);
CalcBoundingBox (x + w, y + h);
CalcBoundingBox (x, y);
return TRUE;
}
-void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *height,
- long *descent, long *externalLeading,
+void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
+ wxCoord *descent, wxCoord *externalLeading,
wxFont *font ) const
{
wxCHECK_RET( Ok(), "invalid dc" );
// TODO: this should be an error log function
wxFAIL_MSG("set a valid font before calling GetTextExtent!");
- *width = -1;
- *height = -1;
+ if (width) *width = -1;
+ if (height) *height = -1;
return;
}
XTextExtents((XFontStruct*) pFontStruct, (char*) (const char*) string, slen, &direction,
&ascent, &descent2, &overall);
- *width = XDEV2LOGREL (overall.width);
- *height = YDEV2LOGREL (ascent + descent2);
+ if (width) *width = XDEV2LOGREL (overall.width);
+ if (height) *height = YDEV2LOGREL (ascent + descent2);
if (descent)
*descent = descent2;
if (externalLeading)
*externalLeading = 0;
}
-long wxWindowDC::GetCharWidth() const
+wxCoord wxWindowDC::GetCharWidth() const
{
wxCHECK_MSG( Ok(), 0, "invalid dc" );
wxCHECK_MSG( m_font.Ok(), 0, "invalid font" );
return XDEV2LOGREL(overall.width);
}
-long wxWindowDC::GetCharHeight() const
+wxCoord wxWindowDC::GetCharHeight() const
{
wxCHECK_MSG( Ok(), 0, "invalid dc" );
wxCHECK_MSG( m_font.Ok(), 0, "invalid font" );
if (!m_font.Ok())
{
- if ((m_oldFont != (WXFont) 0) && ((long) m_oldFont != -1))
+ if ((m_oldFont != (WXFont) 0) && ((wxCoord) m_oldFont != -1))
{
XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont);
int old_pen_join = m_currentPenJoin;
int old_pen_cap = m_currentPenCap;
int old_pen_nb_dash = m_currentPenDashCount;
- char *old_pen_dash = m_currentPenDash;
+ wxMOTIFDash *old_pen_dash = m_currentPenDash;
wxColour oldPenColour = m_currentColour;
m_currentColour = m_pen.GetColour ();
m_currentPenJoin = m_pen.GetJoin ();
m_currentPenCap = m_pen.GetCap ();
m_currentPenDashCount = m_pen.GetDashCount();
- m_currentPenDash = m_pen.GetDash();
+ m_currentPenDash = (wxMOTIFDash*)m_pen.GetDash();
if (m_currentStyle == wxSTIPPLE)
m_currentStipple = * m_pen.GetStipple ();
int style;
int join;
int cap;
- const static char dotted[] = {2, 5};
- const static char short_dashed[] = {4, 4};
- const static char long_dashed[] = {4, 8};
- const static char dotted_dashed[] = {6, 6, 2, 6};
+ static const wxMOTIFDash dotted[] = {2, 5};
+ static const wxMOTIFDash short_dashed[] = {4, 4};
+ static const wxMOTIFDash long_dashed[] = {4, 8};
+ static const wxMOTIFDash dotted_dashed[] = {6, 6, 2, 6};
// We express dash pattern in pen width unit, so we are
// independent of zoom factor and so on...
int req_nb_dash;
- const char *req_dash;
+ const wxMOTIFDash *req_dash;
switch (m_pen.GetStyle ())
{
case wxTRANSPARENT:
default:
style = LineSolid;
- req_dash = NULL;
+ req_dash = (wxMOTIFDash*)NULL;
req_nb_dash = 0;
}
if (req_dash && req_nb_dash)
{
- char *real_req_dash = new char[req_nb_dash];
+ wxMOTIFDash *real_req_dash = new wxMOTIFDash[req_nb_dash];
if (real_req_dash)
{
int factor = scaled_width == 0 ? 1 : scaled_width;
}
-void wxWindowDC::DoSetClippingRegion( long x, long y, long width, long height )
+void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
- wxDC::SetClippingRegion( x, y, width, height );
+ wxDC::DoSetClippingRegion( x, y, width, height );
if (m_userRegion)
XDestroyRegion ((Region) m_userRegion);
{
wxRect box = region.GetBox();
- wxDC::SetClippingRegion( box.x, box.y, box.width, box.height );
+ wxDC::DoSetClippingRegion( box.x, box.y, box.width, box.height );
if (m_userRegion)
XDestroyRegion ((Region) m_userRegion);
return 24;
}
-#if wxUSE_SPLINES
-// ----------------------------------- spline code ----------------------------------------
-
-void wx_quadratic_spline(double a1, double b1, double a2, double b2,
- double a3, double b3, double a4, double b4);
-void wx_clear_stack();
-int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, double *x3,
- double *y3, double *x4, double *y4);
-void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3,
- double x4, double y4);
-static bool wx_spline_add_point(double x, double y);
-static void wx_spline_draw_point_array(wxDC *dc);
-
-wxList wx_spline_point_list;
-
-#define half(z1, z2) ((z1+z2)/2.0)
-#define THRESHOLD 5
-
-/* iterative version */
-
-void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3, double b3, double a4,
- double b4)
-{
- register double xmid, ymid;
- double x1, y1, x2, y2, x3, y3, x4, y4;
-
- wx_clear_stack();
- wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4);
-
- while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) {
- xmid = (double)half(x2, x3);
- ymid = (double)half(y2, y3);
- if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD &&
- fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) {
- wx_spline_add_point( x1, y1 );
- wx_spline_add_point( xmid, ymid );
- } else {
- wx_spline_push(xmid, ymid, (double)half(xmid, x3), (double)half(ymid, y3),
- (double)half(x3, x4), (double)half(y3, y4), x4, y4);
- wx_spline_push(x1, y1, (double)half(x1, x2), (double)half(y1, y2),
- (double)half(x2, xmid), (double)half(y2, ymid), xmid, ymid);
- }
- }
-}
-
-/* utilities used by spline drawing routines */
-
-typedef struct wx_spline_stack_struct {
- double x1, y1, x2, y2, x3, y3, x4, y4;
-} Stack;
-
-#define SPLINE_STACK_DEPTH 20
-static Stack wx_spline_stack[SPLINE_STACK_DEPTH];
-static Stack *wx_stack_top;
-static int wx_stack_count;
-
-void wx_clear_stack()
-{
- wx_stack_top = wx_spline_stack;
- wx_stack_count = 0;
-}
-
-void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
-{
- wx_stack_top->x1 = x1;
- wx_stack_top->y1 = y1;
- wx_stack_top->x2 = x2;
- wx_stack_top->y2 = y2;
- wx_stack_top->x3 = x3;
- wx_stack_top->y3 = y3;
- wx_stack_top->x4 = x4;
- wx_stack_top->y4 = y4;
- wx_stack_top++;
- wx_stack_count++;
-}
-
-int wx_spline_pop(double *x1, double *y1, double *x2, double *y2,
- double *x3, double *y3, double *x4, double *y4)
-{
- if (wx_stack_count == 0)
- return (0);
- wx_stack_top--;
- wx_stack_count--;
- *x1 = wx_stack_top->x1;
- *y1 = wx_stack_top->y1;
- *x2 = wx_stack_top->x2;
- *y2 = wx_stack_top->y2;
- *x3 = wx_stack_top->x3;
- *y3 = wx_stack_top->y3;
- *x4 = wx_stack_top->x4;
- *y4 = wx_stack_top->y4;
- return (1);
-}
-
-static bool wx_spline_add_point(double x, double y)
-{
- wxPoint *point = new wxPoint ;
- point->x = (int) x;
- point->y = (int) y;
- wx_spline_point_list.Append((wxObject*)point);
- return TRUE;
-}
-
-static void wx_spline_draw_point_array(wxDC *dc)
-{
- dc->DrawLines(&wx_spline_point_list, 0, 0 );
- wxNode *node = wx_spline_point_list.First();
- while (node)
- {
- wxPoint *point = (wxPoint *)node->Data();
- delete point;
- delete node;
- node = wx_spline_point_list.First();
- }
-}
-
-void wxWindowDC::DoDrawSpline( wxList *points )
-{
- wxCHECK_RET( Ok(), _T("invalid window dc") );
-
- wxPoint *p;
- double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
- double x1, y1, x2, y2;
-
- wxNode *node = points->First();
- p = (wxPoint *)node->Data();
-
- x1 = p->x;
- y1 = p->y;
-
- node = node->Next();
- p = (wxPoint *)node->Data();
-
- x2 = p->x;
- y2 = p->y;
- cx1 = (double)((x1 + x2) / 2);
- cy1 = (double)((y1 + y2) / 2);
- cx2 = (double)((cx1 + x2) / 2);
- cy2 = (double)((cy1 + y2) / 2);
-
- wx_spline_add_point(x1, y1);
-
- while ((node = node->Next()) != NULL)
- {
- p = (wxPoint *)node->Data();
- x1 = x2;
- y1 = y2;
- x2 = p->x;
- y2 = p->y;
- cx4 = (double)(x1 + x2) / 2;
- cy4 = (double)(y1 + y2) / 2;
- cx3 = (double)(x1 + cx4) / 2;
- cy3 = (double)(y1 + cy4) / 2;
-
- wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4);
-
- cx1 = cx4;
- cy1 = cy4;
- cx2 = (double)(cx1 + x2) / 2;
- cy2 = (double)(cy1 + y2) / 2;
- }
-
- wx_spline_add_point( cx1, cy1 );
- wx_spline_add_point( x2, y2 );
-
- wx_spline_draw_point_array( this );
-}
-
-#endif // wxUSE_SPLINE
win->SetUpdateRegion(*region);
+ wxRegion& theRegion(win->GetUpdateRegion());
+ theRegion.SetRects(updateRects); // We also store in terms of rects, for iteration to work.
+
// Set the clipping region. Any user-defined region will be combined with this
// one in SetDCClipping.
XSetRegion ((Display*) m_display, (GC) m_gc, (Region) region->GetXRegion());