Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 308222 Details for
Bug 446957
[nv] Fonts are blurred and unreadable, "monochrome" setting
[?]
New
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.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
simple standalone test-case
apple.c (text/plain), 5.89 KB, created by
Caolan McNamara
on 2008-06-03 12:37:35 UTC
(
hide
)
Description:
simple standalone test-case
Filename:
MIME Type:
Creator:
Caolan McNamara
Created:
2008-06-03 12:37:35 UTC
Size:
5.89 KB
patch
obsolete
>/*gcc apple.c `pkg-config --cflags --libs cairo-xlib`*/ > >#include <stdio.h> >#include <stdlib.h> >#include <math.h> > >#include <cairo.h> >#include <cairo-xlib.h> > >#define PI 3.1415926535 > >typedef struct win { > Display *dpy; > int scr; > > Window win; > GC gc; > > int width, height; > KeyCode quit_code; >} win_t; > >static void triangle(cairo_t *cr); >static void square(cairo_t *cr); >static void bowtie(cairo_t *cr); >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; >} > >#define SIZE 20 >static void >triangle(cairo_t *cr) >{ > cairo_move_to(cr, SIZE, 0); > cairo_rel_line_to(cr, SIZE, 2*SIZE); > cairo_rel_line_to(cr, -2*SIZE, 0); > cairo_close_path(cr); >} > >static void >square(cairo_t *cr) >{ > cairo_move_to(cr, 0, 0); > cairo_rel_line_to(cr, 2*SIZE, 0); > cairo_rel_line_to(cr, 0, 2*SIZE); > cairo_rel_line_to(cr, -2*SIZE, 0); > cairo_close_path(cr); >} > >static void >bowtie(cairo_t *cr) >{ > cairo_move_to(cr, 0, 0); > cairo_rel_line_to(cr, 2*SIZE, 2*SIZE); > cairo_rel_line_to(cr, -2*SIZE, 0); > cairo_rel_line_to(cr, 2*SIZE, -2*SIZE); > cairo_close_path(cr); >} > >static void >inf(cairo_t *cr) >{ > cairo_move_to(cr, 0, SIZE); > cairo_rel_curve_to(cr, > 0, SIZE, > SIZE, SIZE, > 2*SIZE, 0); > cairo_rel_curve_to(cr, > SIZE, -SIZE, > 2*SIZE, -SIZE, > 2*SIZE, 0); > cairo_rel_curve_to(cr, > 0, SIZE, > -SIZE, SIZE, > -2*SIZE, 0); > cairo_rel_curve_to(cr, > -SIZE, -SIZE, > -2*SIZE, -SIZE, > -2*SIZE, 0); > cairo_close_path(cr); >} > >static void >draw_shapes(cairo_t *cr, int x, int y, int fill) >{ > cairo_save(cr); > > cairo_new_path(cr); > cairo_translate(cr, x+SIZE, y+SIZE); > bowtie(cr); > if (fill) > cairo_fill(cr); > else > cairo_stroke(cr); > > cairo_new_path(cr); > cairo_translate(cr, 4*SIZE, 0); > square(cr); > if (fill) > cairo_fill(cr); > else > cairo_stroke(cr); > > cairo_new_path(cr); > cairo_translate(cr, 4*SIZE, 0); > triangle(cr); > if (fill) > cairo_fill(cr); > else > cairo_stroke(cr); > > cairo_new_path(cr); > cairo_translate(cr, 4*SIZE, 0); > inf(cr); > if (fill) > cairo_fill(cr); > else > cairo_stroke(cr); > > cairo_restore(cr); >} > >static void >fill_shapes(cairo_t *cr, int x, int y) >{ > draw_shapes(cr, x, y, 1); >} > >static void >stroke_shapes(cairo_t *cr, int x, int y) >{ > draw_shapes(cr, x, y, 0); >} > >/* >static void >draw_broken_shapes(cairo_t *cr) >{ > cairo_save(cr); > > cairo_set_line_width(cr, 1); > cairo_set_line_join(cr, CAIRO_LINE_JOIN_BEVEL); > cairo_set_source_rgb(cr, 1, 1, 1); > > cairo_move_to(cr, 19.153717041015625, 144.93951416015625); > cairo_line_to(cr, 412.987396240234375, 99.407318115234375); > cairo_line_to(cr, 412.99383544921875, 99.4071807861328125); > cairo_line_to(cr, 413.15008544921875, 99.5634307861328125); > cairo_line_to(cr, 413.082489013671875, 99.6920928955078125); > cairo_line_to(cr, 413.000274658203125, 99.71954345703125); > cairo_line_to(cr, 273.852630615234375, 138.1925201416015625); > cairo_line_to(cr, 273.934844970703125, 138.165069580078125); > cairo_line_to(cr, 16.463653564453125, 274.753662109375); > cairo_line_to(cr, 16.286346435546875, 274.496337890625); > cairo_line_to(cr, 273.757537841796875, 137.907745361328125); > cairo_line_to(cr, 273.839752197265625, 137.8802947998046875); > cairo_line_to(cr, 412.987396240234375, 99.407318115234375); > cairo_line_to(cr, 412.99383544921875, 99.4071807861328125); > cairo_line_to(cr, 413.15008544921875, 99.5634307861328125); > cairo_line_to(cr, 413.082489013671875, 99.6920928955078125); > cairo_line_to(cr, 413.000274658203125, 99.71954345703125); > cairo_line_to(cr, 19.166595458984375, 145.251739501953125); > > cairo_fill(cr); > > cairo_restore(cr); >} >*/ > >static void >win_draw(win_t *win) >{ >#define NUM_DASH 2 > static double dash[NUM_DASH] = {SIZE/4.0, SIZE/4.0}; > cairo_surface_t *surface; > cairo_t *cr; > Visual *visual = DefaultVisual(win->dpy, DefaultScreen (win->dpy)); > > XClearWindow(win->dpy, win->win); > > surface = cairo_xlib_surface_create(win->dpy, > win->win, visual, > 200, 200); > > cr = cairo_create(surface); > > cairo_set_source_rgb(cr, 0, 0, 0); > > cairo_set_font_size (cr, 20); > cairo_move_to (cr, 10, 20); > cairo_show_text (cr, "Hello"); > > if (cairo_status (cr)) { > printf("Cairo is unhappy: %s\n", > cairo_status_to_string (cairo_status (cr))); > exit(0); > } > > cairo_destroy(cr); > cairo_surface_destroy (surface); >} > >static void >win_init(win_t *win) >{ > Window root; > > win->width = 200; > win->height = 200; > > 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 446957
:
305725
| 308222 |
308223