diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-04-02 00:32:56 +0200 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-04-02 08:39:05 +0100 |
commit | e66e9ac12e3e11af76f14e8de3cfee72d4299864 (patch) | |
tree | f890ebf2642c6e9995251783186b4c3838e1de25 | |
parent | 0446fae26d35dc4e31aadc498f0f9b48b21d2c45 (diff) |
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
-rw-r--r-- | src/win32/cairo-win32-gdi-compositor.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); |