--- a/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp Fri Oct 20 20:08:09 2017 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp Mon Oct 23 16:55:52 2017 +0530
@@ -632,22 +632,37 @@
int AwtWin32GraphicsDevice::ScaleUpX(int x)
{
- return (int)ceil(x * scaleX);
+ return CheckIntLimits(x * scaleX);
}
int AwtWin32GraphicsDevice::ScaleUpY(int y)
{
- return (int)ceil(y * scaleY);
+ return CheckIntLimits(y * scaleY);
}
int AwtWin32GraphicsDevice::ScaleDownX(int x)
{
- return (int)ceil(x / scaleX);
+ return CheckIntLimits(x / scaleX);
}
int AwtWin32GraphicsDevice::ScaleDownY(int y)
{
- return (int)ceil(y / scaleY);
+ return CheckIntLimits(y / scaleY);
+}
+
+int AwtWin32GraphicsDevice::CheckIntLimits(double value)
+{
+ if (value < INT_MIN)
+ {
+ return INT_MIN;
+ }
+
+ if (value > INT_MAX)
+ {
+ return INT_MAX;
+ }
+
+ return (int)ceil(value);
}
void AwtWin32GraphicsDevice::InitDesktopScales()