diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-07-24 09:05:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-07-24 13:30:21 +0200 |
commit | a97332db58a048539646dcefbc54dcccfc1daa82 (patch) | |
tree | 762378bbd6007e61d06f9c1addc67cb825706227 | |
parent | 48c78c3abba301d1dd197be75958d380913b481f (diff) |
cid#1451629 silence Division or modulo by zero
Change-Id: I87f59593d7a1691d07276421aaa501751b4953e5
Reviewed-on: https://gerrit.libreoffice.org/76226
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx index 25196d61cc66..b679e172d554 100644 --- a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx +++ b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx @@ -150,6 +150,8 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc aValueBlue += aWeight * aColor.GetBlue(); } + assert(aSum != 0); + const BitmapColor aResultColor( static_cast< sal_uInt8 >(MinMax(static_cast< sal_Int32 >(aValueRed / aSum), 0, 255)), static_cast< sal_uInt8 >(MinMax(static_cast< sal_Int32 >(aValueGreen / aSum), 0, 255)), @@ -231,6 +233,8 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc aValueBlue += aWeight * aColor.GetBlue(); } + assert(aSum != 0); + const BitmapColor aResultColor( static_cast< sal_uInt8 >(MinMax(static_cast< sal_Int32 >(aValueRed / aSum), 0, 255)), static_cast< sal_uInt8 >(MinMax(static_cast< sal_Int32 >(aValueGreen / aSum), 0, 255)), |