Changeset 213:36f5cb12e1a2 for dwt/internal/image/PngChunk.d
- Timestamp:
- 05/17/08 11:34:28 (6 months ago)
- Files:
-
- dwt/internal/image/PngChunk.d (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dwt/internal/image/PngChunk.d
r212 r213 22 22 import dwt.internal.image.PngIendChunk; 23 23 import dwt.internal.image.PngTrnsChunk; 24 import dwt.dwthelper.utils; 24 25 25 26 import tango.core.Exception; 26 27 import tango.text.convert.Format; 27 import dwt.dwthelper.System;28 import dwt.dwthelper.utils;29 28 30 29 class PngChunk { … … 54 53 static const byte[] TYPE_tRNS = cast(byte[])"tRNS";//{(byte) 't', (byte) 'R', (byte) 'N', (byte) 'S'}; 55 54 56 private static /+const+/ int[] CRC_TABLE; 57 private static bool static_this_completed = false; 58 private static void static_this() { 59 if( static_this_completed ){ 60 return; 61 } 62 synchronized { 63 if( static_this_completed ){ 64 return; 65 } 66 CRC_TABLE = new int[256]; 67 for (int i = 0; i < 256; i++) { 68 CRC_TABLE[i] = i; 69 for (int j = 0; j < 8; j++) { 70 if ((CRC_TABLE[i] & 0x1) is 0) { 71 CRC_TABLE[i] = (CRC_TABLE[i] >> 1) & 0x7FFFFFFF; 72 } else { 73 CRC_TABLE[i] = 0xEDB88320 ^ ((CRC_TABLE[i] >> 1) & 0x7FFFFFFF); 74 } 55 static const int[] CRC_TABLE; 56 //public static void static_this() { 57 static this() { 58 CRC_TABLE = new int[256]; 59 for (int i = 0; i < 256; i++) { 60 CRC_TABLE[i] = i; 61 for (int j = 0; j < 8; j++) { 62 if ((CRC_TABLE[i] & 0x1) is 0) { 63 CRC_TABLE[i] = (CRC_TABLE[i] >> 1) & 0x7FFFFFFF; 64 } else { 65 CRC_TABLE[i] = 0xEDB88320 ^ ((CRC_TABLE[i] >> 1) & 0x7FFFFFFF); 75 66 } 76 67 } 77 static_this_completed = true;78 68 } 79 69 } … … 86 76 */ 87 77 this(byte[] reference) { 88 static_this();89 78 setReference(reference); 90 79 if (reference.length < LENGTH_OFFSET + LENGTH_FIELD_LENGTH) DWT.error(DWT.ERROR_INVALID_IMAGE); … … 386 375 * @return a string representation of the event 387 376 */ 388 override publicString toString() {377 public override String toString() { 389 378 String buffer = Format( "{\n\tLength: {}\n\tType: {}{}\n\tCRC: {:X}\n}", 390 379 getLength(),
