< prev index next >

src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 3149,3158 **** --- 3149,3165 ---- width, height, -1, -1); int rvWidth = resolutionVariant.getWidth(rvObserver); int rvHeight = resolutionVariant.getHeight(rvObserver); + if (rvWidth < 0 || rvHeight < 0) { + // The resolution variant is not loaded yet, try to use default resolution + resolutionVariant = mrImage.getResolutionVariant(width, height); + rvWidth = resolutionVariant.getWidth(rvObserver); + rvHeight = resolutionVariant.getHeight(rvObserver); + } + if (0 < width && 0 < height && 0 < rvWidth && 0 < rvHeight) { double widthScale = ((double) rvWidth) / width; double heightScale = ((double) rvHeight) / height;
*** 3182,3191 **** --- 3189,3200 ---- } return scaleImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer); + } else { + return false; // Image variant is not initialized yet } } } return null; }
< prev index next >