From e66e9ac12e3e11af76f14e8de3cfee72d4299864 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Tue, 2 Apr 2013 00:32:56 +0200 Subject: win32: fix corrupted drawing Fix src bitmap coordinates, which origin is bottom-left. This is apparently a bug in StretchDIBits(), according to some comments on MSDN API documentation. The backend used to have this coordinate change in the past: if (!StretchDIBits (dst->dc, /* dst x,y,w,h */ dst_r.x, dst_r.y + dst_r.height - 1, dst_r.width, - (int) dst_r.height, /* src x,y,w,h */ src_r.x, src_extents.height - src_r.y + 1, src_r.width, - (int) src_r.height, src_image->data, &bi, DIB_RGB_COLORS, SRCCOPY)) https://bugs.freedesktop.org/show_bug.cgi?id=61876 --- src/win32/cairo-win32-gdi-compositor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/win32/cairo-win32-gdi-compositor.c b/src/win32/cairo-win32-gdi-compositor.c index c70b0f90..073e889a 100644 --- a/src/win32/cairo-win32-gdi-compositor.c +++ b/src/win32/cairo-win32-gdi-compositor.c @@ -151,10 +151,11 @@ static cairo_bool_t upload_box (cairo_box_t *box, void *closure) int y = _cairo_fixed_integer_part (box->p1.y); int width = _cairo_fixed_integer_part (box->p2.x - box->p1.x); int height = _cairo_fixed_integer_part (box->p2.y - box->p1.y); + int src_height = -cb->bi.bmiHeader.biHeight; TRACE ((stderr, "%s\n", __FUNCTION__)); return StretchDIBits (cb->dst, x, y + height - 1, width, -height, - x + cb->tx, height - (y + cb->ty - 1), + x + cb->tx, src_height - (y + cb->ty - 1), width, -height, cb->data, &cb->bi, DIB_RGB_COLORS, SRCCOPY); -- cgit v1.2.3