plugins/qpa: initialize buffer in backingstore
BUG: 437062
This commit is contained in:
parent
79fd2a4937
commit
f3e4495e44
2 changed files with 14 additions and 0 deletions
|
@ -47,6 +47,18 @@ void BackingStore::resize(const QSize &size, const QRegion &staticContents)
|
|||
m_frontBuffer.setDevicePixelRatio(devicePixelRatio);
|
||||
}
|
||||
|
||||
void BackingStore::beginPaint(const QRegion ®ion)
|
||||
{
|
||||
if (m_backBuffer.hasAlphaChannel()) {
|
||||
QPainter p(paintDevice());
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
const QColor blank = Qt::transparent;
|
||||
for (const QRect &rect : region) {
|
||||
p.fillRect(rect, blank);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static QRect scaledRect(const QRect &rect, qreal devicePixelRatio)
|
||||
{
|
||||
return QRect(rect.topLeft() * devicePixelRatio, rect.size() * devicePixelRatio);
|
||||
|
@ -55,6 +67,7 @@ static QRect scaledRect(const QRect &rect, qreal devicePixelRatio)
|
|||
static void blitImage(const QImage &source, QImage &target, const QRegion ®ion)
|
||||
{
|
||||
QPainter painter(&target);
|
||||
painter.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
for (const QRect &rect : region) {
|
||||
painter.drawImage(rect, source, scaledRect(rect, source.devicePixelRatio()));
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
QPaintDevice *paintDevice() override;
|
||||
void flush(QWindow *window, const QRegion ®ion, const QPoint &offset) override;
|
||||
void resize(const QSize &size, const QRegion &staticContents) override;
|
||||
void beginPaint(const QRegion ®ion) override;
|
||||
|
||||
private:
|
||||
QImage m_backBuffer;
|
||||
|
|
Loading…
Reference in a new issue