< prev index next >
src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceData.java
Print this page
*** 242,252 ****
*/
public static XRPixmapSurfaceData createData(XRGraphicsConfig gc,
int width, int height,
ColorModel cm, Image image,
long drawable,
! int transparency) {
int depth;
// If we have a 32 bit color model for the window it needs
// alpha to support translucency of the window so we need
// to upgrade what was requested for the surface.
if (gc.getColorModel().getPixelSize() == 32) {
--- 242,253 ----
*/
public static XRPixmapSurfaceData createData(XRGraphicsConfig gc,
int width, int height,
ColorModel cm, Image image,
long drawable,
! int transparency,
! boolean isTexture) {
int depth;
// If we have a 32 bit color model for the window it needs
// alpha to support translucency of the window so we need
// to upgrade what was requested for the surface.
if (gc.getColorModel().getPixelSize() == 32) {
*** 265,275 ****
}
return new XRPixmapSurfaceData
(gc, width, height, image, getSurfaceType(gc, transparency),
cm, drawable, transparency,
! XRUtils.getPictureFormatForTransparency(transparency), depth);
}
protected XRSurfaceData(X11ComponentPeer peer, XRGraphicsConfig gc,
SurfaceType sType, ColorModel cm, int depth, int transparency)
{
--- 266,276 ----
}
return new XRPixmapSurfaceData
(gc, width, height, image, getSurfaceType(gc, transparency),
cm, drawable, transparency,
! XRUtils.getPictureFormatForTransparency(transparency), depth, isTexture);
}
protected XRSurfaceData(X11ComponentPeer peer, XRGraphicsConfig gc,
SurfaceType sType, ColorModel cm, int depth, int transparency)
{
*** 540,554 ****
--- 541,560 ----
}
}
}
public static class XRWindowSurfaceData extends XRSurfaceData {
+
+ protected final int scale;
+
public XRWindowSurfaceData(X11ComponentPeer peer,
XRGraphicsConfig gc, SurfaceType sType) {
super(peer, gc, sType, peer.getColorModel(),
peer.getColorModel().getPixelSize(), Transparency.OPAQUE);
+ this.scale = gc.getScale();
+
if (isXRDrawableValid()) {
// If we have a 32 bit color model for the window it needs
// alpha to support translucency of the window so we need
// to get the ARGB32 XRender picture format else for
// 24 bit colormodel we need RGB24 or OPAQUE pictureformat.
*** 569,578 ****
--- 575,586 ----
}
public Rectangle getBounds() {
Rectangle r = peer.getBounds();
r.x = r.y = 0;
+ r.width *= scale;
+ r.height *= scale;
return r;
}
@Override
public boolean canSourceSendExposures(int x, int y, int w, int h) {
*** 594,603 ****
--- 602,621 ----
SunToolkit.awtUnlock();
}
super.invalidate();
}
+
+ @Override
+ public double getDefaultScaleX() {
+ return scale;
+ }
+
+ @Override
+ public double getDefaultScaleY() {
+ return scale;
+ }
}
public static class XRInternalSurfaceData extends XRSurfaceData {
public XRInternalSurfaceData(XRBackend renderQueue, int pictXid) {
super(renderQueue);
*** 625,646 ****
public static class XRPixmapSurfaceData extends XRSurfaceData {
Image offscreenImage;
int width;
int height;
int transparency;
public XRPixmapSurfaceData(XRGraphicsConfig gc, int width, int height,
Image image, SurfaceType sType,
ColorModel cm, long drawable,
int transparency, int pictFormat,
! int depth) {
super(null, gc, sType, cm, depth, transparency);
! this.width = width;
! this.height = height;
offscreenImage = image;
this.transparency = transparency;
! initSurface(depth, width, height, drawable, pictFormat);
initXRender(pictFormat);
makePipes();
}
--- 643,666 ----
public static class XRPixmapSurfaceData extends XRSurfaceData {
Image offscreenImage;
int width;
int height;
int transparency;
+ private final int scale;
public XRPixmapSurfaceData(XRGraphicsConfig gc, int width, int height,
Image image, SurfaceType sType,
ColorModel cm, long drawable,
int transparency, int pictFormat,
! int depth, boolean isTexture) {
super(null, gc, sType, cm, depth, transparency);
! this.scale = isTexture ? 1 : gc.getDevice().getScaleFactor();
! this.width = width * scale;
! this.height = height * scale;
offscreenImage = image;
this.transparency = transparency;
! initSurface(depth, this.width, this.height, drawable, pictFormat);
initXRender(pictFormat);
makePipes();
}
*** 694,703 ****
--- 714,733 ----
* Returns destination Image associated with this SurfaceData.
*/
public Object getDestination() {
return offscreenImage;
}
+
+ @Override
+ public double getDefaultScaleX() {
+ return scale;
+ }
+
+ @Override
+ public double getDefaultScaleY() {
+ return scale;
+ }
}
public long getGC() {
return xgc;
}
< prev index next >