GrayPixmap.c File Reference

#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/Xmu/Drawing.h>

Include dependency graph for GrayPixmap.c:

Go to the source code of this file.

Data Structures

struct  _PixmapCache

Defines

#define pixmap_width   2
#define pixmap_height   2

Typedefs

typedef _PixmapCache CacheEntry

Functions

Pixmap XmuCreateStippledPixmap (Screen *screen, Pixel fore, Pixel back, unsigned int depth)
void XmuReleaseStippledPixmap (Screen *screen, Pixmap pixmap)

Variables

static CacheEntrypixmapCache = NULL


Define Documentation

#define pixmap_height   2

Referenced by XmuCreateStippledPixmap().

#define pixmap_width   2

Referenced by XmuCreateStippledPixmap().


Typedef Documentation

typedef struct _PixmapCache CacheEntry


Function Documentation

Pixmap XmuCreateStippledPixmap ( Screen *  screen,
Pixel  fore,
Pixel  back,
unsigned int  depth 
)

Definition at line 72 of file GrayPixmap.c.

References _PixmapCache::background, _PixmapCache::depth, display, _PixmapCache::foreground, _PixmapCache::next, _PixmapCache::pixmap, pixmap_height, pixmap_width, pixmapCache, _PixmapCache::ref_count, and _PixmapCache::screen.

Referenced by ChangeSensitive(), CreateGC(), CreateGCs(), GetGCs(), GetgrayGC(), Realize(), and reset_shadow_gc().

00078 {
00079     register Display *display = DisplayOfScreen(screen);
00080     CacheEntry *cachePtr;
00081     Pixmap stippled_pixmap;
00082     static unsigned char pixmap_bits[] = {
00083         0x02, 0x01,
00084     };
00085 
00086 /*
00087  *      Creates a stippled pixmap of depth DefaultDepth(screen)
00088  *      caches these so that multiple requests share the pixmap
00089  */
00090 
00091 #define pixmap_width 2
00092 #define pixmap_height 2
00093 
00094     /* see if we already have a pixmap suitable for this screen */
00095     for (cachePtr = pixmapCache; cachePtr; cachePtr = cachePtr->next) {
00096         if (cachePtr->screen == screen && cachePtr->foreground == fore &&
00097             cachePtr->background == back && cachePtr->depth == depth)
00098             return( cachePtr->ref_count++, cachePtr->pixmap );
00099     }
00100 
00101     stippled_pixmap = XCreatePixmapFromBitmapData (display,
00102                         RootWindowOfScreen(screen), (char *)pixmap_bits, 
00103                         pixmap_width, pixmap_height, fore, back, depth);
00104 
00105     /* and insert it at the head of the cache */
00106     cachePtr = XtNew(CacheEntry);
00107     cachePtr->screen = screen;
00108     cachePtr->foreground = fore;
00109     cachePtr->background = back;
00110     cachePtr->depth = depth;
00111     cachePtr->pixmap = stippled_pixmap;
00112     cachePtr->ref_count = 1;
00113     cachePtr->next = pixmapCache;
00114     pixmapCache = cachePtr;
00115 
00116     return( stippled_pixmap );
00117 }

Here is the caller graph for this function:

void XmuReleaseStippledPixmap ( Screen *  screen,
Pixmap  pixmap 
)

Definition at line 120 of file GrayPixmap.c.

References display, _PixmapCache::next, _PixmapCache::pixmap, pixmapCache, _PixmapCache::ref_count, and _PixmapCache::screen.

Referenced by Destroy(), and SetValues().

00121 {
00122     register Display *display = DisplayOfScreen(screen);
00123     CacheEntry *cachePtr, **prevP;
00124     for (prevP = &pixmapCache, cachePtr = pixmapCache; cachePtr;) {
00125         if (cachePtr->screen == screen && cachePtr->pixmap == pixmap) {
00126             if (--cachePtr->ref_count == 0) {
00127                 XFreePixmap( display, pixmap );
00128                 *prevP = cachePtr->next;
00129                 XtFree( (char*)cachePtr );
00130                 break;
00131             }
00132         }
00133         prevP = &cachePtr->next;
00134         cachePtr = *prevP;
00135     }
00136 }

Here is the caller graph for this function:


Variable Documentation

CacheEntry* pixmapCache = NULL [static]

Definition at line 67 of file GrayPixmap.c.

Referenced by XmuCreateStippledPixmap(), and XmuReleaseStippledPixmap().


Generated on Sun Mar 4 16:04:09 2007 for Scilab [trunk] by  doxygen 1.5.1