summaryrefslogtreecommitdiff
path: root/vcl/source/bitmap
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-06-10 13:40:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-10 16:08:00 +0100
commitaaaf24322e95b74af0e46e01e9a35a1871fa1be2 (patch)
tree7ff32319d9eb8a333cc96eea10a5784028baa535 /vcl/source/bitmap
parentb311aab85f8a26d40d3b87329212288f653dafbc (diff)
coverity#1222233 Division or modulo by zero
Change-Id: I699dc60b67d9417a8ac3848c03d7352f9f8ff12d
Diffstat (limited to 'vcl/source/bitmap')
-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 4620c552286b..0b4be8cec6fc 100644
--- a/vcl/source/bitmap/bitmapscalesuper.cxx
+++ b/vcl/source/bitmap/bitmapscalesuper.cxx
@@ -861,9 +861,16 @@ void scaleNonPalleteGeneral2(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;
}