Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 190286 Details for
Bug 268563
Over-aggressive caching of tile pixmaps by x11-drivers/nvidia-drivers-180.51
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Samle code demonstrating the bug
Fillrect.c (text/plain), 5.76 KB, created by
Evgeny Stambulchik
on 2009-05-04 08:33:41 UTC
(
hide
)
Description:
Samle code demonstrating the bug
Filename:
MIME Type:
Creator:
Evgeny Stambulchik
Created:
2009-05-04 08:33:41 UTC
Size:
5.76 KB
patch
obsolete
>/* > > Fillrect.c > ======== > > Based on "Hello, World!" for X Window System style by: > (c) Copyright Paul Griffiths 1999 > Email: paulgriffiths@cwcom.net > > > Compile as > > gcc -o Fillrect -ansi -pedantic -Wall -lX11 Fillrect.c > >*/ > > >#include <X11/Xlib.h> >#include <X11/Xutil.h> >#include <X11/Xos.h> >#include <X11/Xatom.h> > >#include <stdlib.h> >#include <string.h> >#include <stdio.h> > > >/* Global variables */ > >Display * display; >int screen_num; >static char * appname; > >static unsigned char pat1_bits[] = { > 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, > 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, > 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00}; > >static unsigned char pat2_bits[] = { > 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, > 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, > 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33}; >/* main() function */ > >int main( int argc, char * argv[] ) { > > /* Window variables */ > > Window win; > int x, y; > unsigned int width, height; > char * window_name = "Patterned fill"; > char * icon_name = "Patterned fill"; > > > /* Display variables */ > > char * display_name = NULL; > > > /* Miscellaneous X variables */ > > XSizeHints * size_hints; > XWMHints * wm_hints; > XClassHint * class_hints; > XTextProperty windowName, iconName; > XEvent report; > XGCValues values; > GC gc; > > XColor xc1, xc2; > Colormap cmap; > Pixmap curtile, ptmp; > > appname = argv[0]; > > > /* Allocate memory for our structures */ > > if ( !( size_hints = XAllocSizeHints() ) || > !( wm_hints = XAllocWMHints() ) || > !( class_hints = XAllocClassHint() ) ) { > fprintf(stderr, "%s: couldn't allocate memory.\n", appname); > exit(EXIT_FAILURE); > } > > > /* Connect to X server */ > > if ( (display = XOpenDisplay(display_name)) == NULL ) { > fprintf(stderr, "%s: couldn't connect to X server %s\n", > appname, display_name); > exit(EXIT_FAILURE); > } > > > /* Get screen size from display structure macro */ > > screen_num = DefaultScreen(display); > > > /* Set initial window size and position, and create it */ > > x = y = 0; > width = 400; > height = 400; > > win = XCreateSimpleWindow(display, RootWindow(display, screen_num), > x, y, width, height, 0, > BlackPixel(display, screen_num), > WhitePixel(display, screen_num)); > > > /* Set hints for window manager before mapping window */ > > if ( XStringListToTextProperty(&window_name, 1, &windowName) == 0 ) { > fprintf(stderr, "%s: structure allocation for windowName failed.\n", > appname); > exit(EXIT_FAILURE); > } > > if ( XStringListToTextProperty(&icon_name, 1, &iconName) == 0 ) { > fprintf(stderr, "%s: structure allocation for iconName failed.\n", > appname); > exit(EXIT_FAILURE); > } > > size_hints->flags = PPosition | PSize | PMinSize; > size_hints->min_width = 200; > size_hints->min_height = 100; > > wm_hints->flags = StateHint | InputHint; > wm_hints->initial_state = NormalState; > wm_hints->input = True; > > class_hints->res_name = appname; > class_hints->res_class = "hellox"; > > XSetWMProperties(display, win, &windowName, &iconName, argv, argc, > size_hints, wm_hints, class_hints); > > > /* Choose which events we want to handle */ > > XSelectInput(display, win, ExposureMask | KeyPressMask | > ButtonPressMask | StructureNotifyMask); > > /* Create graphics context */ > > gc = XCreateGC(display, win, 0, &values); > XSetBackground(display, gc, WhitePixel(display, screen_num)); > > curtile = XCreatePixmap(display, win, > 16, 16, DisplayPlanes(display, screen_num)); > XSetTile(display, gc, curtile); > > cmap = DefaultColormap(display, screen_num); > > xc1.red = 0xffff; > xc1.green = 0x0; > xc1.blue = 0x0; > XAllocColor(display, cmap, &xc1); > > xc2.red = 0x0; > xc2.green = 0x0; > xc2.blue = 0xffff; > XAllocColor(display, cmap, &xc2); > > /* Display Window */ > > XMapWindow(display, win); > > > /* Enter event loop */ > > while ( 1 ) { > int rect_width = 3*width/4; > int rect_height = height/4; > > XNextEvent(display, &report); > > switch ( report.type ) { > > case Expose: > > if ( report.xexpose.count != 0 ) > break; > > /* Erase everything */ > XSetForeground(display, gc, WhitePixel(display, screen_num)); > XSetFillStyle(display, gc, FillSolid); > XFillRectangle(display, win, gc, 0, 0, width, height); > > XSetFillStyle(display, gc, FillTiled); > > ptmp = XCreateBitmapFromData(display, win, > (char *) pat1_bits, 16, 16); > XSetForeground(display, gc, xc1.pixel); > XCopyPlane(display, ptmp, curtile, gc, 0, 0, 16, 16, 0, 0, 1); > XFreePixmap(display, ptmp); > > XFillRectangle(display, win, gc, width/8, height/8, > rect_width, rect_height); > > ptmp = XCreateBitmapFromData(display, win, > (char *) pat2_bits, 16, 16); > XSetForeground(display, gc, xc2.pixel); > XCopyPlane(display, ptmp, curtile, gc, 0, 0, 16, 16, 0, 0, 1); > XFreePixmap(display, ptmp); > > XFillRectangle(display, win, gc, width/8, 5*height/8, > rect_width, rect_height); > > break; > > > case ConfigureNotify: > > /* Store new window width & height */ > > width = report.xconfigure.width; > height = report.xconfigure.height; > > break; > > > case ButtonPress: /* Fall through */ > case KeyPress: > > /* Clean up and exit */ > > XFreeGC(display, gc); > XCloseDisplay(display); > exit(EXIT_SUCCESS); > > } > } > > return EXIT_SUCCESS; /* We shouldn't get here */ >}
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 268563
: 190286 |
190288
|
190289