diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2012-09-17 01:37:56 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-13 22:41:06 +0100 |
commit | 7c290476afd877cf4be48f458a6d2666a2562c8c (patch) | |
tree | b662247e94851cb66d005e64b7c6db062f2fef02 /src/menu/background_color.hpp | |
parent | 618926293ca497ff8e31d048e34d10954cb0e059 (diff) | |
download | usdx-7c290476afd877cf4be48f458a6d2666a2562c8c.tar.gz usdx-7c290476afd877cf4be48f458a6d2666a2562c8c.tar.xz usdx-7c290476afd877cf4be48f458a6d2666a2562c8c.zip |
menu/background_*: vertices are only recalculated if the size changed
The size of the parent component is cached by the backgrounds and the
vertices to draw the backgrounds are only calculated again, if the
size of the parent component changed.
Diffstat (limited to 'src/menu/background_color.hpp')
-rw-r--r-- | src/menu/background_color.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/menu/background_color.hpp b/src/menu/background_color.hpp index 7913fe30..4ba040cb 100644 --- a/src/menu/background_color.hpp +++ b/src/menu/background_color.hpp @@ -29,6 +29,7 @@ #include "background.hpp" #include "utils/rgb_color.hpp" +#include "utils/dimension.hpp" namespace usdx { @@ -37,6 +38,19 @@ namespace usdx private: GLint vertices[8]; RgbColor color; + + /** + * Cache for the size of the parent component, to be able to detect + * changes. + */ + Dimension<int> size; + + /** + * Update the vertices for drawing the background, if the size if the + * parent component changes. + */ + void updateVertices(); + protected: void draw(void); |