< prev index next >
src/java.desktop/unix/classes/sun/awt/X11GraphicsConfig.java
Print this page
@@ -131,11 +131,11 @@
}
/**
* Return the graphics device associated with this configuration.
*/
- public GraphicsDevice getDevice() {
+ public X11GraphicsDevice getDevice() {
return screen;
}
/**
* Returns the visual id associated with this configuration.
@@ -254,11 +254,24 @@
* the device, with X coordinates
* increasing to the right and Y coordinates increasing downwards.
* For image buffers, this Transform will be the Identity transform.
*/
public AffineTransform getDefaultTransform() {
- return new AffineTransform();
+ double scale = getScale();
+ return AffineTransform.getScaleInstance(scale, scale);
+ }
+
+ public int getScale() {
+ return getDevice().getScaleFactor();
+ }
+
+ public int scaleUp(int x) {
+ return x * getScale();
+ }
+
+ public int scaleDown(int x) {
+ return x / getScale();
}
/**
*
* Returns a Transform that can be composed with the default Transform
@@ -306,11 +319,18 @@
static {
initIDs ();
}
public Rectangle getBounds() {
- return pGetBounds(screen.getScreen());
+ Rectangle rect = pGetBounds(screen.getScreen());
+ if (getScale() != 1) {
+ rect.x = scaleDown(rect.x);
+ rect.y = scaleDown(rect.y);
+ rect.width = scaleDown(rect.width);
+ rect.height = scaleDown(rect.height);
+ }
+ return rect;
}
private native Rectangle pGetBounds(int screenNum);
private static class XDBECapabilities extends BufferCapabilities {
< prev index next >