Nux

Merge lp:~hikiko/nux/nuxtex into lp:nux

Proposed by Eleni Maria Stea
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 670
Merged at revision: 675
Proposed branch: lp:~hikiko/nux/nuxtex
Merge into: lp:nux
Diff against target: 58 lines (+16/-5)
2 files modified
Nux/Theme.cpp (+14/-5)
Nux/Theme.h (+2/-0)
To merge this branch: bzr merge lp:~hikiko/nux/nuxtex
Reviewer Review Type Date Requested Status
Jay Taoko (community) Approve
Review via email: mp+126267@code.launchpad.net

Commit message

The textures of the widgets are now loaded the first time that GetImage or GetImageGeometry are called.

Description of the change

Solves bug #816692 (https://bugs.launchpad.net/nux/+bug/816692)
---------------------------------------------------------------
The textures of the widgets are now loaded the first time that GetImage or GetImageGeometry are called.

Concerns:
----------------------------
I wonder if there was a reason that nux used to preload all the textures related to a UXTheme. Does this change really improves the performance? (Depends on how many textures we have and how many of them are really needed)

To post a comment you must log in.
Revision history for this message
Jay Taoko (jaytaoko) wrote :

* Replace NString with std::string

review: Needs Fixing
Revision history for this message
Jay Taoko (jaytaoko) :
review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Nux/Theme.cpp'
--- Nux/Theme.cpp 2012-08-07 20:39:44 +0000
+++ Nux/Theme.cpp 2012-09-26 12:29:27 +0000
@@ -309,13 +309,10 @@
309309
310 if (1)310 if (1)
311 {311 {
312 BaseTexture* device_texture;
313
314 NString filename = image->Attribute(TCHARToUTF8("Name"));312 NString filename = image->Attribute(TCHARToUTF8("Name"));
315 NString texture_filename = NUX_FIND_RESOURCE_LOCATION_NOFAIL(filename.GetTCharPtr());313 NString texture_filename = NUX_FIND_RESOURCE_LOCATION_NOFAIL(filename.GetTCharPtr());
316 device_texture = Load2DTextureFile(texture_filename.GetTCharPtr());314 pimage->texture = 0;
317315 pimage->filename = texture_filename;
318 pimage->texture = device_texture;
319 }316 }
320 else317 else
321 {318 {
@@ -335,6 +332,12 @@
335332
336 for (it = painter_image_list_.begin(); it != painter_image_list_.end(); it++)333 for (it = painter_image_list_.begin(); it != painter_image_list_.end(); it++)
337 {334 {
335 if (!(*it)->texture)
336 {
337 BaseTexture* device_texture = Load2DTextureFile((*it)->filename.c_str());
338 (*it)->texture = device_texture;
339 }
340
338 if ((*it)->style == style)341 if ((*it)->style == style)
339 {342 {
340 return (*it);343 return (*it);
@@ -350,6 +353,12 @@
350353
351 for (it = painter_image_list_.begin(); it != painter_image_list_.end(); it++)354 for (it = painter_image_list_.begin(); it != painter_image_list_.end(); it++)
352 {355 {
356 if (!(*it)->texture)
357 {
358 BaseTexture* device_texture = Load2DTextureFile((*it)->filename.c_str());
359 (*it)->texture = device_texture;
360 }
361
353 if ((*it)->style == style)362 if ((*it)->style == style)
354 {363 {
355 unsigned int width = (*it)->texture->GetWidth();364 unsigned int width = (*it)->texture->GetWidth();
356365
=== modified file 'Nux/Theme.h'
--- Nux/Theme.h 2012-07-26 00:17:42 +0000
+++ Nux/Theme.h 2012-09-26 12:29:27 +0000
@@ -126,6 +126,8 @@
126 int border_top;126 int border_top;
127 int border_bottom;127 int border_bottom;
128 bool draw_borders_only;128 bool draw_borders_only;
129
130 std::string filename;
129 };131 };
130132
131 //! Load textures and other data for user interface rendering.133 //! Load textures and other data for user interface rendering.

Subscribers

People subscribed via source and target branches