[PATCH] gl: Keep window size the same as surface's size.

Chuanbo Weng <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
When we pass non-integer width and height to
_cairo_boilerplate_gl_create_window(), it will create a window and
a gl-surface with different size. This will result in some problems.
For example, if we create a window and a gl-surface by invoking
_cairo_boilerplate_gl_create_window(, , 39.5, 39.5, ...), and do a
simple fill operation:
    cairo_set_source_rgb (cr, 1, 0, 0);
    cairo_rectangle (cr, 0, 0, 10, 1);
    cairo_fill(cr);
There will be no red rectangle in output, which is not correct.
This patch fixes 5 cases in cairo-test-suite, for example,
group-unaligned.
---
 boilerplate/cairo-boilerplate-glx.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/boilerplate/cairo-boilerplate-glx.c b/boilerplate/cairo-boilerplate-glx.c
index 35e8192..d597c81 100644
--- a/boilerplate/cairo-boilerplate-glx.c
+++ b/boilerplate/cairo-boilerplate-glx.c
@@ -200,7 +200,7 @@ _cairo_boilerplate_gl_create_window (const char 	       *name,
     attr.border_pixel = 0;
     attr.override_redirect = True;
     gltc->drawable = XCreateWindow (dpy, DefaultRootWindow (dpy), 0, 0,
-				    width, height, 0, vi->depth,
+				    ceil (width), ceil (height), 0, vi->depth,
 				    InputOutput, vi->visual,
 				    CWOverrideRedirect | CWBorderPixel | CWColormap,
 				    &attr);
@@ -281,7 +281,7 @@ _cairo_boilerplate_gl_create_window_db (const char		  *name,
     attr.border_pixel = 0;
     attr.override_redirect = True;
     gltc->drawable = XCreateWindow (dpy, DefaultRootWindow (dpy), 0, 0,
-				    width, height, 0, vi->depth,
+				    ceil (width), ceil (height), 0, vi->depth,
 				    InputOutput, vi->visual,
 				    CWOverrideRedirect | CWBorderPixel | CWColormap,
 				    &attr);
-- 
1.7.5.4

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.