Zhiyi Zhang : gdi32: Partially implement HALFTONE stretch mode.

Alexandre Julliard julliard at winehq.org
Tue Jun 15 16:19:27 CDT 2021


Module: wine
Branch: master
Commit: 04b4d0f380943bed5328c2957b50d975ecb55635
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=04b4d0f380943bed5328c2957b50d975ecb55635

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue Jun 15 11:40:42 2021 +0800

gdi32: Partially implement HALFTONE stretch mode.

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 at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/dibdrv/bitblt.c     |   7 +
 dlls/gdi32/dibdrv/dibdrv.h     |   2 +
 dlls/gdi32/dibdrv/primitives.c | 629 ++++++++++++++++++++++++++++++++++++++++-
 dlls/user32/tests/cursoricon.c |  18 +-
 4 files changed, 640 insertions(+), 16 deletions(-)

Diff:   https://source.winehq.org/git/wine.git/?a=commitdiff;h=04b4d0f380943bed5328c2957b50d975ecb55635



More information about the wine-cvs mailing list