diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-06-10 13:51:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-06-10 16:08:02 +0100 |
commit | 59e9619ef91322f124b383b80fc21cd09a758017 (patch) | |
tree | eb3cda6c6de01132f466af7e67b8ef0ee8049298 /vcl | |
parent | 10eceebd2271990d17e5aa2f9a6a22162ef24a17 (diff) |
coverity#1222225 Division or modulo by zero
Change-Id: I9a60114833c22d498dbb6258fcb2ceac22c72751
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/bitmap/bitmapscalesuper.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx index 0ed69628ff07..13b65e6dc4d9 100644 --- a/vcl/source/bitmap/bitmapscalesuper.cxx +++ b/vcl/source/bitmap/bitmapscalesuper.cxx @@ -642,9 +642,15 @@ void scale24bitBGR2(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; } |