< prev index next >
src/java.desktop/unix/classes/sun/java2d/opengl/GLXSurfaceData.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2003, 2015, 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
--- 1,7 ----
/*
! * Copyright (c) 2003, 2017, 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
*** 110,142 ****
--- 110,156 ----
return (GLXGraphicsConfig)gd.getDefaultConfiguration();
}
}
public static class GLXWindowSurfaceData extends GLXSurfaceData {
+ protected final int scale;
public GLXWindowSurfaceData(X11ComponentPeer peer,
GLXGraphicsConfig gc)
{
super(peer, gc, peer.getColorModel(), WINDOW);
+ scale = gc.getScale();
}
public SurfaceData getReplacement() {
return peer.getSurfaceData();
}
public Rectangle getBounds() {
Rectangle r = peer.getBounds();
r.x = r.y = 0;
+ r.width = (int) Math.ceil(r.width * scale);
+ r.height = (int) Math.ceil(r.height * scale);
return r;
}
/**
* Returns destination Component associated with this SurfaceData.
*/
public Object getDestination() {
return peer.getTarget();
}
+
+ @Override
+ public double getDefaultScaleX() {
+ return scale;
+ }
+
+ @Override
+ public double getDefaultScaleY() {
+ return scale;
+ }
}
/**
* A surface which implements a v-synced flip back-buffer with COPIED
* FlipContents.
*** 175,208 ****
public static class GLXOffScreenSurfaceData extends GLXSurfaceData {
private Image offscreenImage;
private int width, height;
public GLXOffScreenSurfaceData(X11ComponentPeer peer,
GLXGraphicsConfig gc,
int width, int height,
Image image, ColorModel cm,
int type)
{
super(peer, gc, cm, type);
! this.width = width;
! this.height = height;
offscreenImage = image;
! initSurface(width, height);
}
public SurfaceData getReplacement() {
return restoreContents(offscreenImage);
}
public Rectangle getBounds() {
if (type == FLIP_BACKBUFFER) {
Rectangle r = peer.getBounds();
r.x = r.y = 0;
return r;
} else {
return new Rectangle(width, height);
}
}
--- 189,226 ----
public static class GLXOffScreenSurfaceData extends GLXSurfaceData {
private Image offscreenImage;
private int width, height;
+ private final int scale;
public GLXOffScreenSurfaceData(X11ComponentPeer peer,
GLXGraphicsConfig gc,
int width, int height,
Image image, ColorModel cm,
int type)
{
super(peer, gc, cm, type);
! scale = gc.getDevice().getScaleFactor();
! this.width = width * scale;
! this.height = height * scale;
offscreenImage = image;
! initSurface(this.width, this.height);
}
public SurfaceData getReplacement() {
return restoreContents(offscreenImage);
}
public Rectangle getBounds() {
if (type == FLIP_BACKBUFFER) {
Rectangle r = peer.getBounds();
r.x = r.y = 0;
+ r.width = (int) Math.ceil(r.width * scale);
+ r.height = (int) Math.ceil(r.height * scale);
return r;
} else {
return new Rectangle(width, height);
}
}
*** 211,217 ****
--- 229,245 ----
* Returns destination Image associated with this SurfaceData.
*/
public Object getDestination() {
return offscreenImage;
}
+
+ @Override
+ public double getDefaultScaleX() {
+ return scale;
+ }
+
+ @Override
+ public double getDefaultScaleY() {
+ return scale;
+ }
}
}
< prev index next >