diff options
| author | Ken Raeburn | 2015-11-07 03:06:32 -0500 |
|---|---|---|
| committer | Ken Raeburn | 2015-11-12 03:58:08 -0500 |
| commit | 25e32bd861cdf405e74f8025116625b2f6d6607b (patch) | |
| tree | 041abafc76108241f7fecc60517421f3cfdd399d /src | |
| parent | 851be0f60718795c985f504db4823344508b107d (diff) | |
| download | emacs-25e32bd861cdf405e74f8025116625b2f6d6607b.tar.gz emacs-25e32bd861cdf405e74f8025116625b2f6d6607b.zip | |
Use color cache for creating bitmap
* src/image.c (x_create_bitmap_from_xpm_data) [ALLOC_XPM_COLORS]: Set
attributes to use the caching color allocator. Initialize and free
the cache.
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/image.c b/src/image.c index 41687eb885c..544435eac0b 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -3508,6 +3508,14 @@ x_create_bitmap_from_xpm_data (struct frame *f, const char **bits) | |||
| 3508 | attrs.valuemask |= XpmVisual; | 3508 | attrs.valuemask |= XpmVisual; |
| 3509 | attrs.valuemask |= XpmColormap; | 3509 | attrs.valuemask |= XpmColormap; |
| 3510 | 3510 | ||
| 3511 | #ifdef ALLOC_XPM_COLORS | ||
| 3512 | attrs.color_closure = f; | ||
| 3513 | attrs.alloc_color = xpm_alloc_color; | ||
| 3514 | attrs.free_colors = xpm_free_colors; | ||
| 3515 | attrs.valuemask |= XpmAllocColor | XpmFreeColors | XpmColorClosure; | ||
| 3516 | xpm_init_color_cache (f, &attrs); | ||
| 3517 | #endif | ||
| 3518 | |||
| 3511 | rc = XpmCreatePixmapFromData (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 3519 | rc = XpmCreatePixmapFromData (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
| 3512 | (char **) bits, &bitmap, &mask, &attrs); | 3520 | (char **) bits, &bitmap, &mask, &attrs); |
| 3513 | if (rc != XpmSuccess) | 3521 | if (rc != XpmSuccess) |
| @@ -3526,6 +3534,9 @@ x_create_bitmap_from_xpm_data (struct frame *f, const char **bits) | |||
| 3526 | dpyinfo->bitmaps[id - 1].depth = attrs.depth; | 3534 | dpyinfo->bitmaps[id - 1].depth = attrs.depth; |
| 3527 | dpyinfo->bitmaps[id - 1].refcount = 1; | 3535 | dpyinfo->bitmaps[id - 1].refcount = 1; |
| 3528 | 3536 | ||
| 3537 | #ifdef ALLOC_XPM_COLORS | ||
| 3538 | xpm_free_color_cache (); | ||
| 3539 | #endif | ||
| 3529 | XpmFreeAttributes (&attrs); | 3540 | XpmFreeAttributes (&attrs); |
| 3530 | return id; | 3541 | return id; |
| 3531 | } | 3542 | } |