summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-06-10 13:43:35 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-10 16:08:00 +0100
commitc7661d5af5b230d567cabd83009da6762a5e91f7 (patch)
tree194cd2a88b1eea9bc6f0fafc6e821f2e06078ca6 /vcl
parentda62285f6b0aee36ce99223b5e568a3994e74255 (diff)
coverity#1222231 Division or modulo by zero
Change-Id: Id914167a72782741e67ba97683445aec6151fdd6
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/bitmap/bitmapscalesuper.cxx13
1 files changed, 10 insertions, 3 deletions
diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx
index b95f4ce96b0e..c48674006b1e 100644
--- a/vcl/source/bitmap/bitmapscalesuper.cxx
+++ b/vcl/source/bitmap/bitmapscalesuper.cxx
@@ -496,9 +496,16 @@ void scalePalleteGeneral2(BitmapReadAccess* pAcc, BitmapWriteAccess* pWAcc,
else if ( nLineRange == i )
nWeightY = pMapFY[ nBottom ];
- nSumB += nWeightY * ( nSumRowB / nTotalWeightX );
- nSumG += nWeightY * ( nSumRowG / nTotalWeightX );
- nSumR += nWeightY * ( nSumRowR / nTotalWeightX );
+ if (nTotalWeightX)
+ {
+ nSumRowB /= nTotalWeightX;
+ nSumRowG /= nTotalWeightX;
+ nSumRowR /= nTotalWeightX;
+ }
+
+ nSumB += nWeightY * nSumRowB;
+ nSumG += nWeightY * nSumRowG;
+ nSumR += nWeightY * nSumRowR;
nTotalWeightY += nWeightY;
}