]> icculus.org git repositories - dana/openbox.git/blob - obrender/imagecache.h
Use the BSEARCH() macro in overlap placement
[dana/openbox.git] / obrender / imagecache.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    imagecache.h for the Openbox window manager
4    Copyright (c) 2008        Dana Jansens
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #ifndef __imagecache_h
20 #define __imagecache_h
21
22 #include <glib.h>
23
24 struct _RrImagePic;
25
26 guint RrImagePicHash(const struct _RrImagePic *p);
27
28 /*! Create a new image cache.  An image cache is basically a hash table to look
29   up RrImages.  Each RrImage in the cache may contain one or more Pictures,
30   that is one or more actual copies of image data at various sizes.  For eg,
31   for a window, all of its various icons are loaded into the same RrImage.
32   When an RrImage is drawn and a picture inside it needs to be resized, that
33   is also saved within the RrImage.
34
35   For each picture that an RrImage has, the picture is hashed and that is used
36   as a key to find the RrImage.  So, given any picture in any RrImage in the
37   cache, if you hash it, you will find the RrImage.
38 */
39 struct _RrImageCache {
40     gint ref;
41     /*! When an original picture is resized for an RrImage, the resized picture
42       is saved in the RrImage.  This specifies how many pictures should be
43       saved at a time.  When this is exceeded, the least recently used
44       "resized" picture is deleted.
45     */
46     gint max_resized_saved;
47
48     /*! A hash table of image sets in the cache that don't have a file name
49       attached to them, with their key being a hash of the contents of the
50       image. */
51     GHashTable *pic_table;
52
53     /*! Used to find out if an image file has already been loaded into an
54       image set. Provides a quick file_name -> RrImageSet lookup. */
55     GHashTable *name_table;
56 };
57
58 #endif