diff dwt/internal/image/JPEGScanHeader.d @ 34:5123b17c98ef

Ported dwt.events.*, dwt.graphics.GC, Region, dwt.internal.image.*
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sun, 14 Sep 2008 01:45:57 +0200
parents e831403a80a9
children
line wrap: on
line diff
--- a/dwt/internal/image/JPEGScanHeader.d	Fri Sep 12 13:53:21 2008 +0200
+++ b/dwt/internal/image/JPEGScanHeader.d	Sun Sep 14 01:45:57 2008 +0200
@@ -7,11 +7,16 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
-module dwt.internal.image;
-
+module dwt.internal.image.JPEGScanHeader;
 
 import dwt.DWT;
+import dwt.internal.image.JPEGVariableSizeSegment;
+import dwt.internal.image.LEDataInputStream;
+import dwt.internal.image.JPEGFileFormat;
+import dwt.dwthelper.utils;
 
 final class JPEGScanHeader : JPEGVariableSizeSegment {
     public int[][] componentParameters;
@@ -48,18 +53,18 @@
 /* Used when decoding. */
 void initializeComponentParameters() {
     int compCount = getNumberOfImageComponents();
-    componentParameters = new int[0][];
+    componentParameters = null;
     for (int i = 0; i < compCount; i++) {
         int ofs = 5 + i * 2;
         int cid = reference[ofs] & 0xFF;
         int dc = (reference[ofs + 1] & 0xFF) >> 4;
         int ac = reference[ofs + 1] & 0xF;
         if (componentParameters.length <= cid) {
-            int[][] newParams = new int[cid + 1][];
+            int[][] newParams = new int[][](cid + 1);
             System.arraycopy(componentParameters, 0, newParams, 0, componentParameters.length);
             componentParameters = newParams;
         }
-        componentParameters[cid] = new int[] { dc, ac };
+        componentParameters[cid] = [ dc, ac ];
     }
 }
 
@@ -90,7 +95,7 @@
     reference[(2 * getNumberOfImageComponents()) + 5] = cast(byte)anInteger;
 }
 
-public int signature() {
+public override int signature() {
     return JPEGFileFormat.SOS;
 }