Try running the following program with the attached 1x10240 pixel image:
public class LargeImagePatternTest extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
Image image = new Image("file:test.png");
ImagePattern imagePattern = new ImagePattern(
image,
0, 128,
1, 10240,
false);
Rectangle rectangle = new Rectangle(100, 100, 300, 300);
rectangle.setFill(imagePattern);
Group root = new Group();
root.getChildren().add(rectangle);
stage.setScene(new Scene(root));
stage.sizeToScene();
stage.show();
}
}
On Mac OS 10.6, the program dumps the following exception:
java.lang.RuntimeException: Requested texture dimensions (1x10240) require dimensions (1x0) that exceed maximum texture size (8192)
at com.sun.prism.es2n.ES2NTexture.create(ES2NTexture.java:140)
at com.sun.prism.es2n.ES2NResourceFactory.createTexture(ES2NResourceFactory.java:43)
at com.sun.prism.impl.BaseResourceFactory.createTexture(BaseResourceFactory.java:127)
at com.sun.prism.impl.BaseResourceFactory.getCachedTexture(BaseResourceFactory.java:100)
at com.sun.prism.impl.BaseResourceFactory.getCachedTexture(BaseResourceFactory.java:90)
at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:358)
at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:293)
at com.sun.prism.impl.ps.BaseShaderGraphics.fillQuad(BaseShaderGraphics.java:804)
at com.sun.prism.impl.shape.BasicRoundRectRep.fillRoundRect(BasicRoundRectRep.java:38)
at com.sun.prism.impl.shape.BasicRoundRectRep.fill(BasicRoundRectRep.java:24)
at com.sun.javafx.sg.prism.NGShape.renderContent(NGShape.java:185)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1133)
at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1133)
at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:117)
at com.sun.javafx.tk.quantum.AbstractPainter.paintImpl(AbstractPainter.java:181)
at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:73)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at com.sun.prism.render.RenderJob.run(RenderJob.java:37)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:96)
at java.lang.Thread.run(Thread.java:680)
On Windows 7, the exception is:
java.lang.NullPointerException
at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:359)
at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:293)
at com.sun.prism.impl.ps.BaseShaderGraphics.fillQuad(BaseShaderGraphics.java:804)
at com.sun.prism.impl.shape.BasicRoundRectRep.fillRoundRect(BasicRoundRectRep.java:38)
at com.sun.prism.impl.shape.BasicRoundRectRep.fill(BasicRoundRectRep.java:24)
at com.sun.javafx.sg.prism.NGShape.renderContent(NGShape.java:185)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1133)
at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1133)
at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:117)
at com.sun.javafx.tk.quantum.AbstractPainter.paintImpl(AbstractPainter.java:181)
at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:73)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at com.sun.prism.render.RenderJob.run(RenderJob.java:37)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:96)
at java.lang.Thread.run(Thread.java:662)
Note that WebView, whose pattern rendering is also based on com.sun.prism.paint.ImagePattern, is hitting the same problem, see RT-21884. Although it seems to be possible to fix RT-21884 by carefully adjusting the pattern sub-image and anchor rectangle before passing them to Prism, it is probably desirable to fix the problem in one place, that is, inside Prism.
public class LargeImagePatternTest extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
Image image = new Image("file:test.png");
ImagePattern imagePattern = new ImagePattern(
image,
0, 128,
1, 10240,
false);
Rectangle rectangle = new Rectangle(100, 100, 300, 300);
rectangle.setFill(imagePattern);
Group root = new Group();
root.getChildren().add(rectangle);
stage.setScene(new Scene(root));
stage.sizeToScene();
stage.show();
}
}
On Mac OS 10.6, the program dumps the following exception:
java.lang.RuntimeException: Requested texture dimensions (1x10240) require dimensions (1x0) that exceed maximum texture size (8192)
at com.sun.prism.es2n.ES2NTexture.create(ES2NTexture.java:140)
at com.sun.prism.es2n.ES2NResourceFactory.createTexture(ES2NResourceFactory.java:43)
at com.sun.prism.impl.BaseResourceFactory.createTexture(BaseResourceFactory.java:127)
at com.sun.prism.impl.BaseResourceFactory.getCachedTexture(BaseResourceFactory.java:100)
at com.sun.prism.impl.BaseResourceFactory.getCachedTexture(BaseResourceFactory.java:90)
at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:358)
at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:293)
at com.sun.prism.impl.ps.BaseShaderGraphics.fillQuad(BaseShaderGraphics.java:804)
at com.sun.prism.impl.shape.BasicRoundRectRep.fillRoundRect(BasicRoundRectRep.java:38)
at com.sun.prism.impl.shape.BasicRoundRectRep.fill(BasicRoundRectRep.java:24)
at com.sun.javafx.sg.prism.NGShape.renderContent(NGShape.java:185)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1133)
at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1133)
at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:117)
at com.sun.javafx.tk.quantum.AbstractPainter.paintImpl(AbstractPainter.java:181)
at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:73)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at com.sun.prism.render.RenderJob.run(RenderJob.java:37)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:96)
at java.lang.Thread.run(Thread.java:680)
On Windows 7, the exception is:
java.lang.NullPointerException
at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:359)
at com.sun.prism.impl.ps.BaseShaderContext.validatePaintOp(BaseShaderContext.java:293)
at com.sun.prism.impl.ps.BaseShaderGraphics.fillQuad(BaseShaderGraphics.java:804)
at com.sun.prism.impl.shape.BasicRoundRectRep.fillRoundRect(BasicRoundRectRep.java:38)
at com.sun.prism.impl.shape.BasicRoundRectRep.fill(BasicRoundRectRep.java:24)
at com.sun.javafx.sg.prism.NGShape.renderContent(NGShape.java:185)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1133)
at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1133)
at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:117)
at com.sun.javafx.tk.quantum.AbstractPainter.paintImpl(AbstractPainter.java:181)
at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:73)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at com.sun.prism.render.RenderJob.run(RenderJob.java:37)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:96)
at java.lang.Thread.run(Thread.java:662)
Note that WebView, whose pattern rendering is also based on com.sun.prism.paint.ImagePattern, is hitting the same problem, see RT-21884. Although it seems to be possible to fix RT-21884 by carefully adjusting the pattern sub-image and anchor rectangle before passing them to Prism, it is probably desirable to fix the problem in one place, that is, inside Prism.
- blocks
-
JDK-8089686 WebView error with these 2 sites created using vbscript/asp
- Open
-
JDK-8089976 Exception while allocating a large texture
- Open
- relates to
-
JDK-8177629 Prism: ES2RTTexture.create() RuntimeException: Requested texture dimensions ... exceed maximum texture size
- Open