diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llviewerimagelist.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llviewerimagelist.cpp')
-rw-r--r-- | linden/indra/newview/llviewerimagelist.cpp | 627 |
1 files changed, 298 insertions, 329 deletions
diff --git a/linden/indra/newview/llviewerimagelist.cpp b/linden/indra/newview/llviewerimagelist.cpp index faa0afb..88759af 100644 --- a/linden/indra/newview/llviewerimagelist.cpp +++ b/linden/indra/newview/llviewerimagelist.cpp | |||
@@ -86,10 +86,9 @@ LLStat LLViewerImageList::sFormattedMemStat(32, TRUE); | |||
86 | /////////////////////////////////////////////////////////////////////////////// | 86 | /////////////////////////////////////////////////////////////////////////////// |
87 | 87 | ||
88 | LLViewerImageList::LLViewerImageList() | 88 | LLViewerImageList::LLViewerImageList() |
89 | : LLImageProviderInterface(), | 89 | : mForceResetTextureStats(FALSE), |
90 | mForceResetTextureStats(FALSE), | 90 | mUpdateStats(FALSE), |
91 | mUpdateStats(FALSE), | 91 | mMaxResidentTexMem(0) |
92 | mMaxResidentTexMem(0) | ||
93 | { | 92 | { |
94 | } | 93 | } |
95 | 94 | ||
@@ -118,228 +117,42 @@ void LLViewerImageList::doPreloadImages() | |||
118 | llinfos << "Preloading images..." << llendl; | 117 | llinfos << "Preloading images..." << llendl; |
119 | 118 | ||
120 | // Set the "missing asset" image | 119 | // Set the "missing asset" image |
121 | LLViewerImage::sMissingAssetImagep = preloadUIImage("missing_asset.tga" , LLUUID::null, TRUE); | 120 | LLViewerImage::sMissingAssetImagep = getImageFromFile("missing_asset.tga"); |
122 | 121 | ||
123 | // Set the "white" image | 122 | // Set the "white" image |
124 | LLViewerImage::sWhiteImagep = preloadUIImage("white.tga", LLUUID::null, TRUE);; | 123 | LLViewerImage::sWhiteImagep = getImageFromFile("white.tga"); |
125 | 124 | ||
126 | // Speeds up startup by 4-5 seconds. JC | 125 | LLUIImageList* image_list = LLUIImageList::getInstance(); |
127 | if (!gPreloadImages) return; | 126 | |
128 | 127 | image_list->initFromFile(gDirUtilp->getExpandedFilename(LL_PATH_SKINS, "textures", "textures.xml")); | |
129 | LLViewerImage* image; | 128 | |
130 | // Images listed here are immediately decoded, before the login screen. | 129 | // prefetch specific UUIDs |
131 | // Since this slows down perceived viewer startup time, only include | 130 | getImage(IMG_SHOT, TRUE); |
132 | // images here for buttons/checkboxes/etc. that are immediately visible. | 131 | getImage(IMG_SMOKE_POOF, TRUE); |
133 | preloadUIImage("button_disabled_32x128.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f )); | 132 | LLViewerImage* image = getImageFromFile("silhouette.j2c", MIPMAP_YES, IMMEDIATE_YES); |
134 | preloadUIImage("button_enabled_32x128.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f )); | 133 | if (image) |
135 | preloadUIImage("button_enabled_selected_32x128.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f )); | 134 | { |
136 | preloadUIImage("checkbox_disabled_false.tga", LLUUID::null, FALSE); | 135 | image->setClamp(FALSE, FALSE); |
137 | preloadUIImage("checkbox_disabled_true.tga", LLUUID::null, FALSE); | 136 | mImagePreloads.insert(image); |
138 | preloadUIImage("checkbox_enabled_false.tga", LLUUID::null, FALSE); | 137 | } |
139 | preloadUIImage("checkbox_enabled_true.tga", LLUUID::null, FALSE); | 138 | image = getImageFromFile("noentrylines.j2c", MIPMAP_YES, IMMEDIATE_YES); |
140 | preloadUIImage("close_in_blue.tga", LLUUID::null, FALSE); | 139 | if (image) |
141 | preloadUIImage("combobox_arrow.tga", LLUUID::null, FALSE); | 140 | { |
142 | preloadUIImage("minimize.tga", LLUUID::null, FALSE); | 141 | image->setClamp(FALSE, FALSE); |
143 | preloadUIImage("minimize_pressed.tga", LLUUID::null, FALSE); | 142 | mImagePreloads.insert(image); |
144 | preloadUIImage("radio_active_false.tga", LLUUID::null, FALSE); | 143 | } |
145 | preloadUIImage("radio_active_true.tga", LLUUID::null, FALSE); | 144 | image = getImageFromFile("noentrypasslines.j2c", MIPMAP_YES, IMMEDIATE_YES); |
146 | preloadUIImage("radio_inactive_false.tga", LLUUID::null, FALSE); | 145 | if (image) |
147 | preloadUIImage("radio_inactive_true.tga", LLUUID::null, FALSE); | 146 | { |
148 | preloadUIImage("resize_handle_bottom_right_blue.tga", LLUUID::null, FALSE); | 147 | image->setClamp(FALSE, FALSE); |
149 | preloadUIImage("rounded_square.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f )); | 148 | mImagePreloads.insert(image); |
150 | preloadUIImage("rounded_square_soft.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f )); | 149 | } |
151 | preloadUIImage("scrollbutton_down_in_blue.tga", LLUUID::null, FALSE); | 150 | image = getImage(DEFAULT_WATER_NORMAL, MIPMAP_YES, IMMEDIATE_YES); |
152 | preloadUIImage("scrollbutton_down_out_blue.tga", LLUUID::null, FALSE); | 151 | if (image) |
153 | preloadUIImage("scrollbutton_left_in_blue.tga", LLUUID::null, FALSE); | 152 | { |
154 | preloadUIImage("scrollbutton_left_out_blue.tga", LLUUID::null, FALSE); | 153 | image->setClamp(FALSE, FALSE); |
155 | preloadUIImage("scrollbutton_right_in_blue.tga", LLUUID::null, FALSE); | 154 | mImagePreloads.insert(image); |
156 | preloadUIImage("scrollbutton_right_out_blue.tga", LLUUID::null, FALSE); | 155 | } |
157 | preloadUIImage("scrollbutton_up_in_blue.tga", LLUUID::null, FALSE); | ||
158 | preloadUIImage("scrollbutton_up_out_blue.tga", LLUUID::null, FALSE); | ||
159 | preloadUIImage("spin_down_in_blue.tga", LLUUID::null, FALSE); | ||
160 | preloadUIImage("spin_down_out_blue.tga", LLUUID::null, FALSE); | ||
161 | preloadUIImage("spin_up_in_blue.tga", LLUUID::null, FALSE); | ||
162 | preloadUIImage("spin_up_out_blue.tga", LLUUID::null, FALSE); | ||
163 | preloadUIImage("square_btn_32x128.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f )); | ||
164 | preloadUIImage("square_btn_selected_32x128.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f )); | ||
165 | preloadUIImage("startup_logo.tga", LLUUID::null, FALSE); // -- needed? | ||
166 | preloadUIImage("tab_bottom_blue.tga", LLUUID::null, FALSE, LLRectf(0.109375f, 1.f - 0.4375f, 1.f - 0.109375f, 0.4375f)); | ||
167 | preloadUIImage("tab_bottom_selected_blue.tga", LLUUID::null, FALSE, LLRectf(0.109375f, 1.f - 0.4375f, 1.f - 0.109375f, 0.4375f)); | ||
168 | preloadUIImage("tab_left.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f )); | ||
169 | preloadUIImage("tab_left_selected.tga", LLUUID::null, FALSE, LLRectf(.125f, 0.5f, .875f, 0.5f )); | ||
170 | preloadUIImage("tab_top_blue.tga", LLUUID::null, FALSE, LLRectf(0.109375f, 1.f - 0.4375f, 1.f - 0.109375f, 0.4375f)); | ||
171 | preloadUIImage("tab_top_selected_blue.tga", LLUUID::null, FALSE, LLRectf(0.109375f, 1.f - 0.4375f, 1.f - 0.109375f, 0.4375f)); | ||
172 | |||
173 | decodeAllImages(2.f); // decode preloaded images | ||
174 | |||
175 | // These images are queued for decode during the login sequence, when | ||
176 | // we have a progress bar. | ||
177 | preloadUIImage("active_voice_tab.tga", LLUUID::null, FALSE); | ||
178 | preloadUIImage("button_anim_pause.tga", LLUUID::null, FALSE); | ||
179 | preloadUIImage("button_anim_pause_selected.tga", LLUUID::null, FALSE); | ||
180 | preloadUIImage("button_anim_play.tga", LLUUID::null, FALSE); | ||
181 | preloadUIImage("button_anim_play_selected.tga", LLUUID::null, FALSE); | ||
182 | preloadUIImage("button_anim_stop.tga", LLUUID::null, FALSE); | ||
183 | preloadUIImage("button_anim_stop_selected.tga", LLUUID::null, FALSE); | ||
184 | preloadUIImage("crosshairs.tga", LLUUID::null, FALSE); | ||
185 | preloadUIImage("direction_arrow.tga", LLUUID::null, FALSE); | ||
186 | preloadUIImage("eyes.tga", LLUUID::null, TRUE); | ||
187 | preloadUIImage("foot_shadow.tga", LLUUID::null, TRUE); | ||
188 | preloadUIImage("hair.tga", LLUUID::null, TRUE); | ||
189 | preloadUIImage("icon_diurnal.tga", LLUUID::null, TRUE); | ||
190 | preloadUIImage("icon_for_sale.tga", LLUUID::null, FALSE); | ||
191 | preloadUIImage("icon_popular.tga", LLUUID::null, FALSE); | ||
192 | preloadUIImage("icon_top_pick.tga", LLUUID::null, FALSE); | ||
193 | preloadUIImage("icon_group.tga", LLUUID::null, FALSE); | ||
194 | preloadUIImage("icon_lock.tga", LLUUID::null, FALSE); | ||
195 | preloadUIImage("img_shot.tga", IMG_SHOT, TRUE); | ||
196 | preloadUIImage("img_smoke_poof.tga", IMG_SMOKE_POOF, TRUE); | ||
197 | preloadUIImage("inv_folder_animation.tga", LLUUID::null, FALSE); | ||
198 | preloadUIImage("inv_folder_bodypart.tga", LLUUID::null, FALSE); | ||
199 | preloadUIImage("inv_folder_callingcard.tga", LLUUID::null, FALSE); | ||
200 | preloadUIImage("inv_folder_clothing.tga", LLUUID::null, FALSE); | ||
201 | preloadUIImage("inv_folder_gesture.tga", LLUUID::null, FALSE); | ||
202 | preloadUIImage("inv_folder_landmark.tga", LLUUID::null, FALSE); | ||
203 | preloadUIImage("inv_folder_lostandfound.tga", LLUUID::null, FALSE); | ||
204 | preloadUIImage("inv_folder_notecard.tga", LLUUID::null, FALSE); | ||
205 | preloadUIImage("inv_folder_object.tga", LLUUID::null, FALSE); | ||
206 | preloadUIImage("inv_folder_plain_closed.tga", LLUUID::null, FALSE); | ||
207 | preloadUIImage("inv_folder_script.tga", LLUUID::null, FALSE); | ||
208 | preloadUIImage("inv_folder_snapshot.tga", LLUUID::null, FALSE); | ||
209 | preloadUIImage("inv_folder_sound.tga", LLUUID::null, FALSE); | ||
210 | preloadUIImage("inv_folder_texture.tga", LLUUID::null, FALSE); | ||
211 | preloadUIImage("inv_folder_trash.tga", LLUUID::null, FALSE); | ||
212 | preloadUIImage("inv_item_animation.tga", LLUUID::null, FALSE); | ||
213 | preloadUIImage("inv_item_bodypart.tga", LLUUID::null, FALSE); | ||
214 | preloadUIImage("inv_item_callingcard_offline.tga", LLUUID::null, FALSE); | ||
215 | preloadUIImage("inv_item_callingcard_online.tga", LLUUID::null, FALSE); | ||
216 | preloadUIImage("inv_item_eyes.tga", LLUUID::null, FALSE); | ||
217 | preloadUIImage("inv_item_gesture.tga", LLUUID::null, FALSE); | ||
218 | preloadUIImage("inv_item_gloves.tga", LLUUID::null, FALSE); | ||
219 | preloadUIImage("inv_item_hair.tga", LLUUID::null, FALSE); | ||
220 | preloadUIImage("inv_item_jacket.tga", LLUUID::null, FALSE); | ||
221 | preloadUIImage("inv_item_landmark.tga", LLUUID::null, FALSE); | ||
222 | preloadUIImage("inv_item_landmark_visited.tga", LLUUID::null, FALSE); | ||
223 | preloadUIImage("inv_item_notecard.tga", LLUUID::null, FALSE); | ||
224 | preloadUIImage("inv_item_object.tga", LLUUID::null, FALSE); | ||
225 | preloadUIImage("inv_item_object_multi.tga", LLUUID::null, FALSE); | ||
226 | preloadUIImage("inv_item_pants.tga", LLUUID::null, FALSE); | ||
227 | preloadUIImage("inv_item_script.tga", LLUUID::null, FALSE); | ||
228 | preloadUIImage("inv_item_shape.tga", LLUUID::null, FALSE); | ||
229 | preloadUIImage("inv_item_shirt.tga", LLUUID::null, FALSE); | ||
230 | preloadUIImage("inv_item_shoes.tga", LLUUID::null, FALSE); | ||
231 | preloadUIImage("inv_item_skirt.tga", LLUUID::null, FALSE); | ||
232 | preloadUIImage("inv_item_snapshot.tga", LLUUID::null, FALSE); | ||
233 | preloadUIImage("inv_item_socks.tga", LLUUID::null, FALSE); | ||
234 | preloadUIImage("inv_item_sound.tga", LLUUID::null, FALSE); | ||
235 | preloadUIImage("inv_item_texture.tga", LLUUID::null, FALSE); | ||
236 | preloadUIImage("inv_item_underpants.tga", LLUUID::null, FALSE); | ||
237 | preloadUIImage("inv_item_undershirt.tga", LLUUID::null, FALSE); | ||
238 | preloadUIImage("lag_status_critical.tga", LLUUID::null, FALSE); | ||
239 | preloadUIImage("lag_status_good.tga", LLUUID::null, FALSE); | ||
240 | preloadUIImage("lag_status_warning.tga", LLUUID::null, FALSE); | ||
241 | preloadUIImage("legend.tga", LLUUID::null, FALSE); | ||
242 | preloadUIImage("map_avatar_16.tga", LLUUID::null, FALSE); | ||
243 | preloadUIImage("map_avatar_8.tga", LLUUID::null, FALSE); | ||
244 | preloadUIImage("map_avatar_you_8.tga", LLUUID::null, FALSE); | ||
245 | preloadUIImage("map_event.tga", LLUUID::null, FALSE); | ||
246 | preloadUIImage("map_event_mature.tga", LLUUID::null, FALSE); | ||
247 | preloadUIImage("map_home.tga", LLUUID::null, FALSE); | ||
248 | preloadUIImage("map_infohub.tga", LLUUID::null, FALSE); | ||
249 | preloadUIImage("map_telehub.tga", LLUUID::null, FALSE); | ||
250 | preloadUIImage("map_track_16.tga", LLUUID::null, FALSE); | ||
251 | preloadUIImage("media_icon.tga", LLUUID::null, FALSE); | ||
252 | preloadUIImage("music_icon.tga", LLUUID::null, FALSE); | ||
253 | image = preloadUIImage("noentrylines.tga", LLUUID::null, TRUE); | ||
254 | if (image) image->setClamp(FALSE, FALSE); | ||
255 | image = preloadUIImage("noentrypasslines.tga", LLUUID::null, TRUE); | ||
256 | if (image) image->setClamp(FALSE, FALSE); | ||
257 | preloadUIImage("notify_tip_icon.tga", LLUUID::null, FALSE); | ||
258 | preloadUIImage("notify_caution_icon.tga", LLUUID::null, FALSE); | ||
259 | preloadUIImage("notify_box_icon.tga", LLUUID::null, FALSE); | ||
260 | preloadUIImage("object_cone.tga", LLUUID::null, FALSE); | ||
261 | preloadUIImage("object_cone_active.tga", LLUUID::null, FALSE); | ||
262 | preloadUIImage("object_cube.tga", LLUUID::null, FALSE); | ||
263 | preloadUIImage("object_cube_active.tga", LLUUID::null, FALSE); | ||
264 | preloadUIImage("object_cylinder.tga", LLUUID::null, FALSE); | ||
265 | preloadUIImage("object_cylinder_active.tga", LLUUID::null, FALSE); | ||
266 | preloadUIImage("object_grass.tga", LLUUID::null, FALSE); | ||
267 | preloadUIImage("object_grass_active.tga", LLUUID::null, FALSE); | ||
268 | preloadUIImage("object_hemi_cone.tga", LLUUID::null, FALSE); | ||
269 | preloadUIImage("object_hemi_cone_active.tga", LLUUID::null, FALSE); | ||
270 | preloadUIImage("object_hemi_cylinder.tga", LLUUID::null, FALSE); | ||
271 | preloadUIImage("object_hemi_cylinder_active.tga", LLUUID::null, FALSE); | ||
272 | preloadUIImage("object_hemi_sphere.tga", LLUUID::null, FALSE); | ||
273 | preloadUIImage("object_hemi_sphere_active.tga", LLUUID::null, FALSE); | ||
274 | preloadUIImage("object_prism.tga", LLUUID::null, FALSE); | ||
275 | preloadUIImage("object_prism_active.tga", LLUUID::null, FALSE); | ||
276 | preloadUIImage("object_pyramid.tga", LLUUID::null, FALSE); | ||
277 | preloadUIImage("object_pyramid_active.tga", LLUUID::null, FALSE); | ||
278 | preloadUIImage("object_ring.tga", LLUUID::null, FALSE); | ||
279 | preloadUIImage("object_ring_active.tga", LLUUID::null, FALSE); | ||
280 | preloadUIImage("object_sphere.tga", LLUUID::null, FALSE); | ||
281 | preloadUIImage("object_sphere_active.tga", LLUUID::null, FALSE); | ||
282 | preloadUIImage("object_tetrahedron.tga", LLUUID::null, FALSE); | ||
283 | preloadUIImage("object_tetrahedron_active.tga", LLUUID::null, FALSE); | ||
284 | preloadUIImage("object_torus.tga", LLUUID::null, FALSE); | ||
285 | preloadUIImage("object_torus_active.tga", LLUUID::null, FALSE); | ||
286 | preloadUIImage("object_tree.tga", LLUUID::null, FALSE); | ||
287 | preloadUIImage("object_tree_active.tga", LLUUID::null, FALSE); | ||
288 | preloadUIImage("object_tube.tga", LLUUID::null, FALSE); | ||
289 | preloadUIImage("object_tube_active.tga", LLUUID::null, FALSE); | ||
290 | preloadUIImage("pixiesmall.tga", LLUUID::null, TRUE); | ||
291 | preloadUIImage("script_error.tga", LLUUID::null, TRUE); | ||
292 | image = preloadUIImage("silhouette.tga", LLUUID::null, TRUE); | ||
293 | if (image) image->setClamp(FALSE, FALSE); | ||
294 | preloadUIImage("status_no_build.tga", LLUUID::null, FALSE); | ||
295 | preloadUIImage("status_buy_currency.tga", LLUUID::null, FALSE); | ||
296 | preloadUIImage("status_buy_currency_pressed.tga", LLUUID::null, FALSE); | ||
297 | preloadUIImage("status_buy_land.tga", LLUUID::null, FALSE); | ||
298 | preloadUIImage("status_buy_land_pressed.tga", LLUUID::null, FALSE); | ||
299 | preloadUIImage("status_no_fly.tga", LLUUID::null, FALSE); | ||
300 | preloadUIImage("status_health.tga", LLUUID::null, FALSE); | ||
301 | preloadUIImage("status_no_push.tga", LLUUID::null, FALSE); | ||
302 | preloadUIImage("status_no_scripts.tga", LLUUID::null, FALSE); | ||
303 | preloadUIImage("tool_dozer.tga", LLUUID::null, FALSE); | ||
304 | preloadUIImage("tool_dozer_active.tga", LLUUID::null, FALSE); | ||
305 | preloadUIImage("tool_zoom.tga", LLUUID::null, FALSE); | ||
306 | preloadUIImage("tool_zoom_active.tga", LLUUID::null, FALSE); | ||
307 | preloadUIImage("icn-overlay_volume-panel.tga", LLUUID::null, FALSE); | ||
308 | preloadUIImage("icn_active-speakers-dot-lvl0.tga", LLUUID::null, FALSE); | ||
309 | preloadUIImage("icn_active-speakers-dot-lvl1.tga", LLUUID::null, FALSE); | ||
310 | preloadUIImage("icn_active-speakers-dot-lvl2.tga", LLUUID::null, FALSE); | ||
311 | preloadUIImage("icn_active-speakers-typing1.tga", LLUUID::null, FALSE); | ||
312 | preloadUIImage("icn_active-speakers-typing2.tga", LLUUID::null, FALSE); | ||
313 | preloadUIImage("icn_active-speakers-typing3.tga", LLUUID::null, FALSE); | ||
314 | preloadUIImage("icn_voice_ptt-off.tga", LLUUID::null, FALSE); | ||
315 | preloadUIImage("icn_voice_ptt-on.tga", LLUUID::null, FALSE); | ||
316 | preloadUIImage("icn_voice_ptt-on-lvl1.tga", LLUUID::null, FALSE); | ||
317 | preloadUIImage("icn_voice_ptt-on-lvl2.tga", LLUUID::null, FALSE); | ||
318 | preloadUIImage("icn_voice_ptt-on-lvl3.tga", LLUUID::null, FALSE); | ||
319 | preloadUIImage("lag_status_good.tga", LLUUID::null, FALSE); | ||
320 | preloadUIImage("lag_status_warning.tga", LLUUID::null, FALSE); | ||
321 | preloadUIImage("lag_status_critical.tga", LLUUID::null, FALSE); | ||
322 | preloadUIImage("icn_voice-call-end.tga", LLUUID::null, FALSE); | ||
323 | preloadUIImage("icn_voice-call-start.tga", LLUUID::null, FALSE); | ||
324 | preloadUIImage("mute_icon.tga", LLUUID::null, FALSE); | ||
325 | preloadUIImage("icn-overlay_volume-panel.tga", LLUUID::null, FALSE); | ||
326 | preloadUIImage("icn_slide-groove_dark.tga", LLUUID::null, FALSE); | ||
327 | preloadUIImage("icn_slide-highlight.tga", LLUUID::null, FALSE); | ||
328 | preloadUIImage("icn_slide-thumb_dark.tga", LLUUID::null, FALSE); | ||
329 | preloadUIImage("icn_speaker-muted_dark.tga", LLUUID::null, FALSE); | ||
330 | preloadUIImage("icn_speaker_dark.tga", LLUUID::null, FALSE); | ||
331 | preloadUIImage("icn_voice-localchat.tga", LLUUID::null, FALSE); | ||
332 | preloadUIImage("icn_voice-groupfocus.tga", LLUUID::null, FALSE); | ||
333 | preloadUIImage("icn_voice-pvtfocus.tga", LLUUID::null, FALSE); | ||
334 | // TODO: Add images for media remote | ||
335 | preloadUIImage("icn_chatbar.tga", LLUUID::null, FALSE); | ||
336 | preloadUIImage("btn_chatbar.tga", LLUUID::null, FALSE, LLRectf(0.5f, 0.5f, 0.5f, 0.5f)); | ||
337 | preloadUIImage("btn_chatbar_selected.tga", LLUUID::null, FALSE, LLRectf(0.5f, 0.5f, 0.5f, 0.5f)); | ||
338 | preloadUIImage("icn_rounded-text-field.tga", LLUUID::null, FALSE); | ||
339 | preloadUIImage("flyout_btn_right_selected.tga", LLUUID::null, FALSE, LLRectf(0.125f, 0.5f, 0.2f, 0.5f)); | ||
340 | preloadUIImage("flyout_btn_right.tga", LLUUID::null, FALSE, LLRectf(0.125f, 0.5f, 0.2f, 0.5f)); | ||
341 | preloadUIImage("flyout_btn_left_selected.tga", LLUUID::null, FALSE, LLRectf(0.8f, 0.5f, 0.875f, 0.5f)); | ||
342 | preloadUIImage("flyout_btn_left.tga", LLUUID::null, FALSE, LLRectf(0.8f, 0.5f, 0.875f, 0.5f)); | ||
343 | } | 156 | } |
344 | 157 | ||
345 | static std::string get_texture_list_name() | 158 | static std::string get_texture_list_name() |
@@ -390,6 +203,9 @@ LLViewerImageList::~LLViewerImageList() | |||
390 | 203 | ||
391 | void LLViewerImageList::shutdown() | 204 | void LLViewerImageList::shutdown() |
392 | { | 205 | { |
206 | // clear out preloads | ||
207 | mImagePreloads.clear(); | ||
208 | |||
393 | // Write out list of currently loaded textures for precaching on startup | 209 | // Write out list of currently loaded textures for precaching on startup |
394 | typedef std::set<std::pair<S32,LLViewerImage*> > image_area_list_t; | 210 | typedef std::set<std::pair<S32,LLViewerImage*> > image_area_list_t; |
395 | image_area_list_t image_area_list; | 211 | image_area_list_t image_area_list; |
@@ -438,9 +254,6 @@ void LLViewerImageList::shutdown() | |||
438 | mCallbackList.clear(); | 254 | mCallbackList.clear(); |
439 | mIRCallbackData.clear(); | 255 | mIRCallbackData.clear(); |
440 | 256 | ||
441 | // Clean up preloaded images | ||
442 | mUIImages.clear(); | ||
443 | |||
444 | // Flush all of the references | 257 | // Flush all of the references |
445 | mLoadingStreamList.clear(); | 258 | mLoadingStreamList.clear(); |
446 | mCreateTextureList.clear(); | 259 | mCreateTextureList.clear(); |
@@ -484,66 +297,14 @@ void LLViewerImageList::restoreGL() | |||
484 | const LLUUID BAD_IMG_TWO("bea77041-5835-1661-f298-47e2d32b7a70"); | 297 | const LLUUID BAD_IMG_TWO("bea77041-5835-1661-f298-47e2d32b7a70"); |
485 | */ | 298 | */ |
486 | 299 | ||
487 | LLImageGL* LLViewerImageList::getImageByID(const LLUUID& image_id, BOOL clamped) | ||
488 | { | ||
489 | LLViewerImage* imagep = getImage(image_id, MIPMAP_FALSE, TRUE); | ||
490 | // force a high resolution decode for all UI images (pulled this from LLTextEditor) | ||
491 | // this might not make any difference | ||
492 | imagep->setBoostLevel(LLViewerImage::BOOST_UI); | ||
493 | LLViewerImage::bindTexture(imagep); | ||
494 | imagep->setClamp(clamped, clamped); | ||
495 | imagep->unbindTexture(0, GL_TEXTURE_2D); | ||
496 | |||
497 | return (LLImageGL*)imagep; | ||
498 | } | ||
499 | |||
500 | LLUIImage* LLViewerImageList::getUIImageByID(const LLUUID& image_id, BOOL clamped) | ||
501 | { | ||
502 | uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_id); | ||
503 | if (found_it != mUIImages.end()) | ||
504 | { | ||
505 | return found_it->second; | ||
506 | } | ||
507 | |||
508 | // otherwise create new ui image wrapper | ||
509 | LLImageGL* image = getImageByID(image_id, clamped); | ||
510 | image->dontDiscard(); | ||
511 | LLPointer<LLUIImage> new_imagep = new LLUIImage(image); | ||
512 | mUIImages.insert(std::make_pair(image_id, new_imagep)); | ||
513 | |||
514 | return new_imagep; | ||
515 | } | ||
516 | |||
517 | |||
518 | /////////////////////////////////////////////////////////////////////////////// | ||
519 | |||
520 | LLViewerImage* LLViewerImageList::preloadUIImage(const LLString& filename, const LLUUID &image_set_id, BOOL use_mips, const LLRectf& scale_rect) | ||
521 | { | ||
522 | LLViewerImage* image = getImage(filename, image_set_id, use_mips, TRUE); | ||
523 | image->dontDiscard(); | ||
524 | image->setClamp(TRUE, TRUE); | ||
525 | LLUIImage* ui_imagep = new LLUIImage(image); | ||
526 | ui_imagep->setScaleRegion(scale_rect); | ||
527 | mUIImages.insert(std::make_pair(image->getID(), LLPointer<LLUIImage>(ui_imagep))); | ||
528 | return image; | ||
529 | } | ||
530 | |||
531 | /////////////////////////////////////////////////////////////////////////////// | 300 | /////////////////////////////////////////////////////////////////////////////// |
532 | 301 | ||
533 | LLViewerImage* LLViewerImageList::getImage(const LLString& filename, | ||
534 | const LLUUID &image_set_id, | ||
535 | BOOL usemipmaps, | ||
536 | BOOL level_immediate) | ||
537 | { | ||
538 | return getImageFromFile(filename, image_set_id, usemipmaps, level_immediate, 0, 0); | ||
539 | } | ||
540 | |||
541 | LLViewerImage* LLViewerImageList::getImageFromFile(const LLString& filename, | 302 | LLViewerImage* LLViewerImageList::getImageFromFile(const LLString& filename, |
542 | const LLUUID &image_set_id, | ||
543 | BOOL usemipmaps, | 303 | BOOL usemipmaps, |
544 | BOOL level_immediate, | 304 | BOOL level_immediate, |
545 | LLGLint internal_format, | 305 | LLGLint internal_format, |
546 | LLGLenum primary_format) | 306 | LLGLenum primary_format, |
307 | const LLUUID& force_id) | ||
547 | { | 308 | { |
548 | if (gNoRender) | 309 | if (gNoRender) |
549 | { | 310 | { |
@@ -551,56 +312,48 @@ LLViewerImage* LLViewerImageList::getImageFromFile(const LLString& filename, | |||
551 | // getImage() will handle that later. | 312 | // getImage() will handle that later. |
552 | return getImage(IMG_DEFAULT, TRUE, TRUE); | 313 | return getImage(IMG_DEFAULT, TRUE, TRUE); |
553 | } | 314 | } |
315 | |||
316 | if (filename.empty()) | ||
317 | { | ||
318 | return getImage(IMG_DEFAULT, TRUE, TRUE); | ||
319 | } | ||
320 | |||
321 | // generate UUID based on hash of filename | ||
322 | LLUUID new_id; | ||
323 | if (force_id.notNull()) | ||
324 | { | ||
325 | new_id = force_id; | ||
326 | } | ||
327 | else | ||
328 | { | ||
329 | new_id.generate(std::string(filename)); | ||
330 | } | ||
331 | |||
332 | LLPointer<LLViewerImage> imagep = hasImage(new_id); | ||
554 | 333 | ||
555 | // Try to load an image from the skins directory. | 334 | if (imagep.isNull()) |
556 | // Fall back to loading from the VFS if not found. | ||
557 | |||
558 | // First verify that the image exists in gViewerArt | ||
559 | LLUUID image_id = LLUUID( gViewerArt.getString(filename.c_str()) ); | ||
560 | if (image_id.isNull()) | ||
561 | { | 335 | { |
562 | llwarns << "Unable to find image " << filename << " in gViewerArt" << llendl; | 336 | imagep = new LLViewerImage(filename, new_id, usemipmaps); |
563 | if (image_set_id.notNull()) | 337 | |
338 | if (internal_format && primary_format) | ||
564 | { | 339 | { |
565 | // We *know* that missing_asset.tga exists, | 340 | imagep->setExplicitFormat(internal_format, primary_format); |
566 | // but for paranoia's sake and to avoid infinite recursion, check anyway | ||
567 | image_id = LLUUID(gViewerArt.getString("missing_asset.tga")); | ||
568 | if (image_id.isNull()) | ||
569 | { | ||
570 | llerrs << "Missing missing_asset.tga!" << llendl; | ||
571 | } | ||
572 | return getImageFromFile(LLString("missing_asset.tga"), image_set_id, | ||
573 | usemipmaps, level_immediate, | ||
574 | internal_format, primary_format); | ||
575 | } | 341 | } |
576 | else | 342 | |
343 | addImage(imagep); | ||
344 | |||
345 | if (level_immediate) | ||
577 | { | 346 | { |
578 | return (getImage(IMG_DEFAULT, TRUE, TRUE)); | 347 | imagep->dontDiscard(); |
348 | imagep->setBoostLevel(LLViewerImage::BOOST_UI); | ||
579 | } | 349 | } |
580 | } | 350 | } |
581 | 351 | ||
582 | // Now that we have verified that filename exists, load it and assign it to | ||
583 | // the filename's UUID, or image_set_id if non null. | ||
584 | if (image_set_id.notNull()) | ||
585 | { | ||
586 | image_id = image_set_id; | ||
587 | } | ||
588 | |||
589 | // Load the image | ||
590 | LLViewerImage* imagep = getImageFromUUID(image_id, usemipmaps, level_immediate, | ||
591 | internal_format, primary_format, LLHost()); | ||
592 | |||
593 | return imagep; | 352 | return imagep; |
594 | } | 353 | } |
595 | 354 | ||
596 | LLViewerImage* LLViewerImageList::getImage(const LLUUID &image_id, | ||
597 | BOOL usemipmaps, | ||
598 | BOOL level_immediate) | ||
599 | { | ||
600 | return getImageFromUUID(image_id, usemipmaps, level_immediate, 0, 0, LLHost()); | ||
601 | } | ||
602 | 355 | ||
603 | LLViewerImage* LLViewerImageList::getImageFromUUID(const LLUUID &image_id, | 356 | LLViewerImage* LLViewerImageList::getImage(const LLUUID &image_id, |
604 | BOOL usemipmaps, | 357 | BOOL usemipmaps, |
605 | BOOL level_immediate, | 358 | BOOL level_immediate, |
606 | LLGLint internal_format, | 359 | LLGLint internal_format, |
@@ -700,6 +453,7 @@ void LLViewerImageList::deleteImage(LLViewerImage *image) | |||
700 | { | 453 | { |
701 | mCallbackList.erase((LLViewerImage*)image); | 454 | mCallbackList.erase((LLViewerImage*)image); |
702 | } | 455 | } |
456 | |||
703 | llverify(mUUIDMap.erase(image->getID()) == 1); | 457 | llverify(mUUIDMap.erase(image->getID()) == 1); |
704 | sNumImages--; | 458 | sNumImages--; |
705 | removeImageFromList(image); | 459 | removeImageFromList(image); |
@@ -739,20 +493,25 @@ void LLViewerImageList::updateImages(F32 max_time) | |||
739 | gPipeline.dirtyPoolObjectTextures(mDirtyTextureList); | 493 | gPipeline.dirtyPoolObjectTextures(mDirtyTextureList); |
740 | mDirtyTextureList.clear(); | 494 | mDirtyTextureList.clear(); |
741 | } | 495 | } |
742 | 496 | ||
497 | bool didone = false; | ||
743 | for (image_list_t::iterator iter = mCallbackList.begin(); | 498 | for (image_list_t::iterator iter = mCallbackList.begin(); |
744 | iter != mCallbackList.end(); ) | 499 | iter != mCallbackList.end(); ) |
745 | { | 500 | { |
501 | //trigger loaded callbacks on local textures immediately | ||
746 | LLViewerImage* image = *iter++; | 502 | LLViewerImage* image = *iter++; |
747 | // Do stuff to handle callbacks, update priorities, etc. | 503 | if (!image->mLocalFileName.empty()) |
748 | bool res = image->doLoadedCallbacks(); | 504 | { |
749 | if (res) | 505 | // Do stuff to handle callbacks, update priorities, etc. |
506 | didone = image->doLoadedCallbacks(); | ||
507 | } | ||
508 | else if (!didone) | ||
750 | { | 509 | { |
751 | break; // only actually do one callback per frame | 510 | // Do stuff to handle callbacks, update priorities, etc. |
511 | didone = image->doLoadedCallbacks(); | ||
752 | } | 512 | } |
753 | } | 513 | } |
754 | 514 | ||
755 | |||
756 | if (!gNoRender && !gGLManager.mIsDisabled) | 515 | if (!gNoRender && !gGLManager.mIsDisabled) |
757 | { | 516 | { |
758 | LLViewerMedia::updateImagesMediaStreams(); | 517 | LLViewerMedia::updateImagesMediaStreams(); |
@@ -777,7 +536,7 @@ void LLViewerImageList::updateImagesDecodePriorities() | |||
777 | mLastUpdateUUID = iter->first; | 536 | mLastUpdateUUID = iter->first; |
778 | LLPointer<LLViewerImage> imagep = iter->second; | 537 | LLPointer<LLViewerImage> imagep = iter->second; |
779 | ++iter; // safe to incrament now | 538 | ++iter; // safe to incrament now |
780 | 539 | ||
781 | // | 540 | // |
782 | // Flush formatted images using a lazy flush | 541 | // Flush formatted images using a lazy flush |
783 | // | 542 | // |
@@ -1187,6 +946,7 @@ void LLViewerImageList::updateMaxResidentTexMem(S32 mem) | |||
1187 | { | 946 | { |
1188 | // Initialize the image pipeline VRAM settings | 947 | // Initialize the image pipeline VRAM settings |
1189 | S32 cur_mem = gSavedSettings.getS32("TextureMemory"); | 948 | S32 cur_mem = gSavedSettings.getS32("TextureMemory"); |
949 | F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); | ||
1190 | S32 default_mem = getMaxVideoRamSetting(true); // recommended default | 950 | S32 default_mem = getMaxVideoRamSetting(true); // recommended default |
1191 | if (mem == 0) | 951 | if (mem == 0) |
1192 | { | 952 | { |
@@ -1197,6 +957,9 @@ void LLViewerImageList::updateMaxResidentTexMem(S32 mem) | |||
1197 | mem = default_mem; | 957 | mem = default_mem; |
1198 | } | 958 | } |
1199 | 959 | ||
960 | // limit the texture memory to a multiple of the default if we've found some cards to behave poorly otherwise | ||
961 | mem = llmin(mem, (S32) (mem_multiplier * (F32) default_mem)); | ||
962 | |||
1200 | mem = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting()); | 963 | mem = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting()); |
1201 | if (mem != cur_mem) | 964 | if (mem != cur_mem) |
1202 | { | 965 | { |
@@ -1211,8 +974,8 @@ void LLViewerImageList::updateMaxResidentTexMem(S32 mem) | |||
1211 | S32 fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4); | 974 | S32 fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4); |
1212 | mMaxResidentTexMem = (vb_mem - fb_mem)<<20; | 975 | mMaxResidentTexMem = (vb_mem - fb_mem)<<20; |
1213 | 976 | ||
1214 | // llinfos << "Graphics Card memory set to " << (VIDEO_CARD_MEM_SIZES[cur_setting]>>20) | 977 | llinfos << "Total Video Memory set to: " << vb_mem << " MB" << llendl; |
1215 | // << " MB" << llendl; | 978 | llinfos << "Available Texture Memory set to: " << (vb_mem - fb_mem) << " MB" << llendl; |
1216 | } | 979 | } |
1217 | 980 | ||
1218 | /////////////////////////////////////////////////////////////////////////////// | 981 | /////////////////////////////////////////////////////////////////////////////// |
@@ -1379,3 +1142,209 @@ S32 LLViewerImageList::calcMaxTextureRAM() | |||
1379 | } | 1142 | } |
1380 | 1143 | ||
1381 | /////////////////////////////////////////////////////////////////////////////// | 1144 | /////////////////////////////////////////////////////////////////////////////// |
1145 | |||
1146 | // explicitly cleanup resources, as this is a singleton class with process | ||
1147 | // lifetime so ability to perform std::map operations in destructor is not | ||
1148 | // guaranteed. | ||
1149 | void LLUIImageList::cleanUp() | ||
1150 | { | ||
1151 | mUIImages.clear(); | ||
1152 | } | ||
1153 | |||
1154 | LLUIImagePtr LLUIImageList::getUIImageByID(const LLUUID& image_id) | ||
1155 | { | ||
1156 | // use id as image name | ||
1157 | LLString image_name = image_id.asString(); | ||
1158 | |||
1159 | // look for existing image | ||
1160 | uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name); | ||
1161 | if (found_it != mUIImages.end()) | ||
1162 | { | ||
1163 | return found_it->second; | ||
1164 | } | ||
1165 | |||
1166 | return loadUIImageByID(image_id); | ||
1167 | } | ||
1168 | |||
1169 | LLUIImagePtr LLUIImageList::getUIImage(const LLString& image_name) | ||
1170 | { | ||
1171 | // look for existing image | ||
1172 | uuid_ui_image_map_t::iterator found_it = mUIImages.find(image_name); | ||
1173 | if (found_it != mUIImages.end()) | ||
1174 | { | ||
1175 | return found_it->second; | ||
1176 | } | ||
1177 | |||
1178 | return loadUIImageByName(image_name, image_name); | ||
1179 | } | ||
1180 | |||
1181 | LLUIImagePtr LLUIImageList::loadUIImageByName(const LLString& name, const LLString& filename, BOOL use_mips, const LLRect& scale_rect) | ||
1182 | { | ||
1183 | LLViewerImage* imagep = gImageList.getImageFromFile(filename, MIPMAP_NO, IMMEDIATE_YES); | ||
1184 | return loadUIImage(imagep, name, use_mips, scale_rect); | ||
1185 | } | ||
1186 | |||
1187 | LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, BOOL use_mips, const LLRect& scale_rect) | ||
1188 | { | ||
1189 | LLViewerImage* imagep = gImageList.getImage(id, MIPMAP_NO, IMMEDIATE_YES); | ||
1190 | return loadUIImage(imagep, id.asString(), use_mips, scale_rect); | ||
1191 | } | ||
1192 | |||
1193 | LLUIImagePtr LLUIImageList::loadUIImage(LLViewerImage* imagep, const LLString& name, BOOL use_mips, const LLRect& scale_rect) | ||
1194 | { | ||
1195 | if (!imagep) return NULL; | ||
1196 | |||
1197 | imagep->setClamp(TRUE, TRUE); | ||
1198 | |||
1199 | LLUIImagePtr new_imagep = new LLUIImage(name, imagep); | ||
1200 | mUIImages.insert(std::make_pair(name, new_imagep)); | ||
1201 | |||
1202 | LLUIImageLoadData* datap = new LLUIImageLoadData; | ||
1203 | datap->mImageName = name; | ||
1204 | datap->mImageScaleRegion = scale_rect; | ||
1205 | |||
1206 | imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, datap); | ||
1207 | |||
1208 | return new_imagep; | ||
1209 | } | ||
1210 | |||
1211 | LLUIImagePtr LLUIImageList::preloadUIImage(const LLString& name, const LLString& filename, BOOL use_mips, const LLRect& scale_rect) | ||
1212 | { | ||
1213 | // look for existing image | ||
1214 | uuid_ui_image_map_t::iterator found_it = mUIImages.find(name); | ||
1215 | if (found_it != mUIImages.end()) | ||
1216 | { | ||
1217 | // image already loaded! | ||
1218 | llerrs << "UI Image " << name << " already loaded." << llendl; | ||
1219 | } | ||
1220 | |||
1221 | return loadUIImageByName(name, filename, use_mips, scale_rect); | ||
1222 | } | ||
1223 | |||
1224 | //static | ||
1225 | void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerImage *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* user_data ) | ||
1226 | { | ||
1227 | if(!success || !user_data) | ||
1228 | { | ||
1229 | return; | ||
1230 | } | ||
1231 | |||
1232 | LLString ui_image_name ; | ||
1233 | LLRect scale_rect ; | ||
1234 | { | ||
1235 | LLUIImageLoadData* image_datap = (LLUIImageLoadData*)user_data; | ||
1236 | |||
1237 | ui_image_name = image_datap->mImageName; | ||
1238 | scale_rect = image_datap->mImageScaleRegion; | ||
1239 | if(final) | ||
1240 | { | ||
1241 | delete image_datap; | ||
1242 | } | ||
1243 | } | ||
1244 | |||
1245 | LLUIImageList* instance = getInstance(); | ||
1246 | |||
1247 | uuid_ui_image_map_t::iterator found_it = instance->mUIImages.find(ui_image_name); | ||
1248 | if (found_it != instance->mUIImages.end()) | ||
1249 | { | ||
1250 | LLUIImagePtr imagep = found_it->second; | ||
1251 | |||
1252 | // for images grabbed from local files, apply clipping rectangle to restore original dimensions | ||
1253 | // from power-of-2 gl image | ||
1254 | if (success && imagep.notNull() && src_vi && !src_vi->mLocalFileName.empty()) | ||
1255 | { | ||
1256 | F32 clip_x = (F32)src_vi->getOriginalWidth() / (F32)src_vi->getWidth(0); | ||
1257 | F32 clip_y = (F32)src_vi->getOriginalHeight() / (F32)src_vi->getHeight(0); | ||
1258 | imagep->setClipRegion(LLRectf(0.f, clip_y, clip_x, 0.f)); | ||
1259 | if (scale_rect != LLRect::null) | ||
1260 | { | ||
1261 | imagep->setScaleRegion( | ||
1262 | LLRectf(llclamp((F32)scale_rect.mLeft / (F32)imagep->getWidth(), 0.f, 1.f), | ||
1263 | llclamp((F32)scale_rect.mTop / (F32)imagep->getHeight(), 0.f, 1.f), | ||
1264 | llclamp((F32)scale_rect.mRight / (F32)imagep->getWidth(), 0.f, 1.f), | ||
1265 | llclamp((F32)scale_rect.mBottom / (F32)imagep->getHeight(), 0.f, 1.f))); | ||
1266 | } | ||
1267 | } | ||
1268 | } | ||
1269 | } | ||
1270 | |||
1271 | bool LLUIImageList::initFromFile(const LLString& filename) | ||
1272 | { | ||
1273 | LLXmlTree xml_tree; | ||
1274 | |||
1275 | if (!xml_tree.parseFile(filename)) | ||
1276 | { | ||
1277 | llwarns << "Unable to parse UI image list file " << filename << llendl; | ||
1278 | return false; | ||
1279 | } | ||
1280 | |||
1281 | LLXmlTreeNode* rootp = xml_tree.getRoot(); | ||
1282 | if (!rootp || !rootp->hasAttribute("version")) | ||
1283 | { | ||
1284 | llwarns << "No valid version number in UI image list file " << filename << llendl; | ||
1285 | return false; | ||
1286 | } | ||
1287 | |||
1288 | enum | ||
1289 | { | ||
1290 | PASS_DECODE_NOW, | ||
1291 | PASS_DECODE_LATER, | ||
1292 | NUM_PASSES | ||
1293 | }; | ||
1294 | |||
1295 | for (S32 pass = PASS_DECODE_NOW; pass < NUM_PASSES; pass++) | ||
1296 | { | ||
1297 | LLXmlTreeNode* child_nodep = rootp->getFirstChild(); | ||
1298 | while(child_nodep) | ||
1299 | { | ||
1300 | LLString image_name = child_nodep->getName(); | ||
1301 | LLString file_name = image_name; | ||
1302 | LLRect scale_rect; | ||
1303 | BOOL use_mip_maps = FALSE; | ||
1304 | |||
1305 | BOOL preload = FALSE; | ||
1306 | child_nodep->getAttributeBOOL("preload", preload); | ||
1307 | |||
1308 | // load high priority textures on first pass (to kick off decode) | ||
1309 | if (preload) | ||
1310 | { | ||
1311 | if (pass == PASS_DECODE_LATER) | ||
1312 | { | ||
1313 | child_nodep = rootp->getNextChild(); | ||
1314 | continue; | ||
1315 | } | ||
1316 | } | ||
1317 | else | ||
1318 | { | ||
1319 | if (pass == PASS_DECODE_NOW) | ||
1320 | { | ||
1321 | child_nodep = rootp->getNextChild(); | ||
1322 | continue; | ||
1323 | } | ||
1324 | } | ||
1325 | |||
1326 | child_nodep->getAttributeString("file_name", file_name); | ||
1327 | child_nodep->getAttributeBOOL("use_mips", use_mip_maps); | ||
1328 | |||
1329 | LLXmlTreeNode* rect_node = child_nodep->getChildByName("scale_rect"); | ||
1330 | if (rect_node) | ||
1331 | { | ||
1332 | rect_node->getAttributeS32("left", scale_rect.mLeft); | ||
1333 | rect_node->getAttributeS32("right", scale_rect.mRight); | ||
1334 | rect_node->getAttributeS32("bottom", scale_rect.mBottom); | ||
1335 | rect_node->getAttributeS32("top", scale_rect.mTop); | ||
1336 | } | ||
1337 | |||
1338 | preloadUIImage(image_name, file_name, use_mip_maps, scale_rect); | ||
1339 | |||
1340 | child_nodep = rootp->getNextChild(); | ||
1341 | } | ||
1342 | |||
1343 | if (pass == PASS_DECODE_NOW && !gSavedSettings.getBOOL("NoPreload")) | ||
1344 | { | ||
1345 | gImageList.decodeAllImages(2.f); // decode preloaded images | ||
1346 | } | ||
1347 | } | ||
1348 | return true; | ||
1349 | } | ||
1350 | |||