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
1=== modified file 'Nux/Theme.cpp'
2--- Nux/Theme.cpp 2012-08-07 20:39:44 +0000
3+++ Nux/Theme.cpp 2012-09-26 12:29:27 +0000
4@@ -309,13 +309,10 @@
5
6 if (1)
7 {
8- BaseTexture* device_texture;
9-
10 NString filename = image->Attribute(TCHARToUTF8("Name"));
11 NString texture_filename = NUX_FIND_RESOURCE_LOCATION_NOFAIL(filename.GetTCharPtr());
12- device_texture = Load2DTextureFile(texture_filename.GetTCharPtr());
13-
14- pimage->texture = device_texture;
15+ pimage->texture = 0;
16+ pimage->filename = texture_filename;
17 }
18 else
19 {
20@@ -335,6 +332,12 @@
21
22 for (it = painter_image_list_.begin(); it != painter_image_list_.end(); it++)
23 {
24+ if (!(*it)->texture)
25+ {
26+ BaseTexture* device_texture = Load2DTextureFile((*it)->filename.c_str());
27+ (*it)->texture = device_texture;
28+ }
29+
30 if ((*it)->style == style)
31 {
32 return (*it);
33@@ -350,6 +353,12 @@
34
35 for (it = painter_image_list_.begin(); it != painter_image_list_.end(); it++)
36 {
37+ if (!(*it)->texture)
38+ {
39+ BaseTexture* device_texture = Load2DTextureFile((*it)->filename.c_str());
40+ (*it)->texture = device_texture;
41+ }
42+
43 if ((*it)->style == style)
44 {
45 unsigned int width = (*it)->texture->GetWidth();
46
47=== modified file 'Nux/Theme.h'
48--- Nux/Theme.h 2012-07-26 00:17:42 +0000
49+++ Nux/Theme.h 2012-09-26 12:29:27 +0000
50@@ -126,6 +126,8 @@
51 int border_top;
52 int border_bottom;
53 bool draw_borders_only;
54+
55+ std::string filename;
56 };
57
58 //! Load textures and other data for user interface rendering.

Subscribers

People subscribed via source and target branches