< prev index next >
src/java.desktop/windows/classes/sun/java2d/opengl/WGLSurfaceData.java
Print this page
@@ -35,10 +35,11 @@
import java.awt.image.ColorModel;
import sun.awt.SunToolkit;
import sun.awt.Win32GraphicsDevice;
import sun.awt.windows.WComponentPeer;
import sun.java2d.SurfaceData;
+import sun.java2d.pipe.Region;
public abstract class WGLSurfaceData extends OGLSurfaceData {
protected WComponentPeer peer;
private WGLGraphicsConfig graphicsConfig;
@@ -163,12 +164,12 @@
}
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);
+ r.width = Region.clipRound(r.width * scaleX);
+ r.height = Region.clipRound(r.height * scaleY);
return r;
}
/**
* Returns destination Component associated with this SurfaceData.
@@ -225,12 +226,12 @@
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);
+ this.width = Region.clipRound(width * scaleX);
+ this.height = Region.clipRound(height * scaleY);
offscreenImage = image;
initSurface(this.width, this.height);
}
@@ -239,12 +240,12 @@
}
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.width = Region.clipRound(r.width * scaleX);
+ r.height = Region.clipRound(r.height * scaleY);
r.x = r.y = 0;
return r;
} else {
return new Rectangle(width, height);
}
< prev index next >