Bugzilla – Attachment 80327 Details for
Bug 152730
Massive XRender corruption ...
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
simple test program trying to mimic what OOo does
my-test.c (text/x-csrc), 2.33 KB, created by
Radek Doulik
on 2006-04-26 16:13:40 UTC
(
hide
)
Description:
simple test program trying to mimic what OOo does
Filename:
MIME Type:
Creator:
Radek Doulik
Created:
2006-04-26 16:13:40 UTC
Size:
2.33 KB
patch
obsolete
>#include <stdio.h> >#include <X11/Xlib.h> > >#include <cairo/cairo.h> >#include <cairo/cairo-xlib.h> > >cairo_pattern_t * >cairo_test_create_pattern_from_png (const char *filename) >{ > cairo_surface_t *image; > cairo_pattern_t *pattern; > > image = cairo_image_surface_create_from_png (filename); > > pattern = cairo_pattern_create_for_surface (image); > > cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); > > cairo_surface_destroy (image); > > return pattern; >} > >static void >do_test (cairo_surface_t *surface, cairo_surface_t *image) >{ > cairo_t *cr, *cr_img; > cairo_pattern_t* pattern; > cairo_surface_t* surface_img; > > cr = cairo_create (surface); > pattern = cairo_pattern_create_for_surface (image); > cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); > > cairo_set_source_rgba (cr, 1.0, 1.0, 0.0, 0.5); > cairo_rectangle (cr, 50, 50, 300, 300); > cairo_fill (cr); > > surface_img = cairo_surface_create_similar (surface, CAIRO_CONTENT_COLOR_ALPHA, 200, 200); > cr_img = cairo_create (surface_img); > > cairo_rectangle (cr_img, 0, 0, 200, 200); > cairo_scale (cr_img, .5, .5); > cairo_set_source (cr_img, pattern); > cairo_fill (cr_img); > > cairo_set_source_surface (cr, surface_img, 100, 100); > cairo_paint_with_alpha (cr, 0.5); >} > >int >main() >{ > Display *dpy; > Drawable drawable; > int screen; > cairo_surface_t *surface, *surface_bs; > cairo_t* cr; > int width = 600; > int height = 450; > XSetWindowAttributes xwa; > cairo_surface_t* image; > > dpy = XOpenDisplay (NULL); > screen = DefaultScreen (dpy); > if (!dpy) > return 1; > > image = cairo_image_surface_create_from_png ("water.png"); > > xwa.override_redirect = True; > drawable = XCreateWindow (dpy, DefaultRootWindow (dpy), > 0, 0, width, height, 0, > DefaultDepth (dpy, screen), InputOutput, > DefaultVisual (dpy, screen), > CWOverrideRedirect, &xwa); > XMapWindow (dpy, drawable); > > surface = cairo_xlib_surface_create (dpy, > drawable, > DefaultVisual (dpy, screen), > width, height); > > surface_bs = cairo_surface_create_similar (surface, CAIRO_CONTENT_COLOR, width, height); > do_test (surface_bs, image); > > cr = cairo_create (surface); > cairo_set_source_surface (cr, surface_bs, 0, 0); > cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); > cairo_paint (cr); > > XFlush (dpy); > XSync (dpy, 0); > getchar (); > > XCloseDisplay (dpy); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 152730
:
69731
|
69732
|
69734
|
69735
|
69742
|
70149
|
75710
|
75712
|
79183
|
79184
| 80327 |
80328
|
80454
|
80492
|
80595
|
81265
|
81340
|
82989