Implement high-dpi "@2x" image handling.
authorMorten Johan Sørvig <morten.sorvig@digia.com>
Mon, 19 Aug 2013 11:29:43 +0000 (13:29 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 20 Mar 2014 21:12:24 +0000 (22:12 +0100)
commit63fb30eb29c26cd7ba0d9133610acb85cad83775
treefb0d4870c3f2c22d14a90ad26956b8b6f45d3886
parent5277a60f56c83376c1f2e9d9d502f1793d8c4857
Implement high-dpi "@2x" image handling.

Make QQuickBaseImage::load() load "@2x" image files
on high-dpi displays. Reload images on screen change
in order to load the correct version depending on
screen dpi. Modify QQuickImageBase::updatePaintNode()
to work with @2x images.

QQuickBaseImage::load() now looks at the target
window's devicePixelRatio and checks for the presence
of a "@2x" file on disk. If found the @2x version
will be used.

Unlike QPixmap, QQuickPixmap has no special knowledge
of "@2x" files. They pixmap system will be asked to
load "@2x" files and will cache them and report the
(device) pixel size, like any other pixmap.

Add auto-test and manual test.

Task-number: QTBUG-32862, QTBUG-33069
Change-Id: I1f57a10075e499f6eee61df5421e1986521c6ab0
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
16 files changed:
src/quick/items/qquickimage.cpp
src/quick/items/qquickimagebase.cpp
src/quick/items/qquickimagebase_p.h
src/quick/items/qquickimagebase_p_p.h
tests/auto/quick/qquickimage/data/heart-highdpi@2x.png [new file with mode: 0644]
tests/auto/quick/qquickimage/tst_qquickimage.cpp
tests/manual/highdpi/fillmodes.qml [new file with mode: 0644]
tests/manual/highdpi/heart-highdpi@2x.png [new file with mode: 0644]
tests/manual/highdpi/heart-lowdpi.png [new file with mode: 0644]
tests/manual/highdpi/heart.png [new file with mode: 0644]
tests/manual/highdpi/heart@2x.png [new file with mode: 0644]
tests/manual/highdpi/image.qml [new file with mode: 0644]
tests/manual/highdpi/image2.qml [new file with mode: 0644]
tests/manual/highdpi/imagesize.qml [new file with mode: 0644]
tests/manual/highdpi/mirror.qml [new file with mode: 0644]
tests/manual/highdpi/sourcesize.qml [new file with mode: 0644]