diff --git a/src/document.h b/src/document.h index 47c01e5a..8205e26d 100644 --- a/src/document.h +++ b/src/document.h @@ -610,20 +610,9 @@ struct Document { curdrawroot->ColWidth(), 0); } - void Draw( - #ifdef __WXMSW__ - wxBufferedPaintDC - #else - wxPaintDC - #endif - &pdc) { - wxGraphicsContext *context = wxGraphicsContext::Create(pdc); - context->SetAntialiasMode(wxANTIALIAS_DEFAULT); + void Draw(wxDC &dc) { redrawpending = false; - pdc.SetBackground(wxBrush(wxColor(Background()))); - pdc.SetGraphicsContext(context); - wxDC &dc = static_cast(pdc); - sw->DoPrepareDC(dc); + dc.SetBackground(wxBrush(wxColor(Background()))); dc.Clear(); if (!rootgrid) return; sw->GetClientSize(&maxx, &maxy); @@ -661,6 +650,7 @@ struct Document { centery = sys->centered && !originy && maxy > layoutys ? (maxy - layoutys) / 2 * currentviewscale : 0; + sw->DoPrepareDC(dc); ShiftToCenter(dc); Render(dc); DrawSelect(dc, selected); @@ -720,8 +710,8 @@ struct Document { hover.g = nullptr; redrawpending = true; sys->UpdateStatus(selected); - #ifndef __WXMSW__ - // wxWidgets on wxMAC and wxGTK does not always automatically update the scrollbar + #ifdef __WXGTK__ + // wxWidgets (wxGTK) does not always automatically update the scrollbar // to new canvas size and current position within after zoom so force it manually int curx, cury; sw->GetViewStart(&curx, &cury); diff --git a/src/mycanvas.h b/src/mycanvas.h index 4536245a..93bdc99d 100644 --- a/src/mycanvas.h +++ b/src/mycanvas.h @@ -23,13 +23,13 @@ struct TSCanvas : public wxScrolledCanvas { } void OnPaint(wxPaintEvent &event) { - #ifdef __WXMSW__ + #if defined(__WXMAC__) || defined(__WXGTK__) + wxPaintDC dc(this); + #else auto sz = GetClientSize(); if (sz.GetX() <= 0 || sz.GetY() <= 0) return; wxBitmap buffer(sz.GetX(), sz.GetY(), 24); wxBufferedPaintDC dc(this, buffer); - #else - wxPaintDC dc(this); #endif // DoPrepareDC(dc); doc->Draw(dc); diff --git a/src/stdafx.h b/src/stdafx.h index 341f325e..0903feff 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include