From 1a25383307510161b8a80ab2d3032708adb7789b Mon Sep 17 00:00:00 2001 From: Vitaliy Slobodin Date: Sun, 23 Jun 2013 13:17:12 +0400 Subject: [PATCH] Use Qt::transparent to resolve graphical artifacts with images with transparent background. We need to use QImage::Format_ARGB32_Premultiplied on Windows to preserve a text hinting and antialiasing. Using the function `qRgba()` leads to wrong pixel values on a target image. Since, `QImage::fill(uint pixel)` doesn't handle the QImage::Format_ARGB32_Premultiplied format, so we need to use the another overload `QImage::fill(const QColor &color)` Issues: https://github.com/ariya/phantomjs/issues/11276 https://github.com/ariya/phantomjs/issues/11007 https://github.com/ariya/phantomjs/issues/11366 --- src/webpage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webpage.cpp b/src/webpage.cpp index c76a4b8a..89a34da3 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -990,7 +990,7 @@ QImage WebPage::renderImage() #endif QImage buffer(frameRect.size(), format); - buffer.fill(qRgba(255, 255, 255, 0)); + buffer.fill(Qt::transparent); QPainter painter; @@ -1004,7 +1004,7 @@ QImage WebPage::renderImage() for (int y = 0; y < vtiles; ++y) { QImage tileBuffer(tileSize, tileSize, format); - tileBuffer.fill(qRgba(255, 255, 255, 0)); + tileBuffer.fill(Qt::transparent); // Render the web page onto the small tile first painter.begin(&tileBuffer);