< prev index next >

src/java.desktop/unix/classes/sun/java2d/xr/XRSurfaceData.java

Print this page

        

@@ -242,11 +242,12 @@
      */
     public static XRPixmapSurfaceData createData(XRGraphicsConfig gc,
                                                  int width, int height,
                                                  ColorModel cm, Image image,
                                                  long drawable,
-                                                 int transparency) {
+                                                 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,11 +266,11 @@
         }
 
         return new XRPixmapSurfaceData
             (gc, width, height, image, getSurfaceType(gc, transparency),
              cm, drawable, transparency,
-             XRUtils.getPictureFormatForTransparency(transparency), depth);
+             XRUtils.getPictureFormatForTransparency(transparency), depth, isTexture);
     }
 
     protected XRSurfaceData(X11ComponentPeer peer, XRGraphicsConfig gc,
         SurfaceType sType, ColorModel cm, int depth, int transparency)
     {

@@ -540,15 +541,20 @@
             }
         }
     }
 
     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,10 +575,12 @@
         }
 
         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,10 +602,20 @@
                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,22 +643,24 @@
     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) {
+                                   int depth, boolean isTexture) {
             super(null, gc, sType, cm, depth, transparency);
-            this.width = width;
-            this.height = height;
+            this.scale = isTexture ? 1 : gc.getDevice().getScaleFactor();
+            this.width = width * scale;
+            this.height = height * scale;
             offscreenImage = image;
             this.transparency = transparency;
-            initSurface(depth, width, height, drawable, pictFormat);
+            initSurface(depth, this.width, this.height, drawable, pictFormat);
 
             initXRender(pictFormat);
             makePipes();
         }
 

@@ -694,10 +714,20 @@
          * 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 >