modules/graphics/src/main/java/com/sun/glass/ui/Pixels.java

Print this page

        

@@ -78,11 +78,12 @@
 
     // The following fields are safe to be protected, since they are final
     protected final ByteBuffer bytes;
     protected final IntBuffer ints;
 
-    private final float scale;
+    private final float scalex;
+    private final float scaley;
 
     protected Pixels(final int width, final int height, final ByteBuffer pixels) {
         this.width = width;
         this.height = height;
         this.bytesPerComponent = 1;

@@ -90,11 +91,12 @@
         if ((this.width <= 0) || (this.height <= 0) || ((this.width * this.height * 4) > this.bytes.capacity())) {
             throw new IllegalArgumentException("Too small byte buffer size "+this.width+"x"+this.height+" ["+(this.width*this.height*4)+"] > "+this.bytes.capacity());
         }
 
         this.ints = null;
-        this.scale = 1.0f;
+        this.scalex = 1.0f;
+        this.scaley = 1.0f;
     }
 
     protected Pixels(final int width, final int height, IntBuffer pixels) {
         this.width = width;
         this.height = height;

@@ -103,33 +105,44 @@
         if ((this.width <= 0) || (this.height <= 0) || ((this.width * this.height) > this.ints.capacity())) {
             throw new IllegalArgumentException("Too small int buffer size "+this.width+"x"+this.height+" ["+(this.width*this.height)+"] > "+this.ints.capacity());
         }
 
         this.bytes = null;
-        this.scale = 1.0f;
+        this.scalex = 1.0f;
+        this.scaley = 1.0f;
     }
 
-    protected Pixels(final int width, final int height, IntBuffer pixels, float scale) {
+    protected Pixels(final int width, final int height, IntBuffer pixels, float scalex, float scaley) {
         this.width = width;
         this.height = height;
         this.bytesPerComponent = 4;
         this.ints = pixels.slice();
         if ((this.width <= 0) || (this.height <= 0) || ((this.width * this.height) > this.ints.capacity())) {
             throw new IllegalArgumentException("Too small int buffer size "+this.width+"x"+this.height+" ["+(this.width*this.height)+"] > "+this.ints.capacity());
         }
 
         this.bytes = null;
-        this.scale = scale;
+        this.scalex = scalex;
+        this.scaley = scaley;
     }
 
-    public final float getScale() {
+    public final float getScaleX() {
         Application.checkEventThread();
-        return this.scale;
+        return this.scalex;
     }
 
-    public final float getScaleUnsafe() {
-        return this.scale;
+    public final float getScaleY() {
+        Application.checkEventThread();
+        return this.scaley;
+    }
+
+    public final float getScaleXUnsafe() {
+        return this.scalex;
+    }
+
+    public final float getScaleYUnsafe() {
+        return this.scaley;
     }
 
     public final int getWidth() {
         Application.checkEventThread();
         return this.width;