diff options
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/colorbar/colorbar.C | 8 | ||||
-rw-r--r-- | tksao/colorbar/colorbarrgb.C | 8 |
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++) { |