Browse Source

MSVC: Fix some potential divide-by-zero errors

tags/2021-05-28
reuk 5 years ago
parent
commit
dde6b96ebe
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp
  2. +2
    -2
      modules/juce_gui_basics/native/juce_win32_Windowing.cpp

+ 2
- 2
modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp View File

@@ -176,8 +176,8 @@ public:
void paint (Graphics& g) override
{
g.setOpacity (1.0f);
g.drawImageTransformed (image, AffineTransform::scale (getWidth() / (float) image.getWidth(),
getHeight() / (float) image.getHeight()), false);
g.drawImageTransformed (image, AffineTransform::scale (getWidth() / (float) jmax (1, image.getWidth()),
getHeight() / (float) jmax (1, image.getHeight())), false);
}
private:


+ 2
- 2
modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -4641,8 +4641,8 @@ void* CustomMouseCursorInfo::create() const
{
im = im.rescaled (maxW, maxH);
hotspotX = (hotspotX * maxW) / image.getWidth();
hotspotY = (hotspotY * maxH) / image.getHeight();
hotspotX = (hotspotX * maxW) / juce::jmax (1, image.getWidth());
hotspotY = (hotspotY * maxH) / juce::jmax (1, image.getHeight());
}
return IconConverters::createHICONFromImage (im, FALSE, hotspotX, hotspotY);


Loading…
Cancel
Save