modules/graphics/src/main/java/com/sun/glass/ui/Pixels.java
Print this page
*** 78,88 ****
// The following fields are safe to be protected, since they are final
protected final ByteBuffer bytes;
protected final IntBuffer ints;
! private final float scale;
protected Pixels(final int width, final int height, final ByteBuffer pixels) {
this.width = width;
this.height = height;
this.bytesPerComponent = 1;
--- 78,89 ----
// The following fields are safe to be protected, since they are final
protected final ByteBuffer bytes;
protected final IntBuffer ints;
! 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,100 ****
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;
}
protected Pixels(final int width, final int height, IntBuffer pixels) {
this.width = width;
this.height = height;
--- 91,102 ----
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.scalex = 1.0f;
! this.scaley = 1.0f;
}
protected Pixels(final int width, final int height, IntBuffer pixels) {
this.width = width;
this.height = height;
*** 103,135 ****
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;
}
! protected Pixels(final int width, final int height, IntBuffer pixels, float scale) {
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;
}
! public final float getScale() {
Application.checkEventThread();
! return this.scale;
}
! public final float getScaleUnsafe() {
! return this.scale;
}
public final int getWidth() {
Application.checkEventThread();
return this.width;
--- 105,148 ----
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.scalex = 1.0f;
! this.scaley = 1.0f;
}
! 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.scalex = scalex;
! this.scaley = scaley;
}
! public final float getScaleX() {
Application.checkEventThread();
! return this.scalex;
}
! 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;