From 51427b92a2d9cd3fc619854e26536c9c6adad947 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 2 Jul 2013 22:25:23 +0200 Subject: PNGJ: Bump to git sha1 a0b1101ba2d37de39428ed55c8189502e24a3125 of https://code.google.com/p/pngj/ --- .../jogamp/opengl/util/pngj/FilterType.java | 24 +++++-- .../classes/jogamp/opengl/util/pngj/ImageInfo.java | 26 +++++--- .../classes/jogamp/opengl/util/pngj/ImageLine.java | 42 +++++++----- .../jogamp/opengl/util/pngj/ImageLineHelper.java | 32 ++++++---- .../jogamp/opengl/util/pngj/ImageLines.java | 24 ++++--- .../jogamp/opengl/util/pngj/PngHelperInternal.java | 23 ++++--- .../opengl/util/pngj/PngIDatChunkInputStream.java | 9 ++- .../classes/jogamp/opengl/util/pngj/PngWriter.java | 74 +++++++++++++--------- .../opengl/util/pngj/PngjExceptionInternal.java | 3 +- .../opengl/util/pngj/PngjUnsupportedException.java | 3 +- .../opengl/util/pngj/ProgressiveOutputStream.java | 7 +- .../util/pngj/chunks/ChunkLoadBehaviour.java | 9 ++- .../jogamp/opengl/util/pngj/chunks/ChunkRaw.java | 23 ++++--- .../jogamp/opengl/util/pngj/chunks/ChunksList.java | 17 +++-- .../util/pngj/chunks/ChunksListForWrite.java | 11 ++-- .../jogamp/opengl/util/pngj/chunks/PngChunk.java | 53 ++++++++++------ .../opengl/util/pngj/chunks/PngChunkIDAT.java | 3 +- .../opengl/util/pngj/chunks/PngChunkMultiple.java | 3 +- .../opengl/util/pngj/chunks/PngChunkSingle.java | 3 +- .../opengl/util/pngj/chunks/PngMetadata.java | 31 +++++---- 20 files changed, 263 insertions(+), 157 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl') diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java index e88a95a33..0fffc85b1 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java @@ -1,5 +1,7 @@ package jogamp.opengl.util.pngj; +import java.util.HashMap; + /** * Internal PNG predictor filter, or strategy to select it. * @@ -26,15 +28,18 @@ public enum FilterType { */ FILTER_PAETH(4), /** - * Default strategy: select one of the above filters depending on global image parameters + * Default strategy: select one of the above filters depending on global + * image parameters */ FILTER_DEFAULT(-1), /** - * Aggressive strategy: select one of the above filters trying each of the filters (every 8 rows) + * Aggressive strategy: select one of the above filters trying each of the + * filters (every 8 rows) */ FILTER_AGGRESSIVE(-2), /** - * Very aggressive strategy: select one of the above filters trying each of the filters (for every row!) + * Very aggressive strategy: select one of the above filters trying each of + * the filters (for every row!) */ FILTER_VERYAGGRESSIVE(-3), /** @@ -52,12 +57,17 @@ public enum FilterType { this.val = val; } - public static FilterType getByVal(int i) { + private static HashMap byVal; + + static { + byVal = new HashMap(); for (FilterType ft : values()) { - if (ft.val == i) - return ft; + byVal.put(ft.val, ft); } - return null; + } + + public static FilterType getByVal(int i) { + return byVal.get(i); } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java index 26562ef3e..e62134cd5 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java @@ -3,7 +3,8 @@ package jogamp.opengl.util.pngj; /** * Simple immutable wrapper for basic image info. *

- * Some parameters are redundant, but the constructor receives an 'orthogonal' subset. + * Some parameters are redundant, but the constructor receives an 'orthogonal' + * subset. *

* ref: http://www.w3.org/TR/PNG/#11IHDR */ @@ -23,14 +24,15 @@ public class ImageInfo { public final int rows; /** - * Bits per sample (per channel) in the buffer (1-2-4-8-16). This is 8-16 for RGB/ARGB images, 1-2-4-8 for - * grayscale. For indexed images, number of bits per palette index (1-2-4-8) + * Bits per sample (per channel) in the buffer (1-2-4-8-16). This is 8-16 + * for RGB/ARGB images, 1-2-4-8 for grayscale. For indexed images, number of + * bits per palette index (1-2-4-8) */ public final int bitDepth; /** - * Number of channels, as used internally: 3 for RGB, 4 for RGBA, 2 for GA (gray with alpha), 1 for grayscale or - * indexed. + * Number of channels, as used internally: 3 for RGB, 4 for RGBA, 2 for GA + * (gray with alpha), 1 for grayscale or indexed. */ public final int channels; @@ -50,7 +52,8 @@ public class ImageInfo { public final boolean indexed; /** - * Flag: true if image internally uses less than one byte per sample (bit depth 1-2-4) + * Flag: true if image internally uses less than one byte per sample (bit + * depth 1-2-4) */ public final boolean packed; @@ -75,10 +78,12 @@ public class ImageInfo { public final int samplesPerRow; /** - * Amount of "packed samples" : when several samples are stored in a single byte (bitdepth 1,2 4) they are counted - * as one "packed sample". This is less that samplesPerRow only when bitdepth is 1-2-4 (flag packed = true) + * Amount of "packed samples" : when several samples are stored in a single + * byte (bitdepth 1,2 4) they are counted as one "packed sample". This is + * less that samplesPerRow only when bitdepth is 1-2-4 (flag packed = true) *

- * This equals the number of elements in the scanline array if working with packedMode=true + * This equals the number of elements in the scanline array if working with + * packedMode=true *

* For internal use, client code should rarely access this. */ @@ -99,7 +104,8 @@ public class ImageInfo { * @param rows * Height in pixels * @param bitdepth - * Bits per sample, in the buffer : 8-16 for RGB true color and greyscale + * Bits per sample, in the buffer : 8-16 for RGB true color and + * greyscale * @param alpha * Flag: has an alpha channel (RGBA or GA) * @param grayscale diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java index 9f8a13230..e34e6a226 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java @@ -5,7 +5,8 @@ import jogamp.opengl.util.pngj.ImageLineHelper.ImageLineStats; /** * Lightweight wrapper for an image scanline, used for read and write. *

- * This object can be (usually it is) reused while iterating over the image lines. + * This object can be (usually it is) reused while iterating over the image + * lines. *

* See scanline field, to understand the format. */ @@ -18,21 +19,25 @@ public class ImageLine { private int rown = 0; /** - * The 'scanline' is an array of integers, corresponds to an image line (row). + * The 'scanline' is an array of integers, corresponds to an image line + * (row). *

- * Except for 'packed' formats (gray/indexed with 1-2-4 bitdepth) each int is a "sample" (one for - * channel), (0-255 or 0-65535) in the corresponding PNG sequence: R G B R G B... or + * Except for 'packed' formats (gray/indexed with 1-2-4 bitdepth) each + * int is a "sample" (one for channel), (0-255 or 0-65535) in + * the corresponding PNG sequence: R G B R G B... or * R G B A R G B A... * or g g g ... or i i i (palette index) *

- * For bitdepth=1/2/4 , and if samplesUnpacked=false, each value is a PACKED byte! + * For bitdepth=1/2/4 , and if samplesUnpacked=false, each value is a PACKED + * byte! *

- * To convert a indexed line to RGB balues, see ImageLineHelper.palIdx2RGB() (you can't do the reverse) + * To convert a indexed line to RGB balues, see + * ImageLineHelper.palIdx2RGB() (you can't do the reverse) */ public final int[] scanline; /** - * Same as {@link #scanline}, but with one byte per sample. Only one of scanline and scanlineb is valid - this - * depends on {@link #sampleType} + * Same as {@link #scanline}, but with one byte per sample. Only one of + * scanline and scanlineb is valid - this depends on {@link #sampleType} */ public final byte[] scanlineb; @@ -53,10 +58,11 @@ public class ImageLine { public final SampleType sampleType; /** - * true: each element of the scanline array represents a sample always, even for internally packed PNG formats + * true: each element of the scanline array represents a sample always, even + * for internally packed PNG formats * - * false: if the original image was of packed type (bit depth less than 8) we keep samples packed in a single array - * element + * false: if the original image was of packed type (bit depth less than 8) + * we keep samples packed in a single array element */ public final boolean samplesUnpacked; @@ -70,11 +76,14 @@ public class ImageLine { /** * * @param imgInfo - * Inmutable ImageInfo, basic parameter of the image we are reading or writing + * Inmutable ImageInfo, basic parameter of the image we are + * reading or writing * @param stype - * INT or BYTE : this determines which scanline is the really used one + * INT or BYTE : this determines which scanline is the really + * used one * @param unpackedMode - * If true, we use unpacked format, even for packed original images + * If true, we use unpacked format, even for packed original + * images * */ public ImageLine(ImageInfo imgInfo, SampleType stype, boolean unpackedMode) { @@ -226,7 +235,10 @@ public class ImageLine { } } - /** size original: samplesPerRow sizeFinal: samplesPerRowPacked (trailing elements are trash!) **/ + /** + * size original: samplesPerRow sizeFinal: samplesPerRowPacked (trailing + * elements are trash!) + **/ static void packInplaceByte(final ImageInfo iminfo, final byte[] src, final byte[] dst, final boolean scaled) { final int bitDepth = iminfo.bitDepth; if (bitDepth >= 8) diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java index 98f235662..91516a704 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java @@ -5,11 +5,14 @@ import jogamp.opengl.util.pngj.chunks.PngChunkPLTE; import jogamp.opengl.util.pngj.chunks.PngChunkTRNS; /** - * Bunch of utility static methods to process/analyze an image line at the pixel level. + * Bunch of utility static methods to process/analyze an image line at the pixel + * level. *

- * Not essential at all, some methods are probably to be removed if future releases. + * Not essential at all, some methods are probably to be removed if future + * releases. *

- * WARNING: most methods for getting/setting values work currently only for integer base imageLines + * WARNING: most methods for getting/setting values work currently only for + * integer base imageLines */ public class ImageLineHelper { @@ -18,7 +21,8 @@ public class ImageLineHelper { private final static double BIG_VALUE_NEG = Double.MAX_VALUE * (-0.5); /** - * Given an indexed line with a palette, unpacks as a RGB array, or RGBA if a non nul PngChunkTRNS chunk is passed + * Given an indexed line with a palette, unpacks as a RGB array, or RGBA if + * a non nul PngChunkTRNS chunk is passed * * @param line * ImageLine as returned from PngReader @@ -26,7 +30,8 @@ public class ImageLineHelper { * Palette chunk * @param buf * Preallocated array, optional - * @return R G B (A), one sample 0-255 per array element. Ready for pngw.writeRowInt() + * @return R G B (A), one sample 0-255 per array element. Ready for + * pngw.writeRowInt() */ public static int[] palette2rgb(ImageLine line, PngChunkPLTE pal, PngChunkTRNS trns, int[] buf) { boolean isalpha = trns != null; @@ -53,9 +58,12 @@ public class ImageLineHelper { return palette2rgb(line, pal, null, buf); } - /** what follows is pretty uninteresting/untested/obsolete, subject to change */ /** - * Just for basic info or debugging. Shows values for first and last pixel. Does not include alpha + * what follows is pretty uninteresting/untested/obsolete, subject to change + */ + /** + * Just for basic info or debugging. Shows values for first and last pixel. + * Does not include alpha */ public static String infoFirstLastPixels(ImageLine line) { return line.imgInfo.channels == 1 ? String.format("first=(%d) last=(%d)", line.scanline[0], @@ -71,8 +79,8 @@ public class ImageLineHelper { } /** - * Computes some statistics for the line. Not very efficient or elegant, mainly for tests. Only for RGB/RGBA Outputs - * values as doubles (0.0 - 1.0) + * Computes some statistics for the line. Not very efficient or elegant, + * mainly for tests. Only for RGB/RGBA Outputs values as doubles (0.0 - 1.0) */ static class ImageLineStats { public double[] prom = { 0.0, 0.0, 0.0, 0.0 }; // channel averages @@ -237,9 +245,11 @@ public class ImageLineHelper { /** * Unpacks scanline (for bitdepth 1-2-4) into a array int[] *

- * You can (OPTIONALLY) pass an preallocated array, that will be filled and returned. If null, it will be allocated + * You can (OPTIONALLY) pass an preallocated array, that will be filled and + * returned. If null, it will be allocated *

- * If scale==true, it scales the value (just a bit shift) towards 0-255. + * If + * scale==true, it scales the value (just a bit shift) towards 0-255. *

* You probably should use {@link ImageLine#unpackToNewImageLine()} * diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java index 1e0ab746a..feb50e7b6 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java @@ -3,10 +3,12 @@ package jogamp.opengl.util.pngj; import jogamp.opengl.util.pngj.ImageLine.SampleType; /** - * Wraps in a matrix a set of image rows, not necessarily contiguous - but equispaced. + * Wraps in a matrix a set of image rows, not necessarily contiguous - but + * equispaced. * - * The fields mirrors those of {@link ImageLine}, and you can access each row as a ImageLine backed by the matrix row, - * see {@link #getImageLineAtMatrixRow(int)} + * The fields mirrors those of {@link ImageLine}, and you can access each row as + * a ImageLine backed by the matrix row, see + * {@link #getImageLineAtMatrixRow(int)} */ public class ImageLines { @@ -23,7 +25,8 @@ public class ImageLines { public final byte[][] scanlinesb; /** - * Allocates a matrix to store {@code nRows} image rows. See {@link ImageLine} and {@link PngReader#readRowsInt()} + * Allocates a matrix to store {@code nRows} image rows. See + * {@link ImageLine} and {@link PngReader#readRowsInt()} * {@link PngReader#readRowsByte()} * * @param imgInfo @@ -54,8 +57,9 @@ public class ImageLines { } /** - * Warning: this always returns a valid matrix row (clamping on 0 : nrows-1, and rounding down) Eg: - * rowOffset=4,rowStep=2 imageRowToMatrixRow(17) returns 6 , imageRowToMatrixRow(1) returns 0 + * Warning: this always returns a valid matrix row (clamping on 0 : nrows-1, + * and rounding down) Eg: rowOffset=4,rowStep=2 imageRowToMatrixRow(17) + * returns 6 , imageRowToMatrixRow(1) returns 0 */ public int imageRowToMatrixRow(int imrow) { int r = (imrow - rowOffset) / rowStep; @@ -86,9 +90,11 @@ public class ImageLines { * Returns a ImageLine is backed by the matrix, no allocation done * * @param mrow - * Matrix row, from 0 to nRows This is not necessarily the image row, see - * {@link #imageRowToMatrixRow(int)} and {@link #matrixRowToImageRow(int)} - * @return A new ImageLine, backed by the matrix, with the correct ('real') rownumber + * Matrix row, from 0 to nRows This is not necessarily the image + * row, see {@link #imageRowToMatrixRow(int)} and + * {@link #matrixRowToImageRow(int)} + * @return A new ImageLine, backed by the matrix, with the correct ('real') + * rownumber */ public ImageLine getImageLineAtMatrixRow(int mrow) { if (mrow < 0 || mrow > nRows) diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java index 63edf8d17..a950c6b33 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java @@ -144,18 +144,23 @@ public class PngHelperInternal { } } - public static void skipBytes(InputStream is, int len) { - byte[] buf = new byte[8192 * 4]; - int read, remain = len; + public static void skipBytes(InputStream is, long len) { try { - while (remain > 0) { - read = is.read(buf, 0, remain > buf.length ? buf.length : remain); - if (read < 0) - throw new PngjInputException("error reading (skipping) : EOF"); - remain -= read; + while (len > 0) { + long n1 = is.skip(len); + if (n1 > 0) { + len -= n1; + } else if (n1 == 0) { // should we retry? lets read one byte + if (is.read() == -1) // EOF + break; + else + len--; + } else + // negative? this should never happen but... + throw new IOException("skip() returned a negative value ???"); } } catch (IOException e) { - throw new PngjInputException("error reading (skipping)", e); + throw new PngjInputException(e); } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java index 6cc39b0e6..cdad09809 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java @@ -37,7 +37,8 @@ class PngIDatChunkInputStream extends InputStream { List foundChunksInfo = new ArrayList(); /** - * Constructor must be called just after reading length and id of first IDAT chunk + * Constructor must be called just after reading length and id of first IDAT + * chunk **/ PngIDatChunkInputStream(InputStream iStream, int lenFirstChunk, long offset) { this.offset = offset; @@ -95,7 +96,8 @@ class PngIDatChunkInputStream extends InputStream { } /** - * sometimes last row read does not fully consumes the chunk here we read the reamaing dummy bytes + * sometimes last row read does not fully consumes the chunk here we read + * the reamaing dummy bytes */ void forceChunkEnd() { if (!ended) { @@ -108,7 +110,8 @@ class PngIDatChunkInputStream extends InputStream { } /** - * This can return less than len, but never 0 Returns -1 if "pseudo file" ended prematurely. That is our error. + * This can return less than len, but never 0 Returns -1 if "pseudo file" + * ended prematurely. That is our error. */ @Override public int read(byte[] b, int off, int len) throws IOException { diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java index 601cd96c0..3e684a881 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java @@ -83,8 +83,9 @@ public class PngWriter { } /** - * Constructs a new PngWriter from a output stream. After construction nothing is writen yet. You still can set some - * parameters (compression, filters) and queue chunks before start writing the pixels. + * Constructs a new PngWriter from a output stream. After construction + * nothing is writen yet. You still can set some parameters (compression, + * filters) and queue chunks before start writing the pixels. *

* See also FileHelper.createPngWriter() if available. * @@ -418,13 +419,15 @@ public class PngWriter { /** * Copies first (pre IDAT) ancillary chunks from a PngReader. *

- * Should be called when creating an image from another, before starting writing lines, to copy relevant chunks. + * Should be called when creating an image from another, before starting + * writing lines, to copy relevant chunks. *

* * @param reader * : PngReader object, already opened. * @param copy_mask - * : Mask bit (OR), see ChunksToWrite.COPY_XXX constants + * : Mask bit (OR), see ChunksToWrite.COPY_XXX + * constants */ public void copyChunksFirst(PngReader reader, int copy_mask) { copyChunks(reader, copy_mask, false); @@ -433,14 +436,15 @@ public class PngWriter { /** * Copies last (post IDAT) ancillary chunks from a PngReader. *

- * Should be called when creating an image from another, after writing all lines, before closing the writer, to copy - * additional chunks. + * Should be called when creating an image from another, after writing all + * lines, before closing the writer, to copy additional chunks. *

* * @param reader * : PngReader object, already opened and fully read. * @param copy_mask - * : Mask bit (OR), see ChunksToWrite.COPY_XXX constants + * : Mask bit (OR), see ChunksToWrite.COPY_XXX + * constants */ public void copyChunksLast(PngReader reader, int copy_mask) { copyChunks(reader, copy_mask, true); @@ -449,8 +453,8 @@ public class PngWriter { /** * Computes compressed size/raw size, approximate. *

- * Actually: compressed size = total size of IDAT data , raw size = uncompressed pixel bytes = rows * (bytesPerRow + - * 1). + * Actually: compressed size = total size of IDAT data , raw size = + * uncompressed pixel bytes = rows * (bytesPerRow + 1). * * This must be called after pngw.end() */ @@ -463,7 +467,8 @@ public class PngWriter { } /** - * Finalizes the image creation and closes the stream. This MUST be called after writing the lines. + * Finalizes the image creation and closes the stream. This MUST be called + * after writing the lines. */ public void end() { if (rowNum != imgInfo.rows - 1) @@ -525,15 +530,17 @@ public class PngWriter { * See also setCompLevel() * * @param filterType - * One of the five prediction types or strategy to choose it (see PngFilterType) Recommended - * values: DEFAULT (default) or AGGRESIVE + * One of the five prediction types or strategy to choose it (see + * PngFilterType) Recommended values: DEFAULT + * (default) or AGGRESIVE */ public void setFilterType(FilterType filterType) { filterStrat = new FilterWriteStrategy(imgInfo, filterType); } /** - * Sets maximum size of IDAT fragments. This has little effect on performance you should rarely call this + * Sets maximum size of IDAT fragments. This has little effect on + * performance you should rarely call this *

* * @param idatMaxSize @@ -553,7 +560,8 @@ public class PngWriter { } /** - * Deflater strategy: one of Deflater.FILTERED Deflater.HUFFMAN_ONLY Deflater.DEFAULT_STRATEGY + * Deflater strategy: one of Deflater.FILTERED Deflater.HUFFMAN_ONLY + * Deflater.DEFAULT_STRATEGY *

* Default: Deflater.FILTERED . This should be changed very rarely. */ @@ -562,8 +570,8 @@ public class PngWriter { } /** - * Writes line, checks that the row number is consistent with that of the ImageLine See writeRow(int[] newrow, int - * rown) + * Writes line, checks that the row number is consistent with that of the + * ImageLine See writeRow(int[] newrow, int rown) * * @deprecated Better use writeRow(ImageLine imgline, int rownumber) */ @@ -607,18 +615,22 @@ public class PngWriter { /** * Writes a full image row. *

- * This must be called sequentially from n=0 to n=rows-1 One integer per sample , in the natural order: R G B R G B - * ... (or R G B A R G B A... if has alpha) The values should be between 0 and 255 for 8 bitspc images, and between - * 0- 65535 form 16 bitspc images (this applies also to the alpha channel if present) The array can be reused. + * This must be called sequentially from n=0 to n=rows-1 One integer per + * sample , in the natural order: R G B R G B ... (or R G B A R G B A... if + * has alpha) The values should be between 0 and 255 for 8 bitspc images, + * and between 0- 65535 form 16 bitspc images (this applies also to the + * alpha channel if present) The array can be reused. *

- * Warning: the array might be modified in some cases (unpacked row with low bitdepth) + * Warning: the array might be modified in some cases (unpacked row with low + * bitdepth) *

* * @param newrow - * Array of pixel values. Warning: the array size should be exact (samplesPerRowP) + * Array of pixel values. Warning: the array size should be exact + * (samplesPerRowP) * @param rown - * Row number, from 0 (top) to rows-1 (bottom). This is just used as a check. Pass -1 if you want to - * autocompute it + * Row number, from 0 (top) to rows-1 (bottom). This is just used + * as a check. Pass -1 if you want to autocompute it */ public void writeRowInt(int[] newrow, int rown) { prepareEncodeRow(rown); @@ -627,8 +639,9 @@ public class PngWriter { } /** - * Same semantics as writeRowInt but using bytes. Each byte is still a sample. If 16bitdepth, we are passing only - * the most significant byte (and hence losing some info) + * Same semantics as writeRowInt but using bytes. Each byte is still a + * sample. If 16bitdepth, we are passing only the most significant byte (and + * hence losing some info) * * @see PngWriter#writeRowInt(int[], int) */ @@ -659,12 +672,15 @@ public class PngWriter { } /** - * If false (default), and image has bitdepth 1-2-4, the scanlines passed are assumed to be already packed. + * If false (default), and image has bitdepth 1-2-4, the scanlines passed + * are assumed to be already packed. *

- * If true, each element is a sample, the writer will perform the packing if necessary. + * If true, each element is a sample, the writer will perform the packing if + * necessary. *

- * Warning: when using {@link #writeRow(ImageLine, int)} (recommended) the packed flag of the ImageLine - * object overrides (and overwrites!) this field. + * Warning: when using {@link #writeRow(ImageLine, int)} (recommended) the + * packed flag of the ImageLine object overrides (and overwrites!) + * this field. */ public void setUseUnPackedMode(boolean useUnpackedMode) { this.unpackedMode = useUnpackedMode; diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java index 963abc50e..c429b893b 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java @@ -1,7 +1,8 @@ package jogamp.opengl.util.pngj; /** - * Exception for anomalous internal problems (sort of asserts) that point to some issue with the library + * Exception for anomalous internal problems (sort of asserts) that point to + * some issue with the library * * @author Hernan J Gonzalez * diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java index 0801e33bb..f68458d19 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java @@ -1,7 +1,8 @@ package jogamp.opengl.util.pngj; /** - * Exception thrown because of some valid feature of PNG standard that this library does not support + * Exception thrown because of some valid feature of PNG standard that this + * library does not support */ public class PngjUnsupportedException extends RuntimeException { private static final long serialVersionUID = 1L; diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java b/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java index a5bad666c..4516a0886 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java @@ -4,7 +4,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; /** - * stream that outputs to memory and allows to flush fragments every 'size' bytes to some other destination + * stream that outputs to memory and allows to flush fragments every 'size' + * bytes to some other destination */ abstract class ProgressiveOutputStream extends ByteArrayOutputStream { private final int size; @@ -50,8 +51,8 @@ abstract class ProgressiveOutputStream extends ByteArrayOutputStream { } /** - * if it's time to flush data (or if forced==true) calls abstract method flushBuffer() and cleans those bytes from - * own buffer + * if it's time to flush data (or if forced==true) calls abstract method + * flushBuffer() and cleans those bytes from own buffer */ private final void checkFlushBuffer(boolean forced) { while (forced || count >= size) { diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java index 03d50c2c4..82ab3bcf9 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java @@ -1,7 +1,8 @@ package jogamp.opengl.util.pngj.chunks; /** - * Defines gral strategy about what to do with ancillary (non-critical) chunks when reading + * Defines gral strategy about what to do with ancillary (non-critical) chunks + * when reading */ public enum ChunkLoadBehaviour { /** @@ -9,7 +10,8 @@ public enum ChunkLoadBehaviour { */ LOAD_CHUNK_NEVER, /** - * Ancillary chunks are loaded only if 'known' (registered with the factory). + * Ancillary chunks are loaded only if 'known' (registered with the + * factory). */ LOAD_CHUNK_KNOWN, /** @@ -19,7 +21,8 @@ public enum ChunkLoadBehaviour { LOAD_CHUNK_IF_SAFE, /** * Load all chunks.
- * Notice that other restrictions might apply, see PngReader.skipChunkMaxSize PngReader.skipChunkIds + * Notice that other restrictions might apply, see + * PngReader.skipChunkMaxSize PngReader.skipChunkIds */ LOAD_CHUNK_ALWAYS; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java index 8dd0ef476..3aba26cca 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java @@ -13,13 +13,15 @@ import jogamp.opengl.util.pngj.PngjOutputException; /** * Raw (physical) chunk. *

- * Short lived object, to be created while serialing/deserializing Do not reuse it for different chunks.
+ * Short lived object, to be created while serialing/deserializing Do not reuse + * it for different chunks.
* See http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html */ public class ChunkRaw { /** - * The length counts only the data field, not itself, the chunk type code, or the CRC. Zero is a valid length. - * Although encoders and decoders should treat the length as unsigned, its value must not exceed 231-1 bytes. + * The length counts only the data field, not itself, the chunk type code, + * or the CRC. Zero is a valid length. Although encoders and decoders should + * treat the length as unsigned, its value must not exceed 231-1 bytes. */ public final int len; @@ -29,12 +31,14 @@ public class ChunkRaw { public final byte[] idbytes = new byte[4]; /** - * The data bytes appropriate to the chunk type, if any. This field can be of zero length. Does not include crc + * The data bytes appropriate to the chunk type, if any. This field can be + * of zero length. Does not include crc */ public byte[] data = null; /** - * A 4-byte CRC (Cyclic Redundancy Check) calculated on the preceding bytes in the chunk, including the chunk type - * code and chunk data fields, but not including the length field. + * A 4-byte CRC (Cyclic Redundancy Check) calculated on the preceding bytes + * in the chunk, including the chunk type code and chunk data fields, but + * not including the length field. */ private int crcval = 0; @@ -71,7 +75,8 @@ public class ChunkRaw { } /** - * Computes the CRC and writes to the stream. If error, a PngjOutputException is thrown + * Computes the CRC and writes to the stream. If error, a + * PngjOutputException is thrown */ public void writeChunk(OutputStream os) { if (idbytes.length != 4) @@ -85,8 +90,8 @@ public class ChunkRaw { } /** - * position before: just after chunk id. positon after: after crc Data should be already allocated. Checks CRC - * Return number of byte read. + * position before: just after chunk id. positon after: after crc Data + * should be already allocated. Checks CRC Return number of byte read. */ public int readChunkData(InputStream is, boolean checkCrc) { PngHelperInternal.readBytes(is, data, 0, len); diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java index ad788f154..5ce94ff9f 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java @@ -49,8 +49,8 @@ public class ChunksList { } /** - * Returns a copy of the list (but the chunks are not copied) This should not be used for general metadata - * handling + * Returns a copy of the list (but the chunks are not copied) This + * should not be used for general metadata handling */ public ArrayList getChunks() { return new ArrayList(chunks); @@ -96,7 +96,8 @@ public class ChunksList { } /** - * If innerid!=null and the chunk is PngChunkTextVar or PngChunkSPLT, it's filtered by that id + * If innerid!=null and the chunk is PngChunkTextVar or PngChunkSPLT, it's + * filtered by that id * * @param id * @return innerid Only used for text and SPLT chunks @@ -119,8 +120,9 @@ public class ChunksList { /** * Returns only one chunk or null if nothing found - does not include queued *

- * If more than one chunk is found, then an exception is thrown (failifMultiple=true or chunk is single) or the last - * one is returned (failifMultiple=false) + * If more than one chunk is found, then an exception is thrown + * (failifMultiple=true or chunk is single) or the last one is returned + * (failifMultiple=false) **/ public PngChunk getById1(final String id, final boolean failIfMultiple) { return getById1(id, null, failIfMultiple); @@ -129,8 +131,9 @@ public class ChunksList { /** * Returns only one chunk or null if nothing found - does not include queued *

- * If more than one chunk (after filtering by inner id) is found, then an exception is thrown (failifMultiple=true - * or chunk is single) or the last one is returned (failifMultiple=false) + * If more than one chunk (after filtering by inner id) is found, then an + * exception is thrown (failifMultiple=true or chunk is single) or the last + * one is returned (failifMultiple=false) **/ public PngChunk getById1(final String id, final String innerid, final boolean failIfMultiple) { List list = getById(id, innerid); diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java index 204c4c2a5..e76456ad4 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java @@ -13,7 +13,8 @@ import jogamp.opengl.util.pngj.PngjOutputException; public class ChunksListForWrite extends ChunksList { /** - * chunks not yet writen - does not include IHDR, IDAT, END, perhaps yes PLTE + * chunks not yet writen - does not include IHDR, IDAT, END, perhaps yes + * PLTE */ private final List queuedChunks = new ArrayList(); @@ -67,8 +68,9 @@ public class ChunksListForWrite extends ChunksList { /** * Remove Chunk: only from queued * - * WARNING: this depends on c.equals() implementation, which is straightforward for SingleChunks. For - * MultipleChunks, it will normally check for reference equality! + * WARNING: this depends on c.equals() implementation, which is + * straightforward for SingleChunks. For MultipleChunks, it will normally + * check for reference equality! */ public boolean removeChunk(PngChunk c) { return queuedChunks.remove(c); @@ -87,7 +89,8 @@ public class ChunksListForWrite extends ChunksList { } /** - * this should be called only for ancillary chunks and PLTE (groups 1 - 3 - 5) + * this should be called only for ancillary chunks and PLTE (groups 1 - 3 - + * 5) **/ private static boolean shouldWrite(PngChunk c, int currentGroup) { if (currentGroup == CHUNK_GROUP_2_PLTE) diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java index 1d630591e..a45979ec2 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java @@ -12,13 +12,16 @@ import jogamp.opengl.util.pngj.PngjExceptionInternal; * Represents a instance of a PNG chunk. *

* See http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks - * .html + * href="http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html">http://www + * .libpng.org/pub/png/spec/1.2/PNG-Chunks .html *

- * Concrete classes should extend {@link PngChunkSingle} or {@link PngChunkMultiple} + * Concrete classes should extend {@link PngChunkSingle} or + * {@link PngChunkMultiple} *

- * Note that some methods/fields are type-specific (getOrderingConstraint(), allowsMultiple()),
- * some are 'almost' type-specific (id,crit,pub,safe; the exception is PngUKNOWN),
+ * Note that some methods/fields are type-specific (getOrderingConstraint(), + * allowsMultiple()),
+ * some are 'almost' type-specific (id,crit,pub,safe; the exception is + * PngUKNOWN),
* and the rest are instance-specific */ public abstract class PngChunk { @@ -35,8 +38,9 @@ public abstract class PngChunk { protected final ImageInfo imgInfo; /** - * Possible ordering constraint for a PngChunk type -only relevant for ancillary chunks. Theoretically, there could - * be more general constraints, but these cover the constraints for standard chunks. + * Possible ordering constraint for a PngChunk type -only relevant for + * ancillary chunks. Theoretically, there could be more general constraints, + * but these cover the constraints for standard chunks. */ public enum ChunkOrderingConstraint { /** @@ -83,8 +87,8 @@ public abstract class PngChunk { /** * This static map defines which PngChunk class correspond to which ChunkID *

- * The client can add other chunks to this map statically, before reading an image, calling - * PngChunk.factoryRegister(id,class) + * The client can add other chunks to this map statically, before reading an + * image, calling PngChunk.factoryRegister(id,class) */ private final static Map> factoryMap = new HashMap>(); static { @@ -114,8 +118,9 @@ public abstract class PngChunk { /** * Registers a chunk-id (4 letters) to be associated with a PngChunk class *

- * This method should be called by user code that wants to add some chunks (not implmemented in this library) to the - * factory, so that the PngReader knows about it. + * This method should be called by user code that wants to add some chunks + * (not implmemented in this library) to the factory, so that the PngReader + * knows about it. */ public static void factoryRegister(String chunkId, Class chunkClass) { factoryMap.put(chunkId, chunkClass); @@ -124,9 +129,11 @@ public abstract class PngChunk { /** * True if the chunk-id type is known. *

- * A chunk is known if we recognize its class, according with factoryMap + * A chunk is known if we recognize its class, according with + * factoryMap *

- * This is not necessarily the same as being "STANDARD", or being implemented in this library + * This is not necessarily the same as being "STANDARD", or being + * implemented in this library *

* Unknown chunks will be parsed as instances of {@link PngChunkUNKNOWN} */ @@ -143,7 +150,8 @@ public abstract class PngChunk { } /** - * This factory creates the corresponding chunk and parses the raw chunk. This is used when reading. + * This factory creates the corresponding chunk and parses the raw chunk. + * This is used when reading. */ public static PngChunk factory(ChunkRaw chunk, ImageInfo info) { PngChunk c = factoryFromId(ChunkHelper.toString(chunk.idbytes), info); @@ -153,7 +161,8 @@ public abstract class PngChunk { } /** - * Creates one new blank chunk of the corresponding type, according to factoryMap (PngChunkUNKNOWN if not known) + * Creates one new blank chunk of the corresponding type, according to + * factoryMap (PngChunkUNKNOWN if not known) */ public static PngChunk factoryFromId(String cid, ImageInfo info) { PngChunk chunk = null; @@ -189,7 +198,8 @@ public abstract class PngChunk { } /** - * In which "chunkGroup" (see {@link ChunksList}for definition) this chunks instance was read or written. + * In which "chunkGroup" (see {@link ChunksList}for definition) this chunks + * instance was read or written. *

* -1 if not read or written (eg, queued) */ @@ -236,16 +246,16 @@ public abstract class PngChunk { } /** - * Creates the physical chunk. This is used when writing (serialization). Each particular chunk class implements its - * own logic. + * Creates the physical chunk. This is used when writing (serialization). + * Each particular chunk class implements its own logic. * * @return A newly allocated and filled raw chunk */ public abstract ChunkRaw createRawChunk(); /** - * Parses raw chunk and fill inside data. This is used when reading (deserialization). Each particular chunk class - * implements its own logic. + * Parses raw chunk and fill inside data. This is used when reading + * (deserialization). Each particular chunk class implements its own logic. */ public abstract void parseFromRaw(ChunkRaw c); @@ -254,7 +264,8 @@ public abstract class PngChunk { *

* This is used when copying chunks from a reader to a writer *

- * It should normally be a deep copy, and after the cloning this.equals(other) should return true + * It should normally be a deep copy, and after the cloning + * this.equals(other) should return true */ public abstract void cloneDataFromRead(PngChunk other); diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java index b816db205..911513c0d 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java @@ -7,7 +7,8 @@ import jogamp.opengl.util.pngj.ImageInfo; *

* see http://www.w3.org/TR/PNG/#11IDAT *

- * This is dummy placeholder - we write/read this chunk (actually several) by special code. + * This is dummy placeholder - we write/read this chunk (actually several) by + * special code. */ public class PngChunkIDAT extends PngChunkMultiple { public final static String ID = ChunkHelper.IDAT; diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java index 696edd431..d44250a2f 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java @@ -17,7 +17,8 @@ public abstract class PngChunkMultiple extends PngChunk { } /** - * NOTE: this chunk uses the default Object's equals() hashCode() implementation. + * NOTE: this chunk uses the default Object's equals() hashCode() + * implementation. * * This is the right thing to do, normally. * diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java index 286f39db0..5247169e0 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java @@ -3,7 +3,8 @@ package jogamp.opengl.util.pngj.chunks; import jogamp.opengl.util.pngj.ImageInfo; /** - * PNG chunk type (abstract) that does not allow multiple instances in same image. + * PNG chunk type (abstract) that does not allow multiple instances in same + * image. */ public abstract class PngChunkSingle extends PngChunk { diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java index 52d1b22c1..ecf8b98c3 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java @@ -7,13 +7,13 @@ import jogamp.opengl.util.pngj.PngHelperInternal; import jogamp.opengl.util.pngj.PngjException; /** - * We consider "image metadata" every info inside the image except for the most basic image info (IHDR chunk - ImageInfo - * class) and the pixels values. + * We consider "image metadata" every info inside the image except for the most + * basic image info (IHDR chunk - ImageInfo class) and the pixels values. *

* This includes the palette (if present) and all the ancillary chunks *

- * This class provides a wrapper over the collection of chunks of a image (read or to write) and provides some high - * level methods to access them + * This class provides a wrapper over the collection of chunks of a image (read + * or to write) and provides some high level methods to access them */ public class PngMetadata { private final ChunksList chunkList; @@ -31,8 +31,9 @@ public class PngMetadata { /** * Queues the chunk at the writer *

- * lazyOverwrite: if true, checks if there is a queued "equivalent" chunk and if so, overwrites it. However if that - * not check for already written chunks. + * lazyOverwrite: if true, checks if there is a queued "equivalent" chunk + * and if so, overwrites it. However if that not check for already written + * chunks. */ public void queueChunk(final PngChunk c, boolean lazyOverwrite) { ChunksListForWrite cl = getChunkListW(); @@ -87,7 +88,8 @@ public class PngMetadata { * Creates a time chunk with current time, less secsAgo seconds *

* - * @return Returns the created-queued chunk, just in case you want to examine or modify it + * @return Returns the created-queued chunk, just in case you want to + * examine or modify it */ public PngChunkTIME setTimeNow(int secsAgo) { PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo); @@ -104,7 +106,8 @@ public class PngMetadata { * Creates a time chunk with diven date-time *

* - * @return Returns the created-queued chunk, just in case you want to examine or modify it + * @return Returns the created-queued chunk, just in case you want to + * examine or modify it */ public PngChunkTIME setTimeYMDHMS(int yearx, int monx, int dayx, int hourx, int minx, int secx) { PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo); @@ -137,7 +140,8 @@ public class PngMetadata { * (arbitrary, should be latin1 if useLatin1) * @param useLatin1 * @param compress - * @return Returns the created-queued chunks, just in case you want to examine, touch it + * @return Returns the created-queued chunks, just in case you want to + * examine, touch it */ public PngChunkTextVar setText(String k, String val, boolean useLatin1, boolean compress) { if (compress && !useLatin1) @@ -180,7 +184,8 @@ public class PngMetadata { } /** - * Returns empty if not found, concatenated (with newlines) if multiple! - and trimmed + * Returns empty if not found, concatenated (with newlines) if multiple! - + * and trimmed *

* Use getTxtsForKey() if you don't want this behaviour */ @@ -204,7 +209,8 @@ public class PngMetadata { } /** - * Creates a new empty palette chunk, queues it for write and return it to the caller, who should fill its entries + * Creates a new empty palette chunk, queues it for write and return it to + * the caller, who should fill its entries */ public PngChunkPLTE createPLTEChunk() { PngChunkPLTE plte = new PngChunkPLTE(chunkList.imageInfo); @@ -222,7 +228,8 @@ public class PngMetadata { } /** - * Creates a new empty TRNS chunk, queues it for write and return it to the caller, who should fill its entries + * Creates a new empty TRNS chunk, queues it for write and return it to the + * caller, who should fill its entries */ public PngChunkTRNS createTRNSChunk() { PngChunkTRNS trns = new PngChunkTRNS(chunkList.imageInfo); -- cgit v1.2.3 From 9b6efe652c8be325734c04cd6603d6014cbc886a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 3 Jul 2013 11:45:04 +0200 Subject: GLContext: Rename 2-digit VersionNumber statics aligning w/ all 3-digit names, e.g. Version31 -> Version310. ; Trim GLVersionNumber string. --- make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java | 2 +- .../com/jogamp/opengl/util/glsl/ShaderUtil.java | 2 +- src/jogl/classes/javax/media/opengl/GLContext.java | 20 ++++++++++---------- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 4 ++-- src/jogl/classes/jogamp/opengl/GLVersionNumber.java | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl') diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java index bfe2759c0..fbe7484c4 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java @@ -63,7 +63,7 @@ private final void initBufferObjectExtensionChecks() { haveGL15 = isExtensionAvailable("GL_VERSION_1_5"); haveGL21 = isExtensionAvailable("GL_VERSION_2_1"); haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object"); - haveARBVertexArrayObject = _context.getGLVersionNumber().compareTo(GLContext.Version30) >= 0 || + haveARBVertexArrayObject = _context.getGLVersionNumber().compareTo(GLContext.Version300) >= 0 || isExtensionAvailable("GL_ARB_vertex_array_object"); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java index 7d110659a..066b2054d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java @@ -221,7 +221,7 @@ public class ShaderUtil { /** Returns true if GeometryShader is supported, i.e. whether GLContext is ≥ 3.2 or ARB_geometry_shader4 extension is available. */ public static boolean isGeometryShaderSupported(GL _gl) { final GLContext ctx = _gl.getContext(); - return ctx.getGLVersionNumber().compareTo(GLContext.Version32) >= 0 || + return ctx.getGLVersionNumber().compareTo(GLContext.Version320) >= 0 || ctx.isExtensionAvailable(GLExtensions.ARB_geometry_shader4); } diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index cc37da0ff..84d371ac6 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -131,16 +131,16 @@ public abstract class GLContext { /* Version 1.50, i.e. GLSL 1.50 for GL 3.2. */ public static final VersionNumber Version150 = new VersionNumber(1, 50, 0); - /** Version 3.2. As an OpenGL version, it qualifies for geometry shader */ - public static final VersionNumber Version32 = new VersionNumber(3, 2, 0); + /** Version 3.0. As an OpenGL version, it qualifies for desktop {@link #isGL2()} only, or ES 3.0. */ + public static final VersionNumber Version300 = new VersionNumber(3, 0, 0); /** Version 3.1. As an OpenGL version, it qualifies for {@link #isGL3core()}, {@link #isGL3bc()} and {@link #isGL3()} */ - public static final VersionNumber Version31 = new VersionNumber(3, 1, 0); + public static final VersionNumber Version310 = new VersionNumber(3, 1, 0); - /** Version 3.0. As an OpenGL version, it qualifies for {@link #isGL2()} only */ - public static final VersionNumber Version30 = new VersionNumber(3, 0, 0); + /** Version 3.2. As an OpenGL version, it qualifies for geometry shader */ + public static final VersionNumber Version320 = new VersionNumber(3, 2, 0); - protected static final VersionNumber Version80 = new VersionNumber(8, 0, 0); + protected static final VersionNumber Version800 = new VersionNumber(8, 0, 0); /** ARB_create_context related: created via ARB_create_context. Cache key value. See {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ protected static final int CTX_IS_ARB_CREATED = 1 << 0; @@ -753,7 +753,7 @@ public abstract class GLContext { return ""; } final int minor = ctxGLSLVersion.getMinor(); - final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version30) >= 0 ? " es" : ""; + final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : ""; return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + esSuffix + "\n" ; } @@ -899,21 +899,21 @@ public abstract class GLContext { /** @see GLProfile#isGL3bc() */ public final boolean isGL3bc() { - return ctxVersion.compareTo(Version31) >= 0 + return ctxVersion.compareTo(Version310) >= 0 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & CTX_PROFILE_COMPAT); } /** @see GLProfile#isGL3() */ public final boolean isGL3() { - return ctxVersion.compareTo(Version31) >= 0 + return ctxVersion.compareTo(Version310) >= 0 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)); } /** Indicates whether this profile is capable of GL3 (core only). GL3 starts w/ OpenGL 3.1

Includes [ GL4, GL3 ].

*/ public final boolean isGL3core() { - return ctxVersion.compareTo(Version31) >= 0 + return ctxVersion.compareTo(Version310) >= 0 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & CTX_PROFILE_CORE); } diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index d6f97662e..956ba4659 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -671,7 +671,7 @@ public abstract class GLContextImpl extends GLContext { if( 0 == ( ctxOptions & GLContext.CTX_PROFILE_ES) ) { // not ES profile final int reqMajor; final int reqProfile; - if( ctxVersion.compareTo(Version30) <= 0 ) { + if( ctxVersion.compareTo(Version300) <= 0 ) { reqMajor = 2; } else { reqMajor = ctxVersion.getMajor(); @@ -1605,7 +1605,7 @@ public abstract class GLContextImpl extends GLContext { // final int quirk = GLRendererQuirks.DontCloseX11Display; if( glRenderer.contains(MesaSP) ) { - if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version80) < 0 ) { + if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version800) < 0 ) { if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11 Renderer=" + glRenderer + ", Version=[vendor " + vendorVersion + ", GL " + glVersion+"]"); } diff --git a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java index cea3ac4ab..e4187b35b 100644 --- a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java +++ b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java @@ -110,7 +110,7 @@ public class GLVersionNumber extends VersionNumberString { String str; { final GLVersionNumber glv = create(versionString); - str = versionString.substring(glv.endOfStringMatch()); + str = versionString.substring(glv.endOfStringMatch()).trim(); } while ( str.length() > 0 ) { @@ -120,7 +120,7 @@ public class GLVersionNumber extends VersionNumberString { if( version.hasMajor() && version.hasMinor() ) { // Requires at least a defined major and minor version component! return version; } - str = str.substring( eosm ); + str = str.substring( eosm ).trim(); } else { break; // no match } -- cgit v1.2.3