-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
With the following changes, the JavaFX clip benchmark fps is now
My macbook has improved to 28fps.
JavaFX's GraphicsContext implementation allocates a canvas-sized texture for each call to the clip method, making multiple calls costly. This can be confirmed with the following jvm option.
-Dprism.printallocs=true
It can be improved to a practical fps by performing clips all at once as follows.
gc.save();
gc.beginPath();
for (int y = 5; y <= height - 25; y += 25) {
for (int x = 5; x <= width - 25; x += 25) {
gc.save();
gc.translate(x, y);
gc.moveTo(10, 10);
gc.arc(10, 10, 10, 10, 0, 360);
gc.arc(10, 10, 5, 5, 0, 360);
gc.restore();
}
}
gc.clip();
gc.setFillRule(FillRule.EVEN_ODD);
for (int y = 5; y <= height - 25; y += 25) {
for (int x = 5; x <= width - 25; x += 25) {
gc.setFill(Color.color((double) x / width, 0.5 * (1 - x / width), (double) y / height));
gc.save();
gc.translate(x, y);
gc.fillRect(0, 0, 20, 20);
gc.restore();
}
}
gc.restore();In addition, specifying the following jvm option will increase by a few fps.
-Dprism.marlin.profile=speed
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels