If images are scaled down more than 2x the scaled result becomes increasingly worse. This is probably caused by QPainter using bilinear sampling, see https://bugreports.qt-project.org/browse/QTBUG-30682 . To avoid the issue we can prescale the image before sending it to QPainter.
Created attachment 207823 [details] Patch
Attachment 207823 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/platform/graphics/qt/ImageQt.cpp']" exit_code: 1 Source/WebCore/platform/graphics/qt/ImageQt.cpp:273: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WebCore/platform/graphics/qt/ImageQt.cpp:274: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WebCore/platform/graphics/qt/ImageQt.cpp:275: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WebCore/platform/graphics/qt/ImageQt.cpp:276: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Total errors found: 4 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 207823 [details] Patch Attachment 207823 [details] did not pass qt-ews (qt): Output: http://webkit-queues.appspot.com/results/1292609
Comment on attachment 207823 [details] Patch Attachment 207823 [details] did not pass qt-wk2-ews (qt-wk2): Output: http://webkit-queues.appspot.com/results/1293620
Created attachment 207824 [details] Patch
Attachment 207824 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/platform/graphics/qt/ImageQt.cpp']" exit_code: 1 Source/WebCore/platform/graphics/qt/ImageQt.cpp:273: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WebCore/platform/graphics/qt/ImageQt.cpp:274: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WebCore/platform/graphics/qt/ImageQt.cpp:275: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WebCore/platform/graphics/qt/ImageQt.cpp:276: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Total errors found: 4 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 207824 [details] Patch Attachment 207824 [details] did not pass qt-ews (qt): Output: http://webkit-queues.appspot.com/results/1289715
Comment on attachment 207824 [details] Patch Attachment 207824 [details] did not pass qt-wk2-ews (qt-wk2): Output: http://webkit-queues.appspot.com/results/1275021
(In reply to comment #8) > (From update of attachment 207824 [details]) > Attachment 207824 [details] did not pass qt-wk2-ews (qt-wk2): > Output: http://webkit-queues.appspot.com/results/1275021 Seems the EWS bot is building with Qt 5.0.
Created attachment 207828 [details] Patch Fix build with Qt 5.0
Comment on attachment 207828 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=207828&action=review > Source/WebCore/ChangeLog:8 > + Prescale images before painting and cache the result in the pixmap cache. Please add a note here or in the code explaining the difference of behavior between QPixmap and QPainter when down-scaling. > Source/WebCore/platform/graphics/qt/ImageQt.cpp:272 > + && (normalizedDst.width() * 1.5 * pixelRatio < normalizedSrc.width() > + || normalizedDst.height() * 1.5 * pixelRatio < normalizedSrc.height())) { 1.0 / 0.5 == 2.0, I'm not following why you're using 1.5 here.
(In reply to comment #11) > (From update of attachment 207828 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=207828&action=review > > > Source/WebCore/ChangeLog:8 > > + Prescale images before painting and cache the result in the pixmap cache. > > Please add a note here or in the code explaining the difference of behavior between QPixmap and QPainter when down-scaling. > I will update the comments and ChangeLog. > > Source/WebCore/platform/graphics/qt/ImageQt.cpp:272 > > + && (normalizedDst.width() * 1.5 * pixelRatio < normalizedSrc.width() > > + || normalizedDst.height() * 1.5 * pixelRatio < normalizedSrc.height())) { > > 1.0 / 0.5 == 2.0, I'm not following why you're using 1.5 here. It is mentioned in the comment above. // We prescale before hitting 0.5x because prescaling quality is already better at 0.5x, and with caching often // faster than transforms in the raster paint engine.
Created attachment 207848 [details] Patch Improve ChangeLog, and restrict prescaling to 0.5x and below. Quality can be better before, but the pixelation issues only trigger after.
Committed r153522: <http://trac.webkit.org/changeset/153522>