use initialized byteArrays, in case rows are padded
authorClaus Gittinger <cg@exept.de>
Wed, 12 Aug 1998 14:05:07 +0200
changeset 1037 90d38c8e3f5f
parent 1036 2df1ed9bea9a
child 1038 31c4f0f5a70b
use initialized byteArrays, in case rows are padded (avoid allocating unused colors).
GIFReader.st
TIFFRdr.st
TIFFReader.st
--- a/GIFReader.st	Tue Aug 11 22:03:17 1998 +0200
+++ b/GIFReader.st	Wed Aug 12 14:05:07 1998 +0200
@@ -707,7 +707,7 @@
     compressedSize := index - 1.
 
     h := height.
-    data := ByteArray uninitializedNew:((width + 1) * (h + 1)).
+    data := ByteArray new:((width + 1) * (h + 1)).
 "/    'GIFReader: decompressing ...' infoPrintCR.
 
     self class decompressGIFFrom:compressedData
@@ -718,7 +718,7 @@
 
     interlaced ifTrue:[
 "/    'GIFREADER: deinterlacing ...' infoPrintCR.
-        tmp := ByteArray uninitializedNew:(data size).
+        tmp := ByteArray new:(data size).
 
         "phase 1: 0, 8, 16, 24, ..."
 
@@ -762,7 +762,7 @@
     ].
 
     "Created: / 13.1.1998 / 10:44:05 / cg"
-    "Modified: / 1.4.1998 / 14:00:27 / cg"
+    "Modified: / 12.8.1998 / 13:55:32 / cg"
 ! !
 
 !GIFReader methodsFor:'writing to file'!
@@ -988,6 +988,6 @@
 !GIFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.71 1998-04-02 10:02:39 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.72 1998-08-12 12:05:07 cg Exp $'
 ! !
 GIFReader initialize!
--- a/TIFFRdr.st	Tue Aug 11 22:03:17 1998 +0200
+++ b/TIFFRdr.st	Wed Aug 12 14:05:07 1998 +0200
@@ -1154,7 +1154,7 @@
      (maybe other formats work also - its simply not
       tested)"
 
-    |bytesPerRow compressedStrip nPlanes 
+    |bytesPerRow compressedStrip nPlanes overAllBytes
      bytesPerStrip "{ Class: SmallInteger }"
      nBytes        "{ Class: SmallInteger }"
      prevSize      "{ Class: SmallInteger }"
@@ -1191,7 +1191,12 @@
 
 "/    'TIFFReader: decompressing LZW ...' infoPrintNL.
 
-    data := ByteArray uninitializedNew:(bytesPerRow * height).
+    overAllBytes := bytesPerRow * height.
+    bytesPerRow == width ifTrue:[
+        data := ByteArray uninitializedNew:overAllBytes.
+    ] ifFalse:[
+        data := ByteArray new:overAllBytes.
+    ].
 
     offset := 1.
     stripNr := 0.
@@ -1221,7 +1226,7 @@
         self class decodeDelta:3 in:data width:width height:height
     ]
 
-    "Modified: / 3.2.1998 / 18:10:33 / cg"
+    "Modified: / 12.8.1998 / 13:58:13 / cg"
 !
 
 readNeXTJPEGTiffImageData
@@ -1286,7 +1291,11 @@
     ].
 
     overAllBytes := bytesPerRow * height.
-    data := ByteArray uninitializedNew:overAllBytes.
+    bytesPerRow == width ifTrue:[
+        data := ByteArray uninitializedNew:overAllBytes.
+    ] ifFalse:[
+        data := ByteArray new:overAllBytes.
+    ].
 
     offset := 1.
     stripNr := 0.
@@ -1310,7 +1319,7 @@
         row := row + rowsPerStrip
     ]
 
-    "Modified: / 3.2.1998 / 18:11:35 / cg"
+    "Modified: / 12.8.1998 / 13:57:34 / cg"
 !
 
 readPixarFilmTiffImageData
@@ -1438,7 +1447,11 @@
     ].
 
     overAllBytes := bytesPerRow * height.
-    data := ByteArray uninitializedNew:overAllBytes.
+    bytesPerRow == width ifTrue:[
+        data := ByteArray uninitializedNew:overAllBytes.
+    ] ifFalse:[
+        data := ByteArray new:overAllBytes.
+    ].
 
     offset := 0.
     stripNr := 0.
@@ -1460,7 +1473,7 @@
         row := row + rowsPerStrip
     ]
 
-    "Modified: / 3.2.1998 / 18:13:16 / cg"
+    "Modified: / 12.8.1998 / 13:57:14 / cg"
 ! !
 
 !TIFFReader methodsFor:'private - reading'!
@@ -2183,6 +2196,6 @@
 !TIFFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.60 1998-05-11 20:50:26 tz Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.61 1998-08-12 12:04:45 cg Exp $'
 ! !
 TIFFReader initialize!
--- a/TIFFReader.st	Tue Aug 11 22:03:17 1998 +0200
+++ b/TIFFReader.st	Wed Aug 12 14:05:07 1998 +0200
@@ -1154,7 +1154,7 @@
      (maybe other formats work also - its simply not
       tested)"
 
-    |bytesPerRow compressedStrip nPlanes 
+    |bytesPerRow compressedStrip nPlanes overAllBytes
      bytesPerStrip "{ Class: SmallInteger }"
      nBytes        "{ Class: SmallInteger }"
      prevSize      "{ Class: SmallInteger }"
@@ -1191,7 +1191,12 @@
 
 "/    'TIFFReader: decompressing LZW ...' infoPrintNL.
 
-    data := ByteArray uninitializedNew:(bytesPerRow * height).
+    overAllBytes := bytesPerRow * height.
+    bytesPerRow == width ifTrue:[
+        data := ByteArray uninitializedNew:overAllBytes.
+    ] ifFalse:[
+        data := ByteArray new:overAllBytes.
+    ].
 
     offset := 1.
     stripNr := 0.
@@ -1221,7 +1226,7 @@
         self class decodeDelta:3 in:data width:width height:height
     ]
 
-    "Modified: / 3.2.1998 / 18:10:33 / cg"
+    "Modified: / 12.8.1998 / 13:58:13 / cg"
 !
 
 readNeXTJPEGTiffImageData
@@ -1286,7 +1291,11 @@
     ].
 
     overAllBytes := bytesPerRow * height.
-    data := ByteArray uninitializedNew:overAllBytes.
+    bytesPerRow == width ifTrue:[
+        data := ByteArray uninitializedNew:overAllBytes.
+    ] ifFalse:[
+        data := ByteArray new:overAllBytes.
+    ].
 
     offset := 1.
     stripNr := 0.
@@ -1310,7 +1319,7 @@
         row := row + rowsPerStrip
     ]
 
-    "Modified: / 3.2.1998 / 18:11:35 / cg"
+    "Modified: / 12.8.1998 / 13:57:34 / cg"
 !
 
 readPixarFilmTiffImageData
@@ -1438,7 +1447,11 @@
     ].
 
     overAllBytes := bytesPerRow * height.
-    data := ByteArray uninitializedNew:overAllBytes.
+    bytesPerRow == width ifTrue:[
+        data := ByteArray uninitializedNew:overAllBytes.
+    ] ifFalse:[
+        data := ByteArray new:overAllBytes.
+    ].
 
     offset := 0.
     stripNr := 0.
@@ -1460,7 +1473,7 @@
         row := row + rowsPerStrip
     ]
 
-    "Modified: / 3.2.1998 / 18:13:16 / cg"
+    "Modified: / 12.8.1998 / 13:57:14 / cg"
 ! !
 
 !TIFFReader methodsFor:'private - reading'!
@@ -2183,6 +2196,6 @@
 !TIFFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.60 1998-05-11 20:50:26 tz Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.61 1998-08-12 12:04:45 cg Exp $'
 ! !
 TIFFReader initialize!