< prev index next >

src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java

Print this page

        

*** 29,64 **** --- 29,81 ---- import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Image; import java.awt.Rectangle; + import java.awt.geom.AffineTransform; import java.awt.image.ColorModel; import sun.awt.SunToolkit; + import sun.awt.Win32GraphicsDevice; import sun.awt.windows.WComponentPeer; import sun.java2d.SurfaceData; public abstract class WGLSurfaceData extends OGLSurfaceData { protected WComponentPeer peer; private WGLGraphicsConfig graphicsConfig; + protected double scaleX = 1; + protected double scaleY = 1; private native void initOps(long pConfigInfo, WComponentPeer peer, long hwnd); protected WGLSurfaceData(WComponentPeer peer, WGLGraphicsConfig gc, ColorModel cm, int type) { super(gc, cm, type); this.peer = peer; this.graphicsConfig = gc; + Win32GraphicsDevice device = gc.getDevice(); + this.scaleX = type == TEXTURE ? 1 : device.getDefaultScaleX(); + this.scaleY = type == TEXTURE ? 1 : device.getDefaultScaleY(); long pConfigInfo = gc.getNativeConfigInfo(); long hwnd = peer != null ? peer.getHWnd() : 0L; initOps(pConfigInfo, peer, hwnd); } + @Override + public double getDefaultScaleX() { + return scaleX; + } + + @Override + public double getDefaultScaleY() { + return scaleY; + } + public GraphicsConfiguration getDeviceConfiguration() { return graphicsConfig; } /**
*** 146,155 **** --- 163,174 ---- } public Rectangle getBounds() { Rectangle r = peer.getBounds(); r.x = r.y = 0; + r.width = (int) Math.ceil(r.width * scaleX); + r.height = (int) Math.ceil(r.height * scaleY); return r; } /** * Returns destination Component associated with this SurfaceData.
*** 206,229 **** 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); } --- 225,250 ---- Image image, ColorModel cm, int type) { super(peer, gc, cm, type); ! this.width = (int) Math.ceil(width * scaleX); ! this.height = (int) Math.ceil(height * scaleY); 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.width = (int) Math.ceil(r.width * scaleX); + r.height = (int) Math.ceil(r.height * scaleY); r.x = r.y = 0; return r; } else { return new Rectangle(width, height); }
< prev index next >