OpenJDK / openjfx / 8u-dev / rt
changeset 7904:2f6e9cce8328
[SCENEBUILDER] merge (no conflict).
author | eric.le.ponner@oracle.com |
---|---|
date | Thu, 04 Sep 2014 09:53:27 +0200 |
parents | 7753c3b79504 613a8ae3a0f4 |
children | 618aab68827f |
files | |
diffstat | 7 files changed, 100 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/modules/fxpackager/src/test/java/com/oracle/tools/packager/mac/MacDmgBundlerTest.java Wed Sep 03 19:26:53 2014 +0200 +++ b/modules/fxpackager/src/test/java/com/oracle/tools/packager/mac/MacDmgBundlerTest.java Thu Sep 04 09:53:27 2014 +0200 @@ -67,6 +67,7 @@ static Set<File> appResources; static boolean retain = false; static boolean full_tests = false; + static boolean simple_dmg = true; @BeforeClass public static void prepareApp() { @@ -84,6 +85,7 @@ retain = Boolean.parseBoolean(System.getProperty("RETAIN_PACKAGER_TESTS")); full_tests = Boolean.parseBoolean(System.getProperty("FULL_TEST")); + simple_dmg = !retain; workDir = new File("build/tmp/tests", "macdmg"); hdpiIcon = new File("build/tmp/tests", "GenericAppHiDPI.icns"); @@ -138,9 +140,6 @@ */ @Test public void smokeTest() throws IOException, ConfigException, UnsupportedPlatformException { - // only run with full tests - Assume.assumeTrue(full_tests); - AbstractBundler bundler = new MacDmgBundler(); assertNotNull(bundler.getName()); @@ -163,6 +162,7 @@ bundleParams.put(LICENSE_FILE.getID(), Arrays.asList("LICENSE", "LICENSE2")); bundleParams.put(VERBOSE.getID(), true); bundleParams.put(SYSTEM_WIDE.getID(), false); + bundleParams.put(SIMPLE_DMG.getID(), simple_dmg); if (runtimeJdk != null) { bundleParams.put(MAC_RUNTIME.getID(), runtimeJdk); @@ -199,6 +199,7 @@ bundleParams.put(BUILD_ROOT.getID(), tmpBase); bundleParams.put(APP_RESOURCES.getID(), new RelativeFileSet(appResourcesDir, appResources)); + bundleParams.put(SIMPLE_DMG.getID(), simple_dmg); if (runtimeJdk != null) { bundleParams.put(MAC_RUNTIME.getID(), runtimeJdk); @@ -257,6 +258,7 @@ dmgBundleParams.put(APP_NAME.getID(), "External APP DMG Test"); dmgBundleParams.put(IDENTIFIER.getID(), "com.example.dmg.external"); + dmgBundleParams.put(SIMPLE_DMG.getID(), simple_dmg); dmgBundleParams.put(VERBOSE.getID(), true); if (runtimeJdk != null) { @@ -314,6 +316,7 @@ dmgBundleParams.put(APP_NAME.getID(), "External APP DMG Test"); dmgBundleParams.put(IDENTIFIER.getID(), "com.example.dmg.external"); + dmgBundleParams.put(SIMPLE_DMG.getID(), simple_dmg); dmgBundleParams.put(VERBOSE.getID(), true); if (runtimeJdk != null) {
--- a/modules/graphics/src/main/java/com/sun/javafx/sg/prism/NGCanvas.java Wed Sep 03 19:26:53 2014 +0200 +++ b/modules/graphics/src/main/java/com/sun/javafx/sg/prism/NGCanvas.java Thu Sep 04 09:53:27 2014 +0200 @@ -1648,7 +1648,9 @@ { Filterable f = PrDrawable.create(fctx, tex); Rectangle r = new Rectangle(tex.getContentWidth(), tex.getContentHeight()); + f.lock(); ImageData id = new ImageData(fctx, f, r); + id.setReusable(true); if (pixelscale != 1.0f || !transform.isIdentity()) { Affine2D a2d = new Affine2D(); a2d.scale(1.0f / pixelscale, 1.0f / pixelscale);
--- a/modules/graphics/src/main/java/com/sun/javafx/sg/prism/NGNode.java Wed Sep 03 19:26:53 2014 +0200 +++ b/modules/graphics/src/main/java/com/sun/javafx/sg/prism/NGNode.java Thu Sep 04 09:53:27 2014 +0200 @@ -2432,7 +2432,10 @@ Object renderHelper, Effect defaultInput) { - return new ImageData(fctx, img, new Rectangle(bounds)); + img.lock(); + ImageData id = new ImageData(fctx, img, new Rectangle(bounds)); + id.setReusable(true); + return id; } @Override
--- a/modules/graphics/src/main/java/com/sun/scenario/effect/impl/ImagePool.java Wed Sep 03 19:26:53 2014 +0200 +++ b/modules/graphics/src/main/java/com/sun/scenario/effect/impl/ImagePool.java Thu Sep 04 09:53:27 2014 +0200 @@ -76,10 +76,10 @@ static final int QUANT = 32; - private final List<SoftReference<Filterable>> unlocked = - new ArrayList<SoftReference<Filterable>>(); - private final List<SoftReference<Filterable>> locked = - new ArrayList<SoftReference<Filterable>>(); + private final List<SoftReference<PoolFilterable>> unlocked = + new ArrayList<SoftReference<PoolFilterable>>(); + private final List<SoftReference<PoolFilterable>> locked = + new ArrayList<SoftReference<PoolFilterable>>(); // On Canmore with the PowerVR SGX chip, there is a driver issue // that causes incorrect rendering if one tries to reuse an FBO @@ -97,8 +97,8 @@ // (where there would normally be reuse). private final boolean usePurgatory = Boolean.getBoolean("decora.purgatory"); private final List<Filterable> hardPurgatory = new ArrayList<Filterable>(); - private final List<SoftReference<Filterable>> softPurgatory = - new ArrayList<SoftReference<Filterable>>(); + private final List<SoftReference<PoolFilterable>> softPurgatory = + new ArrayList<SoftReference<PoolFilterable>>(); /** * Package-private constructor. @@ -106,7 +106,7 @@ ImagePool() { } - public synchronized Filterable checkOut(Renderer renderer, int w, int h) { + public synchronized PoolFilterable checkOut(Renderer renderer, int w, int h) { if (w <= 0 || h <= 0) { // if image is empty in any way, return a small non-empty image. w = h = 1; @@ -123,13 +123,13 @@ pixelsAccessed += ((long) w) * h; // first look for an already cached image of sufficient size, // choosing the one that is closest in size to the requested dimensions - SoftReference<Filterable> chosenEntry = null; - Filterable chosenImage = null; + SoftReference<PoolFilterable> chosenEntry = null; + PoolFilterable chosenImage = null; int mindiff = Integer.MAX_VALUE; - Iterator<SoftReference<Filterable>> entries = unlocked.iterator(); + Iterator<SoftReference<PoolFilterable>> entries = unlocked.iterator(); while (entries.hasNext()) { - SoftReference<Filterable> entry = entries.next(); - Filterable eimg = entry.get(); + SoftReference<PoolFilterable> entry = entries.next(); + PoolFilterable eimg = entry.get(); if (eimg == null) { entries.remove(); continue; @@ -170,7 +170,7 @@ // get rid of expired entries from locked list entries = locked.iterator(); while (entries.hasNext()) { - SoftReference<Filterable> entry = entries.next(); + SoftReference<PoolFilterable> entry = entries.next(); Filterable eimg = entry.get(); if (eimg == null) { entries.remove(); @@ -178,7 +178,7 @@ } // if all else fails, just create a new one... - Filterable img = null; + PoolFilterable img = null; try { img = renderer.createCompatibleImage(w, h); } catch (OutOfMemoryError e) {} @@ -191,19 +191,20 @@ } catch (OutOfMemoryError e) {} } if (img != null) { - locked.add(new SoftReference<Filterable>(img)); + img.setImagePool(this); + locked.add(new SoftReference<PoolFilterable>(img)); numCreated++; pixelsCreated += ((long) w) * h; } return img; } - public synchronized void checkIn(Filterable img) { - SoftReference<Filterable> chosenEntry = null; + public synchronized void checkIn(PoolFilterable img) { + SoftReference<PoolFilterable> chosenEntry = null; Filterable chosenImage = null; - Iterator<SoftReference<Filterable>> entries = locked.iterator(); + Iterator<SoftReference<PoolFilterable>> entries = locked.iterator(); while (entries.hasNext()) { - SoftReference<Filterable> entry = entries.next(); + SoftReference<PoolFilterable> entry = entries.next(); Filterable eimg = entry.get(); if (eimg == null) { entries.remove(); @@ -244,7 +245,7 @@ private void pruneCache() { // flush all unlocked images - for (SoftReference<Filterable> r : unlocked) { + for (SoftReference<PoolFilterable> r : unlocked) { Filterable image = r.get(); if (image != null) { image.flush(); @@ -260,7 +261,7 @@ } public synchronized void dispose() { - for (SoftReference<Filterable> r : unlocked) { + for (SoftReference<PoolFilterable> r : unlocked) { Filterable image = r.get(); if (image != null) { image.flush();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/graphics/src/main/java/com/sun/scenario/effect/impl/PoolFilterable.java Thu Sep 04 09:53:27 2014 +0200 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2014, 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 + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.scenario.effect.impl; + +import com.sun.scenario.effect.Filterable; + +public interface PoolFilterable extends Filterable { + public void setImagePool(ImagePool pool); + public ImagePool getImagePool(); +}
--- a/modules/graphics/src/main/java/com/sun/scenario/effect/impl/Renderer.java Wed Sep 03 19:26:53 2014 +0200 +++ b/modules/graphics/src/main/java/com/sun/scenario/effect/impl/Renderer.java Thu Sep 04 09:53:27 2014 +0200 @@ -110,14 +110,23 @@ public abstract int getCompatibleWidth(int w); public abstract int getCompatibleHeight(int h); - public abstract Filterable createCompatibleImage(int w, int h); + public abstract PoolFilterable createCompatibleImage(int w, int h); - public Filterable getCompatibleImage(int w, int h) { + public PoolFilterable getCompatibleImage(int w, int h) { return imagePool.checkOut(this, w, h); } public void releaseCompatibleImage(Filterable image) { - imagePool.checkIn(image); + if (image instanceof PoolFilterable) { + ImagePool pool = ((PoolFilterable) image).getImagePool(); + if (pool != null) { + pool.checkIn((PoolFilterable) image); + return; + } +// } else { + // Error? + } + image.unlock(); } /**
--- a/modules/graphics/src/main/java/com/sun/scenario/effect/impl/prism/PrDrawable.java Wed Sep 03 19:26:53 2014 +0200 +++ b/modules/graphics/src/main/java/com/sun/scenario/effect/impl/prism/PrDrawable.java Thu Sep 04 09:53:27 2014 +0200 @@ -28,11 +28,14 @@ import com.sun.prism.Graphics; import com.sun.prism.RTTexture; import com.sun.scenario.effect.FilterContext; -import com.sun.scenario.effect.Filterable; +import com.sun.scenario.effect.impl.ImagePool; +import com.sun.scenario.effect.impl.PoolFilterable; import com.sun.scenario.effect.impl.Renderer; +import java.lang.ref.WeakReference; -public abstract class PrDrawable extends PrTexture<RTTexture> implements Filterable { - +public abstract class PrDrawable extends PrTexture<RTTexture> implements PoolFilterable { + private WeakReference<ImagePool> pool; + public static PrDrawable create(FilterContext fctx, RTTexture rtt) { return ((PrRenderer) Renderer.getRenderer(fctx)).createDrawable(rtt); } @@ -41,24 +44,34 @@ super(rtt); } - public float getPixelScale() { + @Override + public void setImagePool(ImagePool pool) { + this.pool = new WeakReference<>(pool); + } + + @Override + public ImagePool getImagePool() { + return pool == null ? null : pool.get(); + } + + @Override public float getPixelScale() { return 1.0f; } @Override public int getMaxContentWidth() { - return ((RTTexture)getTextureObject()).getMaxContentWidth(); + return getTextureObject().getMaxContentWidth(); } @Override public int getMaxContentHeight() { - return ((RTTexture)getTextureObject()).getMaxContentHeight(); + return getTextureObject().getMaxContentHeight(); } @Override public void setContentWidth(int contentW) { - ((RTTexture)getTextureObject()).setContentWidth(contentW); + getTextureObject().setContentWidth(contentW); } @Override public void setContentHeight(int contentH) { - ((RTTexture)getTextureObject()).setContentHeight(contentH); + getTextureObject().setContentHeight(contentH); } public abstract Graphics createGraphics();