diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-05-05 13:36:30 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-05-05 13:42:22 (GMT) |
commit | fde7475bcf9c10522a8170e6eb8fb9a8fadc21cd (patch) | |
tree | 5fd8e43395c2a2394cdf562efe39490d32d9f235 /tests/arthur | |
parent | d89d1eb47e69c2c2dc1121ef92fd08ef983e3e63 (diff) | |
download | Qt-fde7475bcf9c10522a8170e6eb8fb9a8fadc21cd.zip Qt-fde7475bcf9c10522a8170e6eb8fb9a8fadc21cd.tar.gz Qt-fde7475bcf9c10522a8170e6eb8fb9a8fadc21cd.tar.bz2 |
Ensured correct rounding of scaled image drawing at non-integer coords.
Images coordinates should simply be rounded and are not to be subject
to the aliased coordinate delta. The patch also adds a tiny delta in
QSpanData::setupMatrix() to ensure coordinates for fetching from source
images are rounded the opposite direction of the target rectangle.
This removes a lot of artifacts when trying to do border-image based
drawing on non-integer coordinates. A new qps test for border-image
drawing is included.
Task-number: 251561
Reviewed-by: Trond
Diffstat (limited to 'tests/arthur')
-rw-r--r-- | tests/arthur/common/images.qrc | 1 | ||||
-rw-r--r-- | tests/arthur/common/images/borderimage.png | bin | 0 -> 826 bytes | |||
-rw-r--r-- | tests/arthur/data/qps/borderimage.qps | 129 | ||||
-rw-r--r-- | tests/arthur/data/qps/borderimage_qps.png | bin | 0 -> 88788 bytes |
4 files changed, 130 insertions, 0 deletions
diff --git a/tests/arthur/common/images.qrc b/tests/arthur/common/images.qrc index 8e94760..060b52c 100644 --- a/tests/arthur/common/images.qrc +++ b/tests/arthur/common/images.qrc @@ -3,6 +3,7 @@ <qresource> <file>images/alpha.png</file> <file>images/border.png</file> + <file>images/borderimage.png</file> <file>images/dome_argb32.png</file> <file>images/dome_indexed.png</file> <file>images/dome_mono_palette.png</file> diff --git a/tests/arthur/common/images/borderimage.png b/tests/arthur/common/images/borderimage.png Binary files differnew file mode 100644 index 0000000..f7f6b66 --- /dev/null +++ b/tests/arthur/common/images/borderimage.png diff --git a/tests/arthur/data/qps/borderimage.qps b/tests/arthur/data/qps/borderimage.qps new file mode 100644 index 0000000..747a74d --- /dev/null +++ b/tests/arthur/data/qps/borderimage.qps @@ -0,0 +1,129 @@ +image_load borderimage.png borderimage + +translate -128 -128 +begin_block draw_border + +# top +drawImage borderimage 0 0 16 16 0 0 16 16 +drawImage borderimage 16 0 36 16 16 0 32 16 +drawImage borderimage 52 0 16 16 48 0 16 16 + +# sides +drawImage borderimage 0 16 16 16 0 16 16 32 +drawImage borderimage 52 16 16 16 48 16 16 32 + +#bottom +drawImage borderimage 0 32 16 16 0 48 16 16 +drawImage borderimage 16 32 36 16 16 48 32 16 +drawImage borderimage 52 32 16 16 48 48 16 16 + +end_block draw_border + +resetMatrix + +begin_block draw_column + +translate 1 1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border +translate 0.1 64.1 +repeat_block draw_border + +end_block draw_column + +setRenderHint Antialiasing + +resetMatrix +translate 72 0 + +repeat_block draw_column + +resetMatrix +scale 1.25 1.25 +translate 144 0 + +repeat_block draw_border + +resetMatrix +scale 1.25 1.25 +translate 246 0 +rotate 30 + +repeat_block draw_border + +setRenderHint SmoothPixmapTransform + +resetMatrix +scale 1.25 1.25 +translate 144 120 + +repeat_block draw_border + +resetMatrix +scale 1.25 1.25 +translate 246 120 +rotate 30 + +repeat_block draw_border + +resetMatrix +translate 215 260 +scale 3.55 3.55 +rotate 30 + +repeat_block draw_border + +resetMatrix +setRenderHint SmoothPixmapTransform off +setRenderHint Antialiasing off + +translate 480 627 +rotate 180 +repeat_block draw_column + +resetMatrix +setRenderHint Antialiasing + +translate 552 627 +rotate 180 +repeat_block draw_column + +resetMatrix +setRenderHint Antialiasing off + +setPen red + +drawRect 0 0 70 680 +drawText 10 670 "aa off" + +drawRect 72 0 70 680 +drawText 80 670 "aa on" + +drawRect 409 0 70 680 +drawText 419 650 "rot 180" +drawText 419 670 "aa off" + +drawRect 481 0 70 680 +drawText 491 650 "rot 180" +drawText 491 670 "aa on" + +drawRect 164 0 224 124 +drawText 174 114 "smoothpixmaptransform off" + +drawRect 164 128 224 134 +drawText 174 252 "smoothpixmaptransform on" diff --git a/tests/arthur/data/qps/borderimage_qps.png b/tests/arthur/data/qps/borderimage_qps.png Binary files differnew file mode 100644 index 0000000..89a8eba --- /dev/null +++ b/tests/arthur/data/qps/borderimage_qps.png |