X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcpot.C;h=60807911b501ed6e628f6d3bb8a2046e40db43a6;hb=0a0a29dd9e484b5622b46173d51bb6cefc0a5da4;hp=7417e79ed6a780a221aedc28058022eed0e7d15e;hpb=4f7f413cbc1c6ea5da27cb75ca27a3ab317243ec;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bcpot.C b/cinelerra-5.1/guicast/bcpot.C index 7417e79e..60807911 100644 --- a/cinelerra-5.1/guicast/bcpot.C +++ b/cinelerra-5.1/guicast/bcpot.C @@ -21,7 +21,7 @@ #include "bcpot.h" #include "bcresources.h" -#include "colors.h" +#include "bccolors.h" #include "keys.h" #include "units.h" #include "vframe.h" @@ -460,7 +460,8 @@ const char* BC_FPot::get_caption() float BC_FPot::get_percentage() { - return (value - minvalue) / (maxvalue - minvalue); + float range = maxvalue - minvalue; + return range > 0 ? (value - minvalue) / range : minvalue; } int BC_FPot::percentage_to_value(float percentage) @@ -549,7 +550,8 @@ const char* BC_IPot::get_caption() float BC_IPot::get_percentage() { - return ((float)value - minvalue) / (maxvalue - minvalue); + float range = maxvalue - minvalue; + return range > 0 ? ((float)value - minvalue) / range : minvalue; } int BC_IPot::percentage_to_value(float percentage) @@ -633,7 +635,8 @@ const char* BC_QPot::get_caption() float BC_QPot::get_percentage() { - return ((float)value - minvalue) / (maxvalue - minvalue); + float range = maxvalue - minvalue; + return range > 0 ? ((float)value - minvalue) / range : 0; } int BC_QPot::percentage_to_value(float percentage) @@ -709,7 +712,8 @@ const char* BC_PercentagePot::get_caption() float BC_PercentagePot::get_percentage() { - return (value - minvalue) / (maxvalue - minvalue); + float range = maxvalue - minvalue; + return range > 0 ? (value - minvalue) / range : minvalue; } int BC_PercentagePot::percentage_to_value(float percentage)