--- old/modules/web/src/main/java/com/sun/javafx/webkit/prism/PrismGraphicsManager.java 2013-10-01 21:51:58.190398415 +0400 +++ new/modules/web/src/main/java/com/sun/javafx/webkit/prism/PrismGraphicsManager.java 2013-10-01 21:51:58.018397378 +0400 @@ -4,6 +4,7 @@ package com.sun.javafx.webkit.prism; import com.sun.glass.ui.Screen; +import com.sun.javafx.geom.transform.BaseTransform; import com.sun.media.jfxmedia.MediaManager; import com.sun.prism.Graphics; import com.sun.webkit.perf.WCFontPerfLogger; @@ -16,11 +17,20 @@ public final class PrismGraphicsManager extends WCGraphicsManager { - private float highestPixelScale; - { + private final static float highestPixelScale; + private final static BaseTransform pixelScaleTransform; + + static { + float ps = 1f; for (Screen s : Screen.getScreens()) { - highestPixelScale = Math.max(s.getScale(), highestPixelScale); + ps = Math.max(s.getScale(), ps); } + highestPixelScale = ps; + pixelScaleTransform = BaseTransform.getScaleInstance(ps, ps); + } + + static BaseTransform getPixelScaleTransform() { + return pixelScaleTransform; } @Override protected WCImageDecoder getImageDecoder() { --- old/modules/web/src/main/java/com/sun/javafx/webkit/prism/RTImage.java 2013-10-01 21:51:58.570400703 +0400 +++ new/modules/web/src/main/java/com/sun/javafx/webkit/prism/RTImage.java 2013-10-01 21:51:58.466400077 +0400 @@ -3,7 +3,7 @@ */ package com.sun.javafx.webkit.prism; -import com.sun.javafx.geom.transform.BaseTransform; +import com.sun.prism.CompositeMode; import com.sun.prism.Graphics; import com.sun.prism.GraphicsPipeline; import com.sun.prism.Image; @@ -13,7 +13,6 @@ import com.sun.prism.ResourceFactory; import com.sun.prism.ResourceFactoryListener; import com.sun.prism.Texture; -import com.sun.webkit.Invoker; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; @@ -27,6 +26,7 @@ private boolean listenerAdded = false; private ByteBuffer pixelBuffer; private float pixelScale; + private static volatile int count; RTImage(int w, int h, float pixelScale) { width = w; @@ -44,7 +44,7 @@ @Override Graphics getGraphics() { Graphics g = getTexture().createGraphics(); - g.scale(pixelScale, pixelScale); + g.transform(PrismGraphicsManager.getPixelScaleTransform()); return g; } @@ -57,6 +57,8 @@ Texture.WrapMode.CLAMP_NOT_NEEDED); txt.contentsUseful(); txt.makePermanent(); + + System.err.printf("mkPermn %dx%d, total %d\n", width, height, ++count); if (! listenerAdded) { f.addFactoryListener(this); listenerAdded = true; @@ -70,6 +72,10 @@ int dstx1, int dsty1, int dstx2, int dsty2, int srcx1, int srcy1, int srcx2, int srcy2) { + if (txt == null && g.getCompositeMode() == CompositeMode.SRC_OVER) { + /// draw temporary texture instead of creating permanent txt + return; + } if (g instanceof PrinterGraphics) { // We're printing. Copy [txt] into a J2DTexture and draw it. int w = srcx2 - srcx1; @@ -98,6 +104,8 @@ @Override void dispose() { + System.err.printf("dispose %s, total %d\n", this, --count); + PrismInvoker.invokeOnRenderThread(new Runnable() { public void run() { if (txt != null) { --- old/modules/web/src/main/java/com/sun/javafx/webkit/prism/WCBufferedContext.java 2013-10-01 21:51:58.882402583 +0400 +++ new/modules/web/src/main/java/com/sun/javafx/webkit/prism/WCBufferedContext.java 2013-10-01 21:51:58.754401809 +0400 @@ -23,24 +23,31 @@ @Override Graphics getGraphics(boolean checkClip) { init(); + if (baseGraphics == null) { + baseGraphics = img.getGraphics(); + } return super.getGraphics(checkClip); } + @Override public void clearRect(float x, float y, float w, float h) { + if (baseGraphics != null) { + super.clearRect(x, y, w, h); + } + } + @Override public void saveState() { init(); super.saveState(); } - + + /// comment on threads goes here private void init() { if (! isInitialized) { - Graphics g = img.getGraphics(); - init(g, false); - - BaseTransform t = g.getTransformNoClone(); + BaseTransform t = PrismGraphicsManager.getPixelScaleTransform(); int w = (int) Math.ceil(img.getWidth() * t.getMxx()); int h = (int) Math.ceil(img.getHeight() * t.getMyy()); setClip(0, 0, w, h); - + initBaseTransform(t); isInitialized = true; } } --- old/modules/web/src/main/java/com/sun/javafx/webkit/prism/WCGraphicsPrismContext.java 2013-10-01 21:51:59.194404459 +0400 +++ new/modules/web/src/main/java/com/sun/javafx/webkit/prism/WCGraphicsPrismContext.java 2013-10-01 21:51:59.078403762 +0400 @@ -39,7 +39,7 @@ private final static Logger log = Logger.getLogger(WCGraphicsPrismContext.class.getName()); - private Graphics baseGraphics; + Graphics baseGraphics; private BaseTransform baseTransform; private final List states = new ArrayList(); @@ -52,20 +52,18 @@ private int fontSmoothingType; WCGraphicsPrismContext(Graphics g) { - init(g, true); + state.setClip(g.getClipRect()); + state.setAlpha(g.getExtraAlpha()); + baseGraphics = g; + initBaseTransform(g.getTransformNoClone()); } WCGraphicsPrismContext() { } - final void init(Graphics g, boolean inherit) { - if (g != null && inherit) { - state.setClip(g.getClipRect()); - state.setAlpha(g.getExtraAlpha()); - } - baseGraphics = g; - baseTransform = new Affine3D(g.getTransformNoClone()); - state.setTransform(new Affine3D(baseTransform)); + final void initBaseTransform(BaseTransform t) { + baseTransform = new Affine3D(t); + state.setTransform(new Affine3D(t)); } private void resetCachedGraphics() { @@ -277,41 +275,41 @@ //There is no rotation here: scale + translation. //Fast & easy! state.clip(transformClip(shape)); - if (log.isLoggable(Level.FINE)) { - log.log(Level.FINE, "setClip({0})", shape); - //Draw clip shape - Rectangle rc = state.getClipNoClone(); - if (rc != null && rc.width >= 2 && rc.height >= 2) { - WCTransform cur = getTransform(); - //translate to (layer.getX(), layer.getY()) - setTransform(new WCTransform( - 1.0, 0.0, - 0.0, 1.0, - 0.0, 0.0)); - - Graphics g2d = getGraphics(true); - if (g2d != null) { - float fbase = (float)Math.random(); - g2d.setPaint(new Color( - fbase, - 1f - fbase, - 0.5f, - 0.1f)); - g2d.setStroke(new BasicStroke()); - g2d.fillRect(rc.x, rc.y, rc.width, rc.height); - - g2d.setPaint(new Color( - 1f - fbase, - fbase, - 0.5f, - 1f)); - g2d.drawRect(rc.x, rc.y, rc.width, rc.height); - } - //restore transform - setTransform(cur); - state.clip(new Rectangle(rc.x+1, rc.y+1, rc.width-2, rc.height-2)); - } - } +// if (log.isLoggable(Level.FINE)) { +// log.log(Level.FINE, "setClip({0})", shape); +// //Draw clip shape +// Rectangle rc = state.getClipNoClone(); +// if (rc != null && rc.width >= 2 && rc.height >= 2) { +// WCTransform cur = getTransform(); +// //translate to (layer.getX(), layer.getY()) +// setTransform(new WCTransform( +// 1.0, 0.0, +// 0.0, 1.0, +// 0.0, 0.0)); +// +// Graphics g2d = getGraphics(true); +// if (g2d != null) { +// float fbase = (float)Math.random(); +// g2d.setPaint(new Color( +// fbase, +// 1f - fbase, +// 0.5f, +// 0.1f)); +// g2d.setStroke(new BasicStroke()); +// g2d.fillRect(rc.x, rc.y, rc.width, rc.height); +// +// g2d.setPaint(new Color( +// 1f - fbase, +// fbase, +// 0.5f, +// 1f)); +// g2d.drawRect(rc.x, rc.y, rc.width, rc.height); +// } +// //restore transform +// setTransform(cur); +// state.clip(new Rectangle(rc.x+1, rc.y+1, rc.width-2, rc.height-2)); +// } +// } if (cachedGraphics != null) { cachedGraphics.setClipRect(state.getClipNoClone()); } --- old/modules/web/src/main/native/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp 2013-10-01 21:51:59.638407133 +0400 +++ new/modules/web/src/main/native/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp 2013-10-01 21:51:59.394405666 +0400 @@ -31,7 +31,7 @@ namespace WebCore { #if PLATFORM(JAVA) -static const int s_maximumAllowedImageBufferDimension = 2048; +static const int s_maximumAllowedImageBufferDimension = 512; #else static const int s_maximumAllowedImageBufferDimension = 4096; #endif