diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-07-04 19:44:46 +0200 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-07-04 20:11:46 +0200 |
commit | 2fe0d7bc992c5c38ac09e4b76f720c924565a61b (patch) | |
tree | 0ad9aa12f3950e373598d0f0329fc0ead9c2a297 /vcl | |
parent | 982c6ab3346f55a877a58f7bb73e74daa27e9820 (diff) |
coverity#704538-9 Division by zero
Change-Id: Ia77648c3e0442bb5e0a08d01bbd495c9d7c8bbf5
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/generic/print/bitmap_gfx.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/vcl/generic/print/bitmap_gfx.cxx b/vcl/generic/print/bitmap_gfx.cxx index a7bac3439cdb..9ee5677a2c84 100644 --- a/vcl/generic/print/bitmap_gfx.cxx +++ b/vcl/generic/print/bitmap_gfx.cxx @@ -410,9 +410,16 @@ void PrinterGfx::DrawBitmap (const Rectangle& rDest, const Rectangle& rSrc, const PrinterBmp& rBitmap) { - double fScaleX = (double)rDest.GetWidth() / (double)rSrc.GetWidth(); - double fScaleY = (double)rDest.GetHeight() / (double)rSrc.GetHeight(); - + double fScaleX = (double)rDest.GetWidth(); + double fScaleY = (double)rDest.GetHeight(); + if(rSrc.GetWidth() > 0) + { + fScaleX = (double)rDest.GetWidth() / (double)rSrc.GetWidth(); + } + if(rSrc.GetHeigth() > 0) + { + fScaleY = (double)rDest.GetHeight() / (double)rSrc.GetHeight(); + } PSGSave (); PSTranslate (rDest.BottomLeft()); PSScale (fScaleX, fScaleY); |