Closed samreid closed 4 years ago
Same error occurring in Fluid Pressure and Flow (but not Under Pressure)
I fixed battery voltage with this patch:
Index: simulations-java/simulations/battery-voltage/src/edu/colorado/phet/batteryvoltage/common/electron/paint/ImageUtils.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- simulations-java/simulations/battery-voltage/src/edu/colorado/phet/batteryvoltage/common/electron/paint/ImageUtils.java (revision 75120)
+++ simulations-java/simulations/battery-voltage/src/edu/colorado/phet/batteryvoltage/common/electron/paint/ImageUtils.java (date 1585800674970)
@@ -1,6 +1,7 @@
// Copyright 2002-2011, University of Colorado
package edu.colorado.phet.batteryvoltage.common.electron.paint;
+import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
@@ -20,9 +21,24 @@
}
public static BufferedImage scale( BufferedImage root, double scaleX, double scaleY ) {
- AffineTransformOp ato = new AffineTransformOp( AffineTransform.getScaleInstance( scaleX, scaleY ), AffineTransformOp.TYPE_BILINEAR );
- BufferedImage out = ato.filter( root, null );
- return out;
+
+// https://stackoverflow.com/questions/19506927/how-to-get-scaled-instance-of-a-bufferedimage
+ Image toolkitImage = root.getScaledInstance((int)(root.getWidth()*scaleX), (int)(root.getHeight()*scaleY),
+ Image.SCALE_DEFAULT);
+ int width = toolkitImage.getWidth(null);
+ int height = toolkitImage.getHeight(null);
+
+// width and height are of the toolkit image
+ BufferedImage newImage = new BufferedImage(width, height,BufferedImage.TYPE_INT_ARGB);
+ Graphics g = newImage.getGraphics();
+ g.drawImage(toolkitImage, 0, 0, null);
+ g.dispose();
+
+ return newImage;
+
+// AffineTransformOp ato = new AffineTransformOp( AffineTransform.getScaleInstance( scaleX, scaleY ), AffineTransformOp.TYPE_BILINEAR );
+// BufferedImage out = ato.filter( root, null );
+// return out;
}
}
Committed the fix for "battery voltage" to the branch in https://phet.unfuddle.com/a#/repositories/23262/commit?commit=75121.
You can set a breakpoint in AffineTransformOp constructors, by navigating to the class in IDEA then clicking the gutter. Using this strategy, I identified that the only point in Moving Man that uses AffineTransformOp is code that horizontally flips and rotates a slider thumb icon, and the image of the moving man person. We could likely work around this with little trouble.
Seeing this issue in https://phet-dev.colorado.edu/decaf/greenhouse/1.0.0-dev.2/.
Seeing this issue in https://phet-dev.colorado.edu/decaf/mri/1.0.0-dev.2/.
See this issue in https://phet-dev.colorado.edu/decaf/plate-tectonics/1.0.0-dev.2/.
I think I'm seeing this issue in https://phet-dev.colorado.edu/decaf/discharge-lamps/1.0.0-dev.2/. I can tether iPad if necessary.
I think I'm seeing this issue in https://phet-dev.colorado.edu/decaf/soluble-salts/1.0.0-dev.2/. I can tether iPad if necessary.
This problem affects around 14 sims (listed in the issue description). For cases like flipping horizontally or vertically, it would be easy to fix this with new Java code or flipped assets. For cases that perform a rotation, this would be substantially more complicated (than flips) in Java code. I don't know how many cases are doing a flip vs a rotation (but Moving Man just uses flips). Potential next steps for this issue:
@kathy-phet how do you recommend to proceed?
Since this impacts so many simulations, can you please report this issue to Stefano and see if they can fix it.
I reported this issue to CheerpJ.
The commit points to a runtime with a fix for AffineTransformOp.filter. Moving man launches and runs without a problem.
Next step for this issue is to redeploy all the affected sims.
For the publications, I'll use SVN 75120 and chipper f907d6195e39579e4d0dd6d92428b84c2ad3eb8c and decaf (before builds) 719f53019353451f135a39bda458209e5cb79dd4.
decaf after builds is 1833460361c5ad6e66e8ccc6a3211d22d89b092c
For the sims identified in this issue:
battery-voltage
discharge-lamps (fails with other problem)
fluid-pressure-and-flow
greenhouse
lasers
motion-series (has scala complication)
moving-man
mri
optical-tweezers
photoelectric
plate-tectonics (won't launch on mac, cheerpj problem is olorado4phet9lwjgleLGaalGoda_1b26LWJGLStartupImplemeng4JY7is6)
reactions-and-rates
soluble-salts
@KatieWoe can you check that I didn't miss any?
https://phet-dev.colorado.edu/decaf/battery-voltage/1.0.0-dev.3/index.html https://phet-dev.colorado.edu/decaf/fluid-pressure-and-flow/1.0.0-dev.4/index.html?simulation=fluid-pressure-and-flow https://phet-dev.colorado.edu/decaf/greenhouse/1.0.0-dev.3/index.html https://phet-dev.colorado.edu/decaf/lasers/1.0.0-dev.3/index.html https://phet-dev.colorado.edu/decaf/moving-man/1.0.0-dev.3/index.html https://phet-dev.colorado.edu/decaf/mri/1.0.0-dev.3/index.html
https://phet-dev.colorado.edu/decaf/optical-tweezers/1.0.0-dev.4/index.html?simulation=optical-tweezers https://phet-dev.colorado.edu/decaf/optical-tweezers/1.0.0-dev.4/index.html?simulation=stretching-dna https://phet-dev.colorado.edu/decaf/optical-tweezers/1.0.0-dev.4/index.html?simulation=molecular-motors
https://phet-dev.colorado.edu/decaf/photoelectric/1.0.0-dev.3/index.html https://phet-dev.colorado.edu/decaf/reactions-and-rates/1.0.0-dev.3/index.html https://phet-dev.colorado.edu/decaf/soluble-salts/1.0.0-dev.3/index.html
Discharge lamps fails with
Error: this should be unreachable
at jnaBq (jni.js:1)
at /main/decaf/html/wasm-function[2230]:0xdf0a5
at /main/decaf/html/wasm-function[2231]:0xdf12e
at _Java_sun_awt_image_ImagingLib_convolveBI (jni.js:1)
at _c4pbM_8nG1uocdGbrnTidabrgDjsqnTGttLZsfXMOho (rt.jar.sun.awt.image.js:399)
at _c4pbM_8nG1uocdGbrnTidabr2CjsGEbYYerKxnn (rt.jar.sun.awt.image.js:407)
at N4java3awt5image10ConvolveOp._h4_33awt5image10ConvolveOp6filterE4 (rt.jar.java.awt.image.js:21)
at _c4V_3edu8colorado4phet14dischargelamps4view21HeatingElementGraphicuxRlrm9HSmrermiYayq4vd (discharge-lamps_all.jar.js:3581)
at _c4V_3edu8colorado4phet14dischargelamps4view21HeatingElementGraphicwxZprW8qebmrfrWDa0yqm4zd (discharge-lamps_all.jar.js:3581)
at _c4pbMJatyk$jWesfHjX0HZGMGaHKKtKiZZYostLJcbT3n (rt.jar.sun.reflect.js:654)
Motion series fails to build with:
error: error while loading JComponent, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre/lib/rt.jar(javax/swing/JComponent.class)' is broken
(bad constant pool tag 18 at byte 2001)
error: error while loading CharSequence, class file '/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre/lib/rt.jar(java/lang/CharSequence.class)' is broken
(bad constant pool tag 18 at byte 10)
/Users/samreid/phet-svn-trunk-2020/simulations-java/common/scala-common/scala-src/edu/colorado/phet/scalacommon/CenteredBoxStrategy.scala:39: error: value getWidth is not a member of javax.swing.JComponent
if ( canvas.getWidth > 0 && canvas.getHeight > 0 ) {
...
Plate tectonics is a missing LWJGL problem.
@samreid it looks like some were missed. Reversible Reactions and Sound have the issue. Glaciers doesn't load on Mac at least, it does on Windows (it doesn't load in Mac on java) and it may need more intense look at platforms. Above, Plate Tectonics is only mentioned for Mac, but it also doesn't work on Windows.
These sims were republished in https://github.com/phetsims/decaf/issues/79 and we can discuss testing them in https://github.com/phetsims/QA/issues/495 and https://github.com/phetsims/QA/issues/497
@KatieWoe can this issue be closed or priority reduced?
I would say it can be closed if https://github.com/phetsims/decaf/issues/9#issuecomment-616777373 was addressed. Otherwise it is up to you and if you want this issue for tracking. Same for priority.
Reversible Reactions and Sound have the issue. Glaciers doesn't load on Mac at least, it does on Windows (it doesn't load in Mac on java) and it may need more intense look at platforms. Above, Plate Tectonics is only mentioned for Mac, but it also doesn't work on Windows.
Reversible Reactions, and Glaciers were published in https://github.com/phetsims/decaf/issues/79
Sound and plate tectonics have native code failures at runtime.
This bug is present in: