diff options
Diffstat (limited to 'vcl/source/bitmap/bitmapscalesuper.cxx')
-rw-r--r-- | vcl/source/bitmap/bitmapscalesuper.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx index a7a263f0db75..95858eea5ae0 100644 --- a/vcl/source/bitmap/bitmapscalesuper.cxx +++ b/vcl/source/bitmap/bitmapscalesuper.cxx @@ -768,9 +768,13 @@ void scale24bitRGB2(BitmapReadAccess* pAcc, BitmapWriteAccess* pWAcc, nTotalWeightY += nWeightY; } - BitmapColor aColRes( ( sal_uInt8 ) (( nSumR / nTotalWeightY ) ), - ( sal_uInt8 ) (( nSumG / nTotalWeightY) ), - ( sal_uInt8 ) (( nSumB / nTotalWeightY) )); + if (nTotalWeightY) + { + nSumR /= nTotalWeightY; + nSumG /= nTotalWeightY; + nSumB /= nTotalWeightY; + } + BitmapColor aColRes((sal_uInt8)nSumR, (sal_uInt8)nSumG, (sal_uInt8)nSumB); pWAcc->SetPixel( nYDst, nXDst++, aColRes ); } } |