modules/graphics/src/main/java/com/sun/glass/ui/lens/LensPixels.java

Print this page




  23  * questions.
  24  */
  25 
  26 package com.sun.glass.ui.lens;
  27 
  28 import com.sun.glass.ui.Pixels;
  29 import java.nio.Buffer;
  30 import java.nio.ByteBuffer;
  31 import java.nio.IntBuffer;
  32 
  33 final class LensPixels extends Pixels {
  34 
  35     protected LensPixels(int width, int height, ByteBuffer data) {
  36         super(width, height, data);
  37     }
  38 
  39     protected LensPixels(int width, int height, IntBuffer data) {
  40         super(width, height, data);
  41     }
  42 
  43     protected LensPixels(int width, int height, IntBuffer data, float scale) {
  44         super(width, height, data, scale);
  45     }
  46 
  47     static int getNativeFormat_impl() {
  48         LensLogger.getLogger().config("Querying native format");
  49         // All our implementations use ARGB_PRE and convert to the native pixel
  50         // format when we push pixels to the screen.
  51         return Pixels.Format.BYTE_BGRA_PRE;
  52     }
  53 
  54     private native void _copyPixels(Buffer dst, Buffer src, int size);
  55 
  56     @Override protected void _fillDirectByteBuffer(ByteBuffer bb) {
  57         if (this.bytes != null) {
  58             this.bytes.rewind();
  59             if (this.bytes.isDirect()) {
  60                 _copyPixels(bb, this.bytes, getWidth() * getHeight());
  61             } else {
  62                 bb.put(this.bytes);
  63             }
  64             this.bytes.rewind();




  23  * questions.
  24  */
  25 
  26 package com.sun.glass.ui.lens;
  27 
  28 import com.sun.glass.ui.Pixels;
  29 import java.nio.Buffer;
  30 import java.nio.ByteBuffer;
  31 import java.nio.IntBuffer;
  32 
  33 final class LensPixels extends Pixels {
  34 
  35     protected LensPixels(int width, int height, ByteBuffer data) {
  36         super(width, height, data);
  37     }
  38 
  39     protected LensPixels(int width, int height, IntBuffer data) {
  40         super(width, height, data);
  41     }
  42 
  43     protected LensPixels(int width, int height, IntBuffer data, float scalex, float scaley) {
  44         super(width, height, data, scalex, scaley);
  45     }
  46 
  47     static int getNativeFormat_impl() {
  48         LensLogger.getLogger().config("Querying native format");
  49         // All our implementations use ARGB_PRE and convert to the native pixel
  50         // format when we push pixels to the screen.
  51         return Pixels.Format.BYTE_BGRA_PRE;
  52     }
  53 
  54     private native void _copyPixels(Buffer dst, Buffer src, int size);
  55 
  56     @Override protected void _fillDirectByteBuffer(ByteBuffer bb) {
  57         if (this.bytes != null) {
  58             this.bytes.rewind();
  59             if (this.bytes.isDirect()) {
  60                 _copyPixels(bb, this.bytes, getWidth() * getHeight());
  61             } else {
  62                 bb.put(this.bytes);
  63             }
  64             this.bytes.rewind();