summaryrefslogtreecommitdiffstats
path: root/tksao
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2019-03-04 22:07:47 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2019-03-04 22:07:47 (GMT)
commit1f6ba616ceb4ba5798cc7836c6c1b5da35e021d4 (patch)
treed5289ec3b2bf832a66c852b302c166534a7e5916 /tksao
parent86f0d258788e8124b07666167930e211c240bab8 (diff)
downloadblt-1f6ba616ceb4ba5798cc7836c6c1b5da35e021d4.zip
blt-1f6ba616ceb4ba5798cc7836c6c1b5da35e021d4.tar.gz
blt-1f6ba616ceb4ba5798cc7836c6c1b5da35e021d4.tar.bz2
update colorCells if colorCount has changed
Diffstat (limited to 'tksao')
-rw-r--r--tksao/colorbar/colorbar.C8
-rw-r--r--tksao/colorbar/colorbarrgb.C8
2 files changed, 16 insertions, 0 deletions
diff --git a/tksao/colorbar/colorbar.C b/tksao/colorbar/colorbar.C
index 91d7a98..a35610d 100644
--- a/tksao/colorbar/colorbar.C
+++ b/tksao/colorbar/colorbar.C
@@ -190,6 +190,14 @@ void Colorbar::reset()
void Colorbar::updateColorCells()
{
+ int clrs = (((ColorbarBaseOptions*)options)->colors);
+ if (clrs != colorCount) {
+ colorCount = clrs;
+ if (colorCells)
+ delete [] colorCells;
+ colorCells = new unsigned char[colorCount*3];
+ }
+
// fill rgb table
// note: its filled bgr to match XImage
diff --git a/tksao/colorbar/colorbarrgb.C b/tksao/colorbar/colorbarrgb.C
index 7eb953f..2a4b126 100644
--- a/tksao/colorbar/colorbarrgb.C
+++ b/tksao/colorbar/colorbarrgb.C
@@ -186,6 +186,14 @@ void ColorbarRGB::reset()
void ColorbarRGB::updateColorCells()
{
+ int clrs = (((ColorbarBaseOptions*)options)->colors);
+ if (clrs != colorCount) {
+ colorCount = clrs;
+ if (colorCells)
+ delete [] colorCells;
+ colorCells = new unsigned char[colorCount*3];
+ }
+
// fill rgb table
// note: its filled bgr to match XImage
// for(int i=0; i<colorCount; i++) {