summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-surface.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-04-25 20:41:16 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-04-25 20:51:20 +0100
commit9e81c5b737cda9dc539b2cf497c20ac48ddb91ac (patch)
treeaf5765630d68e7b1131f015b506f215815260faf /src/cairo-xlib-surface.c
parentf736cd144305f7c9147912f6ec081962b3191e3d (diff)
downloadcairo-9e81c5b737cda9dc539b2cf497c20ac48ddb91ac.tar.gz
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@free.fr> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-xlib-surface.c')
-rw-r--r--src/cairo-xlib-surface.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 0645da684..95fadaca6 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);
}
/**