diff options
author | Michael Koch <mkoch@gcc.gnu.org> | 2004-04-20 08:37:47 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2004-04-20 08:37:47 +0000 |
commit | 8ecb03465a2f32c719a9a339dbe0b605547f8b9a (patch) | |
tree | e1202d5b830144c0b8e5086f4ae6c4220655e2a1 /libjava/gnu | |
parent | 57bef48ec5d1e635f0dd2397904f6ce4f91a640c (diff) | |
download | gcc-8ecb03465a2f32c719a9a339dbe0b605547f8b9a.zip gcc-8ecb03465a2f32c719a9a339dbe0b605547f8b9a.tar.gz gcc-8ecb03465a2f32c719a9a339dbe0b605547f8b9a.tar.bz2 |
[multiple changes]
2004-04-20 Sascha Brawer <brawer@dandelis.ch>
* java/awt/image/DataBufferShort.java,
java/awt/image/DataBufferFloat.java,
java/awt/image/DataBufferDouble.java,
java/awt/image/PixelInterleavedSampleModel.java: New files.
* gnu/java/awt/Buffers.java (createBuffer, createBufferFromData,
getData): Added support for TYPE_SHORT, TYPE_FLOAT and TYPE_DOUBLE.
2004-04-20 Michael Koch <konqueror@gmx.de>
* Makefile.am (java_source_files): Added
java/awt/image/DataBufferDouble.java,
java/awt/image/DataBufferFloat.java,
java/awt/image/DataBufferShort.java and
java/awt/image/PixelInterleavedSampleModel.java.
* Makefile.in: Regenerated.
From-SVN: r80886
Diffstat (limited to 'libjava/gnu')
-rw-r--r-- | libjava/gnu/java/awt/Buffers.java | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/libjava/gnu/java/awt/Buffers.java b/libjava/gnu/java/awt/Buffers.java index 24fe2ce..3f25474 100644 --- a/libjava/gnu/java/awt/Buffers.java +++ b/libjava/gnu/java/awt/Buffers.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002 Free Software Foundation +/* Copyright (C) 2000, 2002, 2004 Free Software Foundation This file is part of GNU Classpath. @@ -83,10 +83,16 @@ public final class Buffers { case DataBuffer.TYPE_BYTE: return new DataBufferByte(size, numBanks); + case DataBuffer.TYPE_SHORT: + return new DataBufferShort(size, numBanks); case DataBuffer.TYPE_USHORT: return new DataBufferUShort(size, numBanks); case DataBuffer.TYPE_INT: return new DataBufferInt(size, numBanks); + case DataBuffer.TYPE_FLOAT: + return new DataBufferFloat(size, numBanks); + case DataBuffer.TYPE_DOUBLE: + return new DataBufferDouble(size, numBanks); default: throw new UnsupportedOperationException(); } @@ -106,10 +112,16 @@ public final class Buffers { case DataBuffer.TYPE_BYTE: return new DataBufferByte((byte[]) data, size); + case DataBuffer.TYPE_SHORT: + return new DataBufferShort((short[]) data, size); case DataBuffer.TYPE_USHORT: return new DataBufferUShort((short[]) data, size); case DataBuffer.TYPE_INT: return new DataBufferInt((int[]) data, size); + case DataBuffer.TYPE_FLOAT: + return new DataBufferFloat((float[]) data, size); + case DataBuffer.TYPE_DOUBLE: + return new DataBufferDouble((double[]) data, size); default: throw new UnsupportedOperationException(); } @@ -126,10 +138,22 @@ public final class Buffers { if (buffer instanceof DataBufferByte) return ((DataBufferByte) buffer).getData(); + + if (buffer instanceof DataBufferShort) + return ((DataBufferShort) buffer).getData(); + if (buffer instanceof DataBufferUShort) return ((DataBufferUShort) buffer).getData(); + if (buffer instanceof DataBufferInt) return ((DataBufferInt) buffer).getData(); + + if (buffer instanceof DataBufferFloat) + return ((DataBufferFloat) buffer).getData(); + + if (buffer instanceof DataBufferDouble) + return ((DataBufferDouble) buffer).getData(); + throw new ClassCastException("Unknown data buffer type"); } @@ -149,6 +173,11 @@ public final class Buffers from = ((DataBufferByte) src).getData(); if (dest == null) dest = new byte[length+destOffset]; } + else if (src instanceof DataBufferShort) + { + from = ((DataBufferShort) src).getData(); + if (dest == null) dest = new short[length+destOffset]; + } else if (src instanceof DataBufferUShort) { from = ((DataBufferUShort) src).getData(); @@ -159,6 +188,16 @@ public final class Buffers from = ((DataBufferInt) src).getData(); if (dest == null) dest = new int[length+destOffset]; } + else if (src instanceof DataBufferFloat) + { + from = ((DataBufferFloat) src).getData(); + if (dest == null) dest = new float[length+destOffset]; + } + else if (src instanceof DataBufferDouble) + { + from = ((DataBufferDouble) src).getData(); + if (dest == null) dest = new double[length+destOffset]; + } else { throw new ClassCastException("Unknown data buffer type"); |