projects
/
goodguy
/
history.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
proxy bug fixes, add moveobj, sams icons, ladspa fixes, pot sigfpe
[goodguy/history.git]
/
cinelerra-5.1
/
guicast
/
bcpot.C
diff --git
a/cinelerra-5.1/guicast/bcpot.C
b/cinelerra-5.1/guicast/bcpot.C
index 7417e79ed6a780a221aedc28058022eed0e7d15e..e934fc537d4a161ed5753ac31eadeb4b6430617b 100644
(file)
--- a/
cinelerra-5.1/guicast/bcpot.C
+++ b/
cinelerra-5.1/guicast/bcpot.C
@@
-460,7
+460,8
@@
const char* BC_FPot::get_caption()
float BC_FPot::get_percentage()
{
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)
}
int BC_FPot::percentage_to_value(float percentage)
@@
-549,7
+550,8
@@
const char* BC_IPot::get_caption()
float BC_IPot::get_percentage()
{
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)
}
int BC_IPot::percentage_to_value(float percentage)
@@
-633,7
+635,8
@@
const char* BC_QPot::get_caption()
float BC_QPot::get_percentage()
{
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)
}
int BC_QPot::percentage_to_value(float percentage)
@@
-709,7
+712,8
@@
const char* BC_PercentagePot::get_caption()
float BC_PercentagePot::get_percentage()
{
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)
}
int BC_PercentagePot::percentage_to_value(float percentage)