diff options
Diffstat (limited to 'linden/indra/newview/llviewerimagelist.h')
-rw-r--r-- | linden/indra/newview/llviewerimagelist.h | 77 |
1 files changed, 46 insertions, 31 deletions
diff --git a/linden/indra/newview/llviewerimagelist.h b/linden/indra/newview/llviewerimagelist.h index 8a39405..24d91fa 100644 --- a/linden/indra/newview/llviewerimagelist.h +++ b/linden/indra/newview/llviewerimagelist.h | |||
@@ -64,7 +64,7 @@ typedef void (*LLImageCallback)(BOOL success, | |||
64 | BOOL final, | 64 | BOOL final, |
65 | void* userdata); | 65 | void* userdata); |
66 | 66 | ||
67 | class LLViewerImageList : public LLImageProviderInterface | 67 | class LLViewerImageList |
68 | { | 68 | { |
69 | LOG_CLASS(LLViewerImageList); | 69 | LOG_CLASS(LLViewerImageList); |
70 | 70 | ||
@@ -82,46 +82,32 @@ public: | |||
82 | LLViewerImageList(); | 82 | LLViewerImageList(); |
83 | ~LLViewerImageList(); | 83 | ~LLViewerImageList(); |
84 | 84 | ||
85 | // LLImageProviderInterface | ||
86 | LLImageGL* getImageByID(const LLUUID& id, BOOL clamped = TRUE); | ||
87 | LLUIImage* getUIImageByID(const LLUUID& id, BOOL clamped = TRUE); | ||
88 | |||
89 | void init(); | 85 | void init(); |
90 | void shutdown(); | 86 | void shutdown(); |
91 | void dump(); | 87 | void dump(); |
92 | void destroyGL(BOOL save_state = TRUE); | 88 | void destroyGL(BOOL save_state = TRUE); |
93 | void restoreGL(); | 89 | void restoreGL(); |
94 | 90 | ||
95 | LLViewerImage * getImage(const LLString& filename, | ||
96 | const LLUUID &image_id, | ||
97 | BOOL usemipmap = TRUE, | ||
98 | BOOL level_immediate = FALSE // Get the requested level immediately upon creation. | ||
99 | ); | ||
100 | LLViewerImage * getImage(const LLUUID &image_id, | 91 | LLViewerImage * getImage(const LLUUID &image_id, |
101 | BOOL usemipmap = TRUE, | 92 | BOOL usemipmap = TRUE, |
102 | BOOL level_immediate = FALSE // Get the requested level immediately upon creation. | 93 | BOOL level_immediate = FALSE, // Get the requested level immediately upon creation. |
103 | ); | 94 | LLGLint internal_format = 0, |
95 | LLGLenum primary_format = 0, | ||
96 | LLHost request_from_host = LLHost() | ||
97 | ); | ||
104 | 98 | ||
105 | LLViewerImage * getImageFromFile(const LLString& filename, | 99 | LLViewerImage * getImageFromFile(const LLString& filename, |
106 | const LLUUID &image_id, | 100 | BOOL usemipmap = TRUE, |
107 | BOOL usemipmap, | 101 | BOOL level_immediate = FALSE, // Get the requested level immediately upon creation. |
108 | BOOL level_immediate, // Get the requested level immediately upon creation. | 102 | LLGLint internal_format = 0, |
109 | LLGLint internal_format, | 103 | LLGLenum primary_format = 0, |
110 | LLGLenum primary_format | 104 | const LLUUID& force_id = LLUUID::null |
111 | ); | 105 | ); |
112 | 106 | ||
113 | LLViewerImage * getImageFromUUID(const LLUUID &image_id, | ||
114 | BOOL usemipmap, | ||
115 | BOOL level_immediate, // Get the requested level immediately upon creation. | ||
116 | LLGLint internal_format, | ||
117 | LLGLenum primary_format, | ||
118 | LLHost request_from_host = LLHost() | ||
119 | ); | ||
120 | |||
121 | // Request image from a specific host, used for baked avatar textures. | 107 | // Request image from a specific host, used for baked avatar textures. |
122 | // Implemented in header in case someone changes default params above. JC | 108 | // Implemented in header in case someone changes default params above. JC |
123 | LLViewerImage* getImageFromHost(const LLUUID& image_id, LLHost host) | 109 | LLViewerImage* getImageFromHost(const LLUUID& image_id, LLHost host) |
124 | { return getImageFromUUID(image_id, TRUE, FALSE, 0, 0, host); } | 110 | { return getImage(image_id, TRUE, FALSE, 0, 0, host); } |
125 | 111 | ||
126 | LLViewerImage *hasImage(const LLUUID &image_id); | 112 | LLViewerImage *hasImage(const LLUUID &image_id); |
127 | void addImage(LLViewerImage *image); | 113 | void addImage(LLViewerImage *image); |
@@ -154,7 +140,6 @@ public: | |||
154 | static S32 getMaxVideoRamSetting(bool get_recommended = false); | 140 | static S32 getMaxVideoRamSetting(bool get_recommended = false); |
155 | 141 | ||
156 | private: | 142 | private: |
157 | LLViewerImage* preloadUIImage(const LLString& filename, const LLUUID &image_set_id, BOOL use_mips, const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); | ||
158 | void updateImagesDecodePriorities(); | 143 | void updateImagesDecodePriorities(); |
159 | F32 updateImagesCreateTextures(F32 max_time); | 144 | F32 updateImagesCreateTextures(F32 max_time); |
160 | F32 updateImagesFetchTextures(F32 max_time); | 145 | F32 updateImagesFetchTextures(F32 max_time); |
@@ -180,6 +165,9 @@ private: | |||
180 | typedef std::set<LLPointer<LLViewerImage>, LLViewerImage::Compare> image_priority_list_t; | 165 | typedef std::set<LLPointer<LLViewerImage>, LLViewerImage::Compare> image_priority_list_t; |
181 | image_priority_list_t mImageList; | 166 | image_priority_list_t mImageList; |
182 | 167 | ||
168 | // simply holds on to LLViewerImage references to stop them from being purged too soon | ||
169 | std::set<LLPointer<LLViewerImage> > mImagePreloads; | ||
170 | |||
183 | typedef std::vector<LLPointer<LLViewerImage> > callback_data_t; | 171 | typedef std::vector<LLPointer<LLViewerImage> > callback_data_t; |
184 | typedef std::set< callback_data_t* > callback_data_list_t; | 172 | typedef std::set< callback_data_t* > callback_data_list_t; |
185 | callback_data_list_t mIRCallbackData; | 173 | callback_data_list_t mIRCallbackData; |
@@ -188,9 +176,6 @@ private: | |||
188 | S32 mMaxResidentTexMem; | 176 | S32 mMaxResidentTexMem; |
189 | LLFrameTimer mForceDecodeTimer; | 177 | LLFrameTimer mForceDecodeTimer; |
190 | 178 | ||
191 | typedef std::map< LLUUID, LLPointer<LLUIImage> > uuid_ui_image_map_t; | ||
192 | uuid_ui_image_map_t mUIImages; | ||
193 | |||
194 | public: | 179 | public: |
195 | static U32 sTextureBits; | 180 | static U32 sTextureBits; |
196 | static U32 sTexturePackets; | 181 | static U32 sTexturePackets; |
@@ -207,6 +192,36 @@ private: | |||
207 | static void (*sUUIDCallback)(void**, const LLUUID &); | 192 | static void (*sUUIDCallback)(void**, const LLUUID &); |
208 | }; | 193 | }; |
209 | 194 | ||
195 | class LLUIImageList : public LLImageProviderInterface, public LLSingleton<LLUIImageList> | ||
196 | { | ||
197 | public: | ||
198 | // LLImageProviderInterface | ||
199 | LLUIImagePtr getUIImageByID(const LLUUID& id); | ||
200 | LLUIImagePtr getUIImage(const LLString& name); | ||
201 | void cleanUp(); | ||
202 | |||
203 | bool initFromFile(const LLString& filename); | ||
204 | |||
205 | LLUIImagePtr preloadUIImage(const LLString& name, const LLString& filename, BOOL use_mips, const LLRect& scale_rect); | ||
206 | |||
207 | static void onUIImageLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); | ||
208 | private: | ||
209 | LLUIImagePtr loadUIImageByName(const LLString& name, const LLString& filename, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null); | ||
210 | LLUIImagePtr loadUIImageByID(const LLUUID& id, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null); | ||
211 | |||
212 | LLUIImagePtr loadUIImage(LLViewerImage* imagep, const LLString& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null); | ||
213 | |||
214 | |||
215 | struct LLUIImageLoadData | ||
216 | { | ||
217 | LLString mImageName; | ||
218 | LLRect mImageScaleRegion; | ||
219 | }; | ||
220 | |||
221 | typedef std::map< LLString, LLPointer<LLUIImage> > uuid_ui_image_map_t; | ||
222 | uuid_ui_image_map_t mUIImages; | ||
223 | }; | ||
224 | |||
210 | const BOOL GLTEXTURE_TRUE = TRUE; | 225 | const BOOL GLTEXTURE_TRUE = TRUE; |
211 | const BOOL GLTEXTURE_FALSE = FALSE; | 226 | const BOOL GLTEXTURE_FALSE = FALSE; |
212 | const BOOL MIPMAP_TRUE = TRUE; | 227 | const BOOL MIPMAP_TRUE = TRUE; |