aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-06-14 17:22:35 -0700
committerThomas White <taw@physics.org>2012-02-22 15:26:50 +0100
commit72719468f58acca3237999c1f3888e0516054155 (patch)
treeb2f876fc6264ba5b155f2391a59e9910d9c3801f /src
parent9d397a6a1da81191e76688077bd694abf6ed5cd3 (diff)
hdfsee: Show colour scale properly in all cases
Diffstat (limited to 'src')
-rw-r--r--src/render.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/render.c b/src/render.c
index 70b76a86..efbbfcb9 100644
--- a/src/render.c
+++ b/src/render.c
@@ -308,7 +308,7 @@ GdkPixbuf *render_get_image(DisplayWindow *dw)
w, h, w*3, render_free_data, NULL);
}
-GdkPixbuf *render_get_colour_scale(size_t w, size_t h, int monochrome)
+GdkPixbuf *render_get_colour_scale(size_t w, size_t h, int scale)
{
guchar *data;
size_t x, y;
@@ -321,14 +321,26 @@ GdkPixbuf *render_get_colour_scale(size_t w, size_t h, int monochrome)
for ( y=0; y<h; y++ ) {
- guchar r, g, b;
+ guchar r = 0;
+ guchar g = 0;
+ guchar b = 0;
int val;
val = y;
- if ( !monochrome ) {
+
+ switch ( scale ) {
+ case SCALE_COLOUR : {
render_rgb(val, max, &r, &g, &b);
- } else {
+ break;
+ }
+ case SCALE_MONO : {
render_mono(val, max, &r, &g, &b);
+ break;
+ }
+ case SCALE_INVMONO : {
+ render_invmono(val, max, &r, &g, &b);
+ break;
+ }
}
data[3*( 0+w*(h-1-y) )+0] = 0;