Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 385965 Details for
Bug 557317
Frames appear around scaled images in cairo. Intel/Nouveau
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
standalone demo
grayborder.c (text/plain), 3.06 KB, created by
Caolan McNamara
on 2010-01-21 17:04:39 UTC
(
hide
)
Description:
standalone demo
Filename:
MIME Type:
Creator:
Caolan McNamara
Created:
2010-01-21 17:04:39 UTC
Size:
3.06 KB
patch
obsolete
>/*gcc grayborder.c `pkg-config --cflags --libs cairo-xlib`*/ > >#define WIDTH 250 >#define HEIGHT 40 > >#include <stdio.h> >#include <stdlib.h> >#include <string.h> >#include <math.h> > >#include <cairo.h> >#include <cairo-xlib.h> >#include <cairo-xlib-xrender.h> > >typedef struct win { > Display *dpy; > int scr; > > Window win; > GC gc; > > int width, height; > KeyCode quit_code; >} win_t; > >static void win_init(win_t *win); >static void win_deinit(win_t *win); >static void win_draw(win_t *win); >static void win_handle_events(win_t *win); > >int >main(int argc, char *argv[]) >{ > win_t win; > > win.dpy = XOpenDisplay(0); > > if (win.dpy == NULL) { > fprintf(stderr, "Failed to open display\n"); > return 1; > } > > win_init(&win); > > win_draw(&win); > > win_handle_events(&win); > > win_deinit(&win); > > XCloseDisplay(win.dpy); > > return 0; >} > >static void >win_draw(win_t *win) >{ > cairo_surface_t *surface; > cairo_surface_t* source; > cairo_t *cr; > unsigned char *data; > int nWidth = WIDTH, nHeight = HEIGHT; > cairo_matrix_t matx; > Visual *visual = DefaultVisual(win->dpy, DefaultScreen (win->dpy)); > > data = (unsigned char*) malloc( nWidth*nHeight*4 ); > memset(data, 0xFF, nWidth*nHeight*4); > source = cairo_image_surface_create_for_data( > data, > CAIRO_FORMAT_RGB24, > nWidth, nHeight, nWidth*4 ); > > XClearWindow(win->dpy, win->win); > > surface = cairo_xlib_surface_create(win->dpy, > win->win, visual, > 500, 300); > > cr = cairo_create(surface); > > //Scale by 1.5 x 1.5 > cairo_matrix_init (&matx, > 1.5, 0.0, 0.0, 1.5, 50.0, 50.0); > cairo_set_matrix( cr, &matx); > > cairo_set_source_surface( cr, source, 0, 0 ); > cairo_rectangle( cr, 0, 0, nWidth, nHeight ); > cairo_clip( cr ); > cairo_paint( cr ); > > cairo_destroy(cr); > cairo_surface_destroy (surface); > cairo_surface_destroy (source); > > free (data); >} > >static void >win_init(win_t *win) >{ > Window root; > > win->width = 500; > win->height = 300; > > root = DefaultRootWindow(win->dpy); > win->scr = DefaultScreen(win->dpy); > > win->win = XCreateSimpleWindow(win->dpy, root, 0, 0, > win->width, win->height, 0, > BlackPixel(win->dpy, win->scr), WhitePixel(win->dpy, win->scr)); > > win->quit_code = XKeysymToKeycode(win->dpy, XStringToKeysym("Q")); > > XSelectInput(win->dpy, win->win, > KeyPressMask > |StructureNotifyMask > |ExposureMask); > > XMapWindow(win->dpy, win->win); >} > >static void >win_deinit(win_t *win) >{ > XDestroyWindow(win->dpy, win->win); >} > >static void >win_handle_events(win_t *win) >{ > XEvent xev; > > while (1) { > XNextEvent(win->dpy, &xev); > switch(xev.type) { > case KeyPress: > { > XKeyEvent *kev = &xev.xkey; > > if (kev->keycode == win->quit_code) { > return; > } > } > break; > case ConfigureNotify: > { > XConfigureEvent *cev = &xev.xconfigure; > > win->width = cev->width; > win->height = cev->height; > } > break; > case Expose: > { > XExposeEvent *eev = &xev.xexpose; > > if (eev->count == 0) > win_draw(win); > } > break; > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 557317
:
385820
|
385821
|
385822
| 385965 |
398009
|
398012
|
398013
|
398014
|
398016
|
398017
|
438547