Zhiyi Zhang zzhang@codeweavers.com writes:
COLORONCOLOR(STRETCH_DELETESCANS) was used in place of HALFTONE. COLORONCOLOR mode may delete rows of pixels without trying to preserve information so it will cause Wine to render poorly when the destination rectangle is small.
According to tests, HALFTONE mode uses box filter when doing integer downscaling and nearest neighbor interpolation when doing upscaling in both horizontally and vertically. In other cases, HALFTONE mode uses a lanczos3 like algorithm to interpolate pixels. There are also other heuristics involved. For example, shrinking a 2x2 image to 1x1 may not use box filter depending on image data. Since this algorithm is undocumented, it's difficult to reverse engineer the original algorithm and produce identical results. Instead, this patch uses a naive implementation of bilinear interpolation to implement HALFTONE mode and it produces good quality images.
For 8-bit and lower color depth images, nulldrv_StretchBlt should resize the images first and then converts color depth.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46375 Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
dlls/gdi32/dibdrv/bitblt.c | 7 + dlls/gdi32/dibdrv/dibdrv.h | 2 + dlls/gdi32/dibdrv/primitives.c | 629 ++++++++++++++++++++++++++++++++- 3 files changed, 629 insertions(+), 9 deletions(-)
This is breaking some tests:
tools/runtest -q -P wine -T . -M user32.dll -p dlls/user32/tests/user32_test.exe cursoricon && touch dlls/user32/tests/cursoricon.ok cursoricon.c:3061: Test failed: Colors do not match, got 0xffff00, expected 0x00ff00, test_index 0, row 0, column 1. cursoricon.c:3061: Test failed: Colors do not match, got 0xffff00, expected 0x00ff00, test_index 0, row 1, column 0. cursoricon.c:3071: Test failed: Colors do not match, got 0xffff00, expected 0x00ff00, test_index 0, row 0, column 1. cursoricon.c:3071: Test failed: Colors do not match, got 0xffff00, expected 0x00ff00, test_index 0, row 1, column 0. cursoricon.c:3061: Test failed: Colors do not match, got 0x000000, expected 0xffffff, test_index 2, row 0, column 0. cursoricon.c:3061: Test failed: Colors do not match, got 0x000000, expected 0xffffff, test_index 2, row 0, column 1. cursoricon.c:3061: Test failed: Colors do not match, got 0x000000, expected 0x555555, test_index 2, row 1, column 0. cursoricon.c:3071: Test failed: Colors do not match, got 0x000000, expected 0xffffff, test_index 2, row 0, column 0. cursoricon.c:3071: Test failed: Colors do not match, got 0x000000, expected 0xffffff, test_index 2, row 0, column 1. cursoricon.c:3071: Test failed: Colors do not match, got 0x000000, expected 0x555555, test_index 2, row 1, column 0. cursoricon.c:3061: Test failed: Colors do not match, got 0x006000, expected 0x004000, test_index 3, row 0, column 0. cursoricon.c:3061: Test failed: Colors do not match, got 0x0060f8, expected 0x002000, test_index 3, row 0, column 1. cursoricon.c:3061: Test failed: Colors do not match, got 0x0080f8, expected 0x004000, test_index 3, row 1, column 0. cursoricon.c:3061: Test failed: Colors do not match, got 0x008000, expected 0x002000, test_index 3, row 1, column 1. cursoricon.c:3071: Test failed: Colors do not match, got 0x006000, expected 0x004000, test_index 3, row 0, column 0. cursoricon.c:3071: Test failed: Colors do not match, got 0x0060f8, expected 0x002000, test_index 3, row 0, column 1. cursoricon.c:3071: Test failed: Colors do not match, got 0x0080f8, expected 0x004000, test_index 3, row 1, column 0. cursoricon.c:3071: Test failed: Colors do not match, got 0x008000, expected 0x002000, test_index 3, row 1, column 1. make: *** [Makefile:125296: dlls/user32/tests/cursoricon.ok] Error 18