/[gzz]/gzz/gfx/libimagecache/ImageCache.hxx
ViewVC logotype

Diff of /gzz/gfx/libimagecache/ImageCache.hxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by deetsay, Wed Sep 11 11:16:26 2002 UTC revision 1.2 by deetsay, Fri Sep 13 14:35:37 2002 UTC
# Line 6  Line 6 
6    
7  #include <string>  #include <string>
8  #include <map>  #include <map>
9    #include <list>
10    
11  #include <gtk/gtk.h>  #include <gtk/gtk.h>
12  #include <gdk-pixbuf/gdk-pixbuf.h>  #include <gdk-pixbuf/gdk-pixbuf.h>
# Line 15  namespace ImageCache { Line 16  namespace ImageCache {
16    
17  using std::string;  using std::string;
18  using std::map;  using std::map;
19    using std::list;
20    
21      class CachedLOD;      class CachedImage {
22      class ImageCache;      private:
   
     class CachedURX {  
23          GdkPixbufLoader *loader;          GdkPixbufLoader *loader;
24          map<int,CachedLOD *> cachedLODs;          int requestedLOD;
25            GdkPixbuf *pixbuf;
26            int pixbufLOD;
27            int lastSize;
28            int currentSize;
29      public:      public:
30          CachedURX();          CachedImage();
31          ~CachedURX();          ~CachedImage();
32    
33          CachedLOD *getCachedLOD(int lod);          GdkPixbuf *getPixbuf(int lod);
34          GdkPixbuf *getLoaderPixbuf();          int write(char *data, int len);
35          void setCachedLOD(int lod, CachedLOD *cl);          void dropLOD();
36          void write(char *data, int len, ImageCache *imageCache);          void loaderPrepared();
37            void loaderDone();
38          void closeLoader();          void closeLoader();
39      };          int getSizeChange();
40            int getCurrentSize();
     class CachedLOD {  
     private:  
         CachedLOD *prev;  
         CachedLOD *next;  
         GdkPixbuf *pixbuf;  
         CachedURX *cachedURX;  
         int lod;  
         int size;  
         gboolean fullyLoaded;  
   
         void createScaled(GdkPixbuf *from, double scale);  
     public:  
         CachedLOD(int newLOD, CachedURX *cu, gboolean final);  
         CachedLOD(int newLOD, CachedLOD *cl);  
         ~CachedLOD();  
   
         CachedLOD *getNext();  
         CachedLOD *getPrev();  
         void setNext(CachedLOD *cl);  
         void setPrev(CachedLOD *cl);  
   
         GdkPixbuf *getPixbuf();  
         int getSize();  
         CachedURX *getCachedURX();  
         int getLOD();  
         gboolean isFullyLoaded();  
         void update(GdkPixbuf *from, gboolean final);  
41      };      };
42    
43      class ImageCache {      class ImageCache {
44      private:      private:
45          GdkPixbuf *loaderPixbuf;          GdkPixbuf *loading;
46          map<string,CachedURX *> cachedURXs;          map<string,CachedImage *> imageByUrx;
47          CachedLOD *recentlyUsedLODs;          map<CachedImage *,string> urxByImage;
48            list<CachedImage *> recentlyUsedImages;
49          int size;          int size;
         int maxSize;  
   
         CachedLOD *createCachedLOD(int lod, CachedURX *cu, gboolean final);  
         CachedLOD *createCachedLOD(int lod, CachedLOD *oldcl);  
         void useCachedLOD(CachedLOD *cl);  
50      public:      public:
51          ImageCache();          ImageCache();
52          ~ImageCache();          ~ImageCache();
53    
54          GdkPixbuf *getPixbuf(string urx, int lod);          GdkPixbuf *getPixbuf(string urx, int lod);
         int getWidth(string urx, int lod);  
         int getHeight(string urx, int lod);  
         int *getPixels(string urx, int lod);  
55    
56          void write(string urx, char *data, int n);          int write(string urx, char *data, int n);
57    
58          void loaderImageDone(CachedURX *cu);          int cropToSize(int maxSize);
59      };      };
   
60  }  }
61    
62  #endif  #endif

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26