modules/graphics/src/main/java/com/sun/glass/ui/mac/MacPixels.java

Print this page




  40 
  41     private native static int _initIDs(); // returns the native format
  42     static {
  43         nativeFormat = _initIDs();
  44     }
  45 
  46     private static final int nativeFormat;
  47 
  48     static int getNativeFormat_impl() {
  49         return nativeFormat;
  50     }
  51 
  52     protected MacPixels(int width, int height, ByteBuffer data) {
  53         super(width, height, data);
  54     }
  55 
  56     protected MacPixels(int width, int height, IntBuffer data) {
  57         super(width, height, data);
  58     }
  59 
  60     protected MacPixels(int width, int height, IntBuffer data, float scale) {
  61         super(width, height, data, scale);
  62     }
  63 
  64     @Override
  65     protected void _fillDirectByteBuffer(ByteBuffer bb) {
  66         if (this.bytes != null) {
  67             this.bytes.rewind();
  68             if (this.bytes.isDirect() == true) {
  69                 _copyPixels(bb, this.bytes, getWidth()*getHeight());
  70             } else {
  71                 bb.put(this.bytes);
  72             }
  73             this.bytes.rewind();
  74         } else {
  75             this.ints.rewind();
  76             if (this.ints.isDirect() == true) {
  77                 _copyPixels(bb, this.ints, getWidth()*getHeight());
  78             } else {
  79                 for (int i=0; i<this.ints.capacity(); i++) {
  80                     int data = this.ints.get();
  81                     bb.put((byte)((data>>0)&0xff));


  40 
  41     private native static int _initIDs(); // returns the native format
  42     static {
  43         nativeFormat = _initIDs();
  44     }
  45 
  46     private static final int nativeFormat;
  47 
  48     static int getNativeFormat_impl() {
  49         return nativeFormat;
  50     }
  51 
  52     protected MacPixels(int width, int height, ByteBuffer data) {
  53         super(width, height, data);
  54     }
  55 
  56     protected MacPixels(int width, int height, IntBuffer data) {
  57         super(width, height, data);
  58     }
  59 
  60     protected MacPixels(int width, int height, IntBuffer data, float scalex, float scaley) {
  61         super(width, height, data, scalex, scaley);
  62     }
  63 
  64     @Override
  65     protected void _fillDirectByteBuffer(ByteBuffer bb) {
  66         if (this.bytes != null) {
  67             this.bytes.rewind();
  68             if (this.bytes.isDirect() == true) {
  69                 _copyPixels(bb, this.bytes, getWidth()*getHeight());
  70             } else {
  71                 bb.put(this.bytes);
  72             }
  73             this.bytes.rewind();
  74         } else {
  75             this.ints.rewind();
  76             if (this.ints.isDirect() == true) {
  77                 _copyPixels(bb, this.ints, getWidth()*getHeight());
  78             } else {
  79                 for (int i=0; i<this.ints.capacity(); i++) {
  80                     int data = this.ints.get();
  81                     bb.put((byte)((data>>0)&0xff));