Mercurial > projects > dwt-mac
comparison dwt/internal/image/PngTrnsChunk.d @ 7:e831403a80a9
Add 'cast' to casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:30:35 +0200 |
parents | 1a8b3cb347e0 |
children | 5123b17c98ef |
comparison
equal
deleted
inserted
replaced
6:b903c16b6f48 | 7:e831403a80a9 |
---|---|
38 | 38 |
39 void validateLength(PngIhdrChunk header, PngPlteChunk paletteChunk) { | 39 void validateLength(PngIhdrChunk header, PngPlteChunk paletteChunk) { |
40 bool valid; | 40 bool valid; |
41 switch (header.getColorType()) { | 41 switch (header.getColorType()) { |
42 case PngIhdrChunk.COLOR_TYPE_RGB: | 42 case PngIhdrChunk.COLOR_TYPE_RGB: |
43 // Three 2-byte values (RGB) | 43 // Three 2-byte values cast(RGB) |
44 valid = getLength() is 6; | 44 valid = getLength() is 6; |
45 break; | 45 break; |
46 case PngIhdrChunk.COLOR_TYPE_PALETTE: | 46 case PngIhdrChunk.COLOR_TYPE_PALETTE: |
47 // Three 2-byte values (RGB) | 47 // Three 2-byte values cast(RGB) |
48 valid = getLength() <= paletteChunk.getLength(); | 48 valid = getLength() <= paletteChunk.getLength(); |
49 break; | 49 break; |
50 case PngIhdrChunk.COLOR_TYPE_GRAYSCALE: | 50 case PngIhdrChunk.COLOR_TYPE_GRAYSCALE: |
51 // One 2-byte value | 51 // One 2-byte value |
52 valid = getLength() is 2; | 52 valid = getLength() is 2; |
145 * Any palette entries which do not have a corresponding | 145 * Any palette entries which do not have a corresponding |
146 * alpha value in the tRNS chunk are spec'd to have an | 146 * alpha value in the tRNS chunk are spec'd to have an |
147 * alpha of 255. | 147 * alpha of 255. |
148 */ | 148 */ |
149 for (int j = i; j < alphas.length; j++) { | 149 for (int j = i; j < alphas.length; j++) { |
150 alphas[j] = (byte) 255; | 150 alphas[j] = cast(byte) 255; |
151 } | 151 } |
152 return alphas; | 152 return alphas; |
153 } | 153 } |
154 } | 154 } |