1 /* 2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.glass.ui.monocle; 27 28 import com.sun.glass.ui.Pixels; 29 30 import java.nio.Buffer; 31 import java.nio.ByteBuffer; 32 import java.nio.IntBuffer; 33 34 final class MonoclePixels extends Pixels { 35 36 MonoclePixels(int width, int height, ByteBuffer data) { 37 super(width, height, data); 38 } 39 40 MonoclePixels(int width, int height, IntBuffer data) { 41 super(width, height, data); 42 } 43 44 MonoclePixels(int width, int height, IntBuffer data, float scale) { 45 super(width, height, data, scale); 46 } 47 48 49 private void _copyPixels(Buffer dst, Buffer src, int size) { 50 throw new UnsupportedOperationException("not implemented"); 51 } 52 53 @Override protected void _fillDirectByteBuffer(ByteBuffer bb) { 54 if (this.bytes != null) { 55 this.bytes.rewind(); 56 if (this.bytes.isDirect()) { 57 _copyPixels(bb, this.bytes, getWidth() * getHeight()); 58 } else { 59 bb.put(this.bytes); 60 } 61 this.bytes.rewind(); 62 } else { 63 this.ints.rewind(); 64 if (this.ints.isDirect()) { 65 _copyPixels(bb, this.ints, getWidth() * getHeight()); 66 } else { 67 for (int i = 0; i < this.ints.capacity(); i++) { 68 int data = this.ints.get(); 69 bb.put((byte)((data) & 0xff)); 70 bb.put((byte)((data >> 8) & 0xff)); 71 bb.put((byte)((data >> 16) & 0xff)); 72 bb.put((byte)((data >> 24) & 0xff)); 73 } 74 } 75 this.ints.rewind(); 76 } 77 bb.rewind(); 78 } 79 80 @Override protected void _attachInt(long nativeWindowPointer, int w, int h, 81 IntBuffer ints, int[] array, int offset) { 82 throw new UnsupportedOperationException("not implemented"); 83 } 84 85 @Override protected void _attachByte(long ptr, int w, int h, ByteBuffer bytes, 86 byte[] array, int offset) { 87 88 throw new UnsupportedOperationException("not implemented"); 89 } 90 }