Mercurial > hg > svgui
changeset 496:d01f2e406cc5
* recalculate LED cache pixmaps if size changes
author | Chris Cannam |
---|---|
date | Mon, 23 Feb 2009 19:23:20 +0000 |
parents | 92b89764eb3b |
children | 5e6991aefdc5 |
files | widgets/LEDButton.cpp |
diffstat | 1 files changed, 18 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/widgets/LEDButton.cpp Mon Feb 23 14:40:17 2009 +0000 +++ b/widgets/LEDButton.cpp Mon Feb 23 19:23:20 2009 +0000 @@ -139,17 +139,27 @@ if (led_state) { if (d->on_map) { - paint.begin(this); - paint.drawPixmap(0, 0, *d->on_map); - paint.end(); - return; + if (d->on_map->size() == size()) { + paint.begin(this); + paint.drawPixmap(0, 0, *d->on_map); + paint.end(); + return; + } else { + delete d->on_map; + d->on_map = 0; + } } } else { if (d->off_map) { - paint.begin(this); - paint.drawPixmap(0, 0, *d->off_map); - paint.end(); - return; + if (d->off_map->size() == size()) { + paint.begin(this); + paint.drawPixmap(0, 0, *d->off_map); + paint.end(); + return; + } else { + delete d->off_map; + d->off_map = 0; + } } }