Mercurial > projects > dwt-mac
diff dwt/internal/image/PNGFileFormat.d @ 7:e831403a80a9
Add 'cast' to casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:30:35 +0200 |
parents | b903c16b6f48 |
children | 5123b17c98ef |
line wrap: on
line diff
--- a/dwt/internal/image/PNGFileFormat.d Wed Aug 27 14:10:03 2008 +0200 +++ b/dwt/internal/image/PNGFileFormat.d Wed Aug 27 14:30:35 2008 +0200 @@ -97,12 +97,12 @@ break; case PngChunk.CHUNK_PLTE: if (!headerChunk.usesDirectColor()) { - paletteChunk = (PngPlteChunk) chunk; + paletteChunk = cast(PngPlteChunk) chunk; imageData.palette = paletteChunk.getPaletteData(); } break; case PngChunk.CHUNK_tRNS: - PngTrnsChunk trnsChunk = (PngTrnsChunk) chunk; + PngTrnsChunk trnsChunk = cast(PngTrnsChunk) chunk; if (trnsChunk.getTransparencyType(headerChunk) is PngTrnsChunk.TRANSPARENCY_TYPE_PIXEL) { @@ -135,7 +135,7 @@ } else { // Read in the pixel data for the image. This should // go through all the image's IDAT chunks. - PngIdatChunk dataChunk = (PngIdatChunk) chunk; + PngIdatChunk dataChunk = cast(PngIdatChunk) chunk; readPixelData(dataChunk, chunkReader); } break; @@ -380,7 +380,7 @@ byte[] currentRow = row1; byte[] lastRow = row2; for (int row = startRow; row < height; row += rowInterval) { - byte filterType = (byte)inputStream.read(); + byte filterType = cast(byte)inputStream.read(); int read = 0; while (read !is bytesPerRow) { read += inputStream.read(currentRow, read, bytesPerRow - read); @@ -445,7 +445,7 @@ */ void fireInterlacedFrameEvent(int frameCount) { if (loader.hasListeners()) { - ImageData image = (ImageData) imageData.clone(); + ImageData image = cast(ImageData) imageData.clone(); bool finalFrame = frameCount is 6; loader.notifyListeners(new ImageLoaderEvent(loader, image, frameCount, finalFrame)); } @@ -465,7 +465,7 @@ byte[] lastRow = row2; int height = headerChunk.getHeight(); for (int row = 0; row < height; row++) { - byte filterType = (byte)inputStream.read(); + byte filterType = cast(byte)inputStream.read(); int read = 0; while (read !is bytesPerRow) { read += inputStream.read(currentRow, read, bytesPerRow - read); @@ -499,7 +499,7 @@ int sourceIndex = sourceOffset + (2 * i); int destinationIndex = destinationOffset + i; //int value = (source[sourceIndex] << 8) | source[sourceIndex + 1]; - //byte compressedValue = (byte)(value * multiplier); + //byte compressedValue = cast(byte)(value * multiplier); byte compressedValue = source[sourceIndex]; destination[destinationIndex] = compressedValue; } @@ -515,7 +515,7 @@ */ static int compress16BitDepthTo8BitDepth(int value) { //double multiplier = (Compatibility.pow2(8) - 1) / (Compatibility.pow2(16) - 1); - //byte compressedValue = (byte)(value * multiplier); + //byte compressedValue = cast(byte)(value * multiplier); return value >> 8; } /** @@ -532,14 +532,14 @@ for (int i = byteOffset; i < row.length; i++) { int current = row[i] & 0xFF; int left = row[i - byteOffset] & 0xFF; - row[i] = (byte)((current + left) & 0xFF); + row[i] = cast(byte)((current + left) & 0xFF); } break; case PngIhdrChunk.FILTER_UP: for (int i = 0; i < row.length; i++) { int current = row[i] & 0xFF; int above = previousRow[i] & 0xFF; - row[i] = (byte)((current + above) & 0xFF); + row[i] = cast(byte)((current + above) & 0xFF); } break; case PngIhdrChunk.FILTER_AVERAGE: @@ -547,7 +547,7 @@ int left = (i < byteOffset) ? 0 : row[i - byteOffset] & 0xFF; int above = previousRow[i] & 0xFF; int current = row[i] & 0xFF; - row[i] = (byte)((current + ((left + above) / 2)) & 0xFF); + row[i] = cast(byte)((current + ((left + above) / 2)) & 0xFF); } break; case PngIhdrChunk.FILTER_PAETH: @@ -570,7 +570,7 @@ } int currentValue = row[i] & 0xFF; - row[i] = (byte) ((currentValue + preductor) & 0xFF); + row[i] = cast(byte) ((currentValue + preductor) & 0xFF); } break; }