modules/graphics/src/main/java/com/sun/javafx/sg/prism/CacheFilter.java

Print this page

        

*** 209,219 **** /* * Do we need to regenerate the cached image? * Assumes that caller locked and validated the cachedImageData.untximage * if not null... */ ! private boolean needToRenderCache(BaseTransform renderXform, double[] xformInfo, float pixelScale) { if (cachedImageData == null) { return true; } if (lastXDelta != 0 || lastYDelta != 0) { --- 209,221 ---- /* * Do we need to regenerate the cached image? * Assumes that caller locked and validated the cachedImageData.untximage * if not null... */ ! private boolean needToRenderCache(BaseTransform renderXform, double[] xformInfo, ! float pixelScaleX, float pixelScaleY) ! { if (cachedImageData == null) { return true; } if (lastXDelta != 0 || lastYDelta != 0) {
*** 248,258 **** double scaleX = xformInfo[0]; double scaleY = xformInfo[1]; double rotate = xformInfo[2]; if (scaleHint) { ! if (cachedScaleX < pixelScale || cachedScaleY < pixelScale) { // We have moved onto a screen with a higher pixelScale and // our cache was less than that pixel scale. Even though // we have the scaleHint, we always cache at a minimum of // the pixel scale of the screen so we need to re-cache. return true; --- 250,260 ---- double scaleX = xformInfo[0]; double scaleY = xformInfo[1]; double rotate = xformInfo[2]; if (scaleHint) { ! if (cachedScaleX < pixelScaleX || cachedScaleY < pixelScaleY) { // We have moved onto a screen with a higher pixelScale and // our cache was less than that pixel scale. Even though // we have the scaleHint, we always cache at a minimum of // the pixel scale of the screen so we need to re-cache. return true;
*** 530,541 **** implImage.unlock(); invalidate(); } } } ! float pixelScale = g.getAssociatedScreen().getRenderScale(); ! if (needToRenderCache(xform, xformInfo, pixelScale)) { if (PulseLogger.PULSE_LOGGING_ENABLED) { PulseLogger.incrementCounter("CacheFilter rebuilding"); } if (cachedImageData != null) { Filterable implImage = cachedImageData.getUntransformedImage(); --- 532,544 ---- implImage.unlock(); invalidate(); } } } ! float pixelScaleX = g.getPixelScaleFactorX(); ! float pixelScaleY = g.getPixelScaleFactorY(); ! if (needToRenderCache(xform, xformInfo, pixelScaleX, pixelScaleY)) { if (PulseLogger.PULSE_LOGGING_ENABLED) { PulseLogger.incrementCounter("CacheFilter rebuilding"); } if (cachedImageData != null) { Filterable implImage = cachedImageData.getUntransformedImage();
*** 546,557 **** } if (scaleHint) { // do not cache the image at a small scale factor when // scaleHint is set as it leads to poor rendering results // when image is scaled up. ! cachedScaleX = Math.max(pixelScale, xformInfo[0]); ! cachedScaleY = Math.max(pixelScale, xformInfo[1]); cachedRotate = 0; cachedXform.setTransform(cachedScaleX, 0.0, 0.0, cachedScaleX, 0.0, 0.0); updateScreenXform(xformInfo); --- 549,560 ---- } if (scaleHint) { // do not cache the image at a small scale factor when // scaleHint is set as it leads to poor rendering results // when image is scaled up. ! cachedScaleX = Math.max(pixelScaleX, xformInfo[0]); ! cachedScaleY = Math.max(pixelScaleY, xformInfo[1]); cachedRotate = 0; cachedXform.setTransform(cachedScaleX, 0.0, 0.0, cachedScaleX, 0.0, 0.0); updateScreenXform(xformInfo);