modules/graphics/src/main/java/com/sun/glass/ui/gtk/GtkPixels.java

Print this page




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package com.sun.glass.ui.gtk;
  26 
  27 import com.sun.glass.ui.Pixels;
  28 import java.nio.Buffer;
  29 import java.nio.ByteBuffer;
  30 import java.nio.IntBuffer;
  31 
  32 final class GtkPixels extends Pixels {
  33 
  34     public GtkPixels(int width, int height, ByteBuffer data) {
  35         super(width, height, data);
  36     }
  37 
  38     public GtkPixels(int width, int height, IntBuffer data) {
  39         super(width, height, data);
  40     }
  41 
  42     public GtkPixels(int width, int height, IntBuffer data, float scale) {
  43         super(width, height, data, scale);
  44     }
  45 
  46     @Override
  47     protected void _fillDirectByteBuffer(ByteBuffer bb) {
  48         // Taken from MacPixels
  49         if (this.bytes != null) {
  50             this.bytes.rewind();
  51             if (this.bytes.isDirect()) {
  52                 _copyPixels(bb, this.bytes, getWidth()*getHeight());
  53             } else {
  54                 bb.put(this.bytes);
  55             }
  56             this.bytes.rewind();
  57         } else {
  58             this.ints.rewind();
  59             if (this.ints.isDirect()) {
  60                 _copyPixels(bb, this.ints, getWidth()*getHeight());
  61             } else {
  62                 for (int i=0; i<this.ints.capacity(); i++) {
  63                     int data = this.ints.get();


  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package com.sun.glass.ui.gtk;
  26 
  27 import com.sun.glass.ui.Pixels;
  28 import java.nio.Buffer;
  29 import java.nio.ByteBuffer;
  30 import java.nio.IntBuffer;
  31 
  32 final class GtkPixels extends Pixels {
  33 
  34     public GtkPixels(int width, int height, ByteBuffer data) {
  35         super(width, height, data);
  36     }
  37 
  38     public GtkPixels(int width, int height, IntBuffer data) {
  39         super(width, height, data);
  40     }
  41 
  42     public GtkPixels(int width, int height, IntBuffer data, float scalex, float scaley) {
  43         super(width, height, data, scalex, scaley);
  44     }
  45 
  46     @Override
  47     protected void _fillDirectByteBuffer(ByteBuffer bb) {
  48         // Taken from MacPixels
  49         if (this.bytes != null) {
  50             this.bytes.rewind();
  51             if (this.bytes.isDirect()) {
  52                 _copyPixels(bb, this.bytes, getWidth()*getHeight());
  53             } else {
  54                 bb.put(this.bytes);
  55             }
  56             this.bytes.rewind();
  57         } else {
  58             this.ints.rewind();
  59             if (this.ints.isDirect()) {
  60                 _copyPixels(bb, this.ints, getWidth()*getHeight());
  61             } else {
  62                 for (int i=0; i<this.ints.capacity(); i++) {
  63                     int data = this.ints.get();