Paste P107

(An Untitled Masterwork)
ActivePublic

Authored by alvinhochun on Sep 29 2017, 9:04 AM.
commit 2c1562e273f16be51fbb1d13e53d908705753d26
Author: Alvin Wong <alvinhochun@gmail.com>
Date: Fri Sep 29 03:31:02 2017 +0800
Remove manual double buffering in QPainter canvas
Qt already does double buffering so it is not needed.
diff --git a/libs/ui/canvas/kis_qpainter_canvas.cpp b/libs/ui/canvas/kis_qpainter_canvas.cpp
index 8a539aea44..05b7d4fe63 100644
--- a/libs/ui/canvas/kis_qpainter_canvas.cpp
+++ b/libs/ui/canvas/kis_qpainter_canvas.cpp
@@ -66,7 +66,6 @@ class KisQPainterCanvas::Private
public:
KisPrescaledProjectionSP prescaledProjection;
QBrush checkBrush;
- QImage buffer;
bool scrollCheckers;
};
@@ -107,15 +106,7 @@ void KisQPainterCanvas::paintEvent(QPaintEvent * ev)
setAutoFillBackground(false);
- if (m_d->buffer.size() != size()) {
- m_d->buffer = QImage(size(), QImage::Format_ARGB32_Premultiplied);
- }
-
- QPainter gc(&m_d->buffer);
-
- // we double buffer, so we paint on an image first, then from the image onto the canvas,
- // so copy the clip region since otherwise we're filling the whole buffer every time with
- // the background color _and_ the transparent squares.
+ QPainter gc(this);
gc.setClipRegion(ev->region());
KisCoordinatesConverter *converter = coordinatesConverter();
@@ -146,10 +137,6 @@ void KisQPainterCanvas::paintEvent(QPaintEvent * ev)
#endif
drawDecorations(gc, ev->rect());
- gc.end();
-
- QPainter painter(this);
- painter.drawImage(ev->rect(), m_d->buffer, ev->rect());
}
void KisQPainterCanvas::drawImage(QPainter & gc, const QRect &updateWidgetRect) const