diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.h | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.h')
-rw-r--r-- | libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.h | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.h b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.h new file mode 100644 index 0000000..6fb4c18 --- /dev/null +++ b/libraries/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.h | |||
@@ -0,0 +1,108 @@ | |||
1 | #ifndef __EVAS_DIRECT3D_IMAGE_CACHE_H__ | ||
2 | #define __EVAS_DIRECT3D_IMAGE_CACHE_H__ | ||
3 | |||
4 | #include "evas_engine.h" | ||
5 | |||
6 | #include "ref.h" | ||
7 | #include "array.h" | ||
8 | |||
9 | class D3DDevice; | ||
10 | |||
11 | class D3DImageCache : virtual public Referenc | ||
12 | { | ||
13 | public: | ||
14 | struct CacheEntryInfo | ||
15 | { | ||
16 | int id; | ||
17 | int width, height; | ||
18 | FLOAT u, v; | ||
19 | FLOAT du, dv; | ||
20 | }; | ||
21 | |||
22 | public: | ||
23 | ~D3DImageCache(); | ||
24 | |||
25 | static D3DImageCache *Current(); | ||
26 | static void SetCurrent(D3DImageCache *obj); | ||
27 | |||
28 | inline void SetMaxSize(int w, int h); | ||
29 | inline void SetMargin(int margin); | ||
30 | |||
31 | bool InsertImage(D3DDevice *d3d, DWORD *data, int w, int h, CacheEntryInfo &info); | ||
32 | bool InsertImage(D3DDevice *d3d, int id, DWORD *data, int w, int h, CacheEntryInfo &info); | ||
33 | bool CreateImage(D3DDevice *d3d, int w, int h, bool locked, CacheEntryInfo &info); | ||
34 | bool ResizeImage(D3DDevice *d3d, int nw, int nh, int id); | ||
35 | bool SelectImageToDevice(D3DDevice *d3d, int id); | ||
36 | void RemoveImageUser(int id); | ||
37 | void AddImageUser(int id); | ||
38 | bool UpdateImageData(CacheEntryInfo &info, DWORD *data); | ||
39 | bool UpdateImageDataWithDirtyInfo(CacheEntryInfo &info, DWORD *data, POINT *dirty); | ||
40 | bool UpdateImageDataDiscard(CacheEntryInfo &info, DWORD *data); | ||
41 | bool GetImageData(CacheEntryInfo &info, TArray<DWORD> &data); | ||
42 | void Uninitialize(); | ||
43 | |||
44 | inline int GetImageWidth(int image_id); | ||
45 | inline int GetImageHeight(int image_id); | ||
46 | |||
47 | inline void SetImageStage(int image_id, int stage); | ||
48 | |||
49 | private: | ||
50 | struct CacheEntry | ||
51 | { | ||
52 | LPDIRECT3DTEXTURE9 texture; | ||
53 | int width; | ||
54 | int height; | ||
55 | int cur_x; | ||
56 | int cur_y; | ||
57 | int cur_h; | ||
58 | int users; | ||
59 | bool locked; | ||
60 | int stage; | ||
61 | }; | ||
62 | |||
63 | private: | ||
64 | D3DImageCache(); | ||
65 | |||
66 | bool RequestInsert(CacheEntry &entry, int w, int h); | ||
67 | bool CreateEntry(D3DDevice *d3d, CacheEntry &entry, int w, int h, bool exact_size = false); | ||
68 | bool InsertData(CacheEntry &entry, DWORD *data, int w, int h); | ||
69 | bool RetrieveData(CacheEntry &entry, DWORD *data, int w, int h); | ||
70 | void UpdateInsert(CacheEntry &entry, int w, int h); | ||
71 | |||
72 | private: | ||
73 | TArray<CacheEntry> _cache; | ||
74 | int _max_width; | ||
75 | int _max_height; | ||
76 | |||
77 | int _margin; | ||
78 | |||
79 | static Ref<D3DImageCache> _this; | ||
80 | }; | ||
81 | |||
82 | void D3DImageCache::SetMaxSize(int w, int h) | ||
83 | { | ||
84 | _max_width = w; | ||
85 | _max_height = h; | ||
86 | } | ||
87 | |||
88 | void D3DImageCache::SetMargin(int margin) | ||
89 | { | ||
90 | _margin = margin; | ||
91 | } | ||
92 | |||
93 | int D3DImageCache::GetImageWidth(int image_id) | ||
94 | { | ||
95 | return _cache[image_id].width; | ||
96 | } | ||
97 | |||
98 | int D3DImageCache::GetImageHeight(int image_id) | ||
99 | { | ||
100 | return _cache[image_id].height; | ||
101 | } | ||
102 | |||
103 | void D3DImageCache::SetImageStage(int image_id, int stage) | ||
104 | { | ||
105 | _cache[image_id].stage = stage; | ||
106 | } | ||
107 | |||
108 | #endif // __EVAS_DIRECT3D_IMAGE_CACHE_H__ | ||