[cairo-commit] src/cairo-xlib-surface.c
Chris Wilson
ickle at kemper.freedesktop.org
Wed Apr 25 12:54:41 PDT 2012
src/cairo-xlib-surface.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit 9e81c5b737cda9dc539b2cf497c20ac48ddb91ac
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Apr 25 20:41:16 2012 +0100
xlib: Allow applications to create 0x0 surfaces
Although 0x0 is not a legimate surface size, we do allow applications
the flexibility to reset the size before drawing. As we previously never
checked the size against minimum legal constraints, applications expect
to be able to create seemingly illegal surfaces, and so we must continue
to provide backwards compatibility.
Many thanks to Pauli Nieminen for trawling through the protocol traces,
diving into the depths of libreoffice and identifying the regression.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=49118 (presentation
mode in loimpress is blank).
Reported-by: Eric Valette <eric.valette at free.fr>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 0645da6..95fadac 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1613,7 +1613,14 @@ _cairo_xlib_screen_from_visual (Display *dpy, Visual *visual)
static cairo_bool_t valid_size (int width, int height)
{
- return width > 0 && width <= XLIB_COORD_MAX && height > 0 && height <= XLIB_COORD_MAX;
+ /* Note: the minimum surface size allowed in the X protocol is 1x1.
+ * However, as we historically did not check the minimum size we
+ * allowed applications to lie and set the correct size later (one hopes).
+ * To preserve compatability we must allow applications to use
+ * 0x0 surfaces.
+ */
+ return (width >= 0 && width <= XLIB_COORD_MAX &&
+ height >= 0 && height <= XLIB_COORD_MAX);
}
/**
More information about the cairo-commit
mailing list