Commit c864d4df08dc9ac9d63e57afc7b80d7f41dfba79
1 parent
e4ecc2e2
Create 1 shared 1x1 white BitmapImage instead of 1 per item
The way this was written, we had hundreds of identical 1x1 BitmapImages for item checkboxes live during a scroll. Change-Id: I0529c803476103d8fbff3f1fb88b5d6d549ccbcc Signed-off-by: Andrew Cox <andrew.cox@partner.samsung.com>
Showing
1 changed file
with
5 additions
and
1 deletions
examples/item-view/item-view-example.cpp
| ... | ... | @@ -349,6 +349,9 @@ public: |
| 349 | 349 | // Set the title and icon to the current layout |
| 350 | 350 | SetLayoutTitle(); |
| 351 | 351 | SetLayoutImage(); |
| 352 | + | |
| 353 | + // Store one 1x1 white image for multiple items to share for backgrounds: | |
| 354 | + mWhiteImage = BitmapImage::WHITE(); | |
| 352 | 355 | } |
| 353 | 356 | |
| 354 | 357 | Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocusNavigationDirection direction ) |
| ... | ... | @@ -905,7 +908,7 @@ public: // From ItemFactory |
| 905 | 908 | |
| 906 | 909 | // Add a checkbox child actor; invisible until edit-mode is enabled |
| 907 | 910 | |
| 908 | - ImageActor checkbox = ImageActor::New( BitmapImage::WHITE() ); | |
| 911 | + ImageActor checkbox = ImageActor::New( mWhiteImage ); | |
| 909 | 912 | checkbox.SetName( "CheckBox" ); |
| 910 | 913 | checkbox.SetColor( Vector4(0.0f,0.0f,0.0f,0.6f) ); |
| 911 | 914 | checkbox.SetParentOrigin( ParentOrigin::TOP_RIGHT ); |
| ... | ... | @@ -1131,6 +1134,7 @@ private: |
| 1131 | 1134 | |
| 1132 | 1135 | unsigned int mAlphaFuncIndex; |
| 1133 | 1136 | TextView mAlphaFunctionText; |
| 1137 | + BitmapImage mWhiteImage; | |
| 1134 | 1138 | }; |
| 1135 | 1139 | |
| 1136 | 1140 | void RunTest(Application& app) | ... | ... |