ScummVM API documentation
cache.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef SCI_GRAPHICS_CACHE_H
23 #define SCI_GRAPHICS_CACHE_H
24 
25 #include "common/hashmap.h"
26 
27 namespace Sci {
28 
29 class GfxFont;
30 class GfxView;
31 
32 typedef Common::HashMap<int, GfxFont *> FontCache;
33 typedef Common::HashMap<int, GfxView *> ViewCache;
34 
38 class GfxCache {
39 public:
40  GfxCache(ResourceManager *resMan, GfxScreen *screen, GfxPalette *palette);
41  ~GfxCache();
42 
43  GfxFont *getFont(GuiResourceId fontId);
44  GfxView *getView(GuiResourceId viewId);
45 
46  int16 kernelViewGetCelWidth(GuiResourceId viewId, int16 loopNo, int16 celNo);
47  int16 kernelViewGetCelHeight(GuiResourceId viewId, int16 loopNo, int16 celNo);
48  int16 kernelViewGetLoopCount(GuiResourceId viewId);
49  int16 kernelViewGetCelCount(GuiResourceId viewId, int16 loopNo);
50 
51 private:
52  void purgeFontCache();
53  void purgeViewCache();
54 
55  ResourceManager *_resMan;
56  GfxScreen *_screen;
57  GfxPalette *_palette;
58 
59  FontCache _cachedFonts;
60  ViewCache _cachedViews;
61 };
62 
63 } // End of namespace Sci
64 
65 #endif // SCI_GRAPHICS_CACHE_H
Definition: resource.h:327
Definition: palette.h:41
Definition: scifont.h:37
Definition: cache.h:38
Definition: console.h:28
Definition: screen.h:68
Definition: view.h:59