Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EmulGL Offscreen HiDPI chart are not HiDPI #225

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions jzy3d-jGL/jzy3d-jGL-awt/src/main/java/jgl/wt/awt/GL.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
import java.awt.image.ImageObserver;
import java.awt.image.MemoryImageSource;
import java.awt.image.RenderedImage;

import org.apache.log4j.Logger;
import jgl.ImageToDraw;
import jgl.TextToDraw;
import jgl.context.gl_util;

public final class GL extends jgl.GL<BufferedImage, Font> {

Logger log = Logger.getLogger(GL.class);

protected Component canvas;
protected BufferedImage glImage;
protected boolean renderedOnce = false;
Expand Down Expand Up @@ -117,8 +118,12 @@ public BufferedImage getRenderedImage() {
public void applyViewport() {

// Update pixel scale to guess if HiDPI
if(canvas != null && canvas.getGraphics() != null)
if(canvas != null) {
if(canvas.getGraphics() != null)
updatePixelScale(canvas.getGraphics());
else
log.warn("Graphics is null, can't detect pixel scale");
}
super.applyViewport();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public static void main(String[] args) {
//Chart c = new ITTest_Colorbar().whenColorbar_HasMininumWidth(WT.EmulGL_AWT, HiDPI.ON);
//Chart c = new ITTest_Colorbar().whenColorbar_HasMininumWidth(WT.EmulGL_AWT, HiDPI.OFF);
open(new ITTest_Colorbar().whenColorbar_IsModifiedByCustomFont(WT.EmulGL_AWT, HiDPI.ON));
open(new ITTest_Colorbar().whenColorbar_IsModifiedByCustomFont(WT.EmulGL_AWT, HiDPI.ON));
}

/* ************************************************************************************************** */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import org.jzy3d.utils.LoggerUtils;

public class ITTest_Scatter extends ITTest{
public static void main(String[] args) {
new ITTest_Scatter().whenScatterChart_ThenMatchBaselineImagePixelwise(WT.EmulGL_AWT, HiDPI.ON);

}

@Test
public void whenScatterChart_ThenMatchBaselineImagePixelwise() {
LoggerUtils.minimal();
Expand Down