mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Fix Reduce Color Arithmetic Overflow
This commit is contained in:
parent
cab854b722
commit
2973ea654e
1 changed files with 2 additions and 2 deletions
|
@ -578,7 +578,7 @@ namespace GreenshotPlugin.Core {
|
||||||
|
|
||||||
// the cube cannot be cut at bottom (this would lead to empty cube)
|
// the cube cannot be cut at bottom (this would lead to empty cube)
|
||||||
if (halfWeight != 0) {
|
if (halfWeight != 0) {
|
||||||
Single halfDistance = halfRed * halfRed + halfGreen * halfGreen + halfBlue * halfBlue;
|
Single halfDistance = (Single)halfRed * halfRed + (Single)halfGreen * halfGreen + (Single)halfBlue * halfBlue;
|
||||||
Single temp = halfDistance / halfWeight;
|
Single temp = halfDistance / halfWeight;
|
||||||
|
|
||||||
halfRed = wholeRed - halfRed;
|
halfRed = wholeRed - halfRed;
|
||||||
|
@ -587,7 +587,7 @@ namespace GreenshotPlugin.Core {
|
||||||
halfWeight = wholeWeight - halfWeight;
|
halfWeight = wholeWeight - halfWeight;
|
||||||
|
|
||||||
if (halfWeight != 0) {
|
if (halfWeight != 0) {
|
||||||
halfDistance = halfRed * halfRed + halfGreen * halfGreen + halfBlue * halfBlue;
|
halfDistance = (Single)halfRed * halfRed + (Single)halfGreen * halfGreen + (Single)halfBlue * halfBlue;
|
||||||
temp += halfDistance / halfWeight;
|
temp += halfDistance / halfWeight;
|
||||||
|
|
||||||
if (temp > result) {
|
if (temp > result) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue