From f0d93b3b51baffcd90062272db91d94c17199e9a Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Mon, 10 May 2010 22:05:47 +0000 Subject: if a pixel had accumulated color (0,0,0) and >0 density, a divide by 0 would take place. git-svn-id: https://flam3.googlecode.com/svn/trunk@12 77852712-ef1d-11de-8684-7d64432d61a3 --- src/palettes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/palettes.c b/src/palettes.c index 64122a3..c5090ee 100644 --- a/src/palettes.c +++ b/src/palettes.c @@ -288,7 +288,7 @@ void flam3_calc_newrgb(double *cbuf, double ls, double highpow, double *newrgb) double a, maxa=-1.0, maxc=0; double adjhlp; - if (ls==0.0) { + if (ls==0.0 || (cbuf[0]==0.0 && cbuf[1]==0.0 && cbuf[2]==0.0)) { newrgb[0] = 0.0; newrgb[1] = 0.0; newrgb[2] = 0.0; @@ -303,7 +303,7 @@ void flam3_calc_newrgb(double *cbuf, double ls, double highpow, double *newrgb) maxc = cbuf[rgbi]/PREFILTER_WHITE; } } - + /* If a channel is saturated and we have a non-negative highlight power */ /* modify the color to prevent hue shift */ if (maxa>255 && highpow>=0.0) { -- cgit v1.2.3