[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 25e32bd 1/5: Use color cache for creating bitmap
From: |
Ken Raeburn |
Subject: |
[Emacs-diffs] master 25e32bd 1/5: Use color cache for creating bitmap |
Date: |
Thu, 12 Nov 2015 09:03:51 +0000 |
branch: master
commit 25e32bd861cdf405e74f8025116625b2f6d6607b
Author: Ken Raeburn <address@hidden>
Commit: Ken Raeburn <address@hidden>
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.
---
src/image.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/image.c b/src/image.c
index 41687eb..544435e 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)
attrs.valuemask |= XpmVisual;
attrs.valuemask |= XpmColormap;
+#ifdef ALLOC_XPM_COLORS
+ attrs.color_closure = f;
+ attrs.alloc_color = xpm_alloc_color;
+ attrs.free_colors = xpm_free_colors;
+ attrs.valuemask |= XpmAllocColor | XpmFreeColors | XpmColorClosure;
+ xpm_init_color_cache (f, &attrs);
+#endif
+
rc = XpmCreatePixmapFromData (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
(char **) bits, &bitmap, &mask, &attrs);
if (rc != XpmSuccess)
@@ -3526,6 +3534,9 @@ x_create_bitmap_from_xpm_data (struct frame *f, const
char **bits)
dpyinfo->bitmaps[id - 1].depth = attrs.depth;
dpyinfo->bitmaps[id - 1].refcount = 1;
+#ifdef ALLOC_XPM_COLORS
+ xpm_free_color_cache ();
+#endif
XpmFreeAttributes (&attrs);
return id;
}