From 4b77d1c22a0f14f06e5c8628af4782de144e5b8b Mon Sep 17 00:00:00 2001 From: Harald Kuhr Date: Thu, 13 Oct 2011 09:55:02 +0200 Subject: [PATCH] Clean-up, no functional change. --- .../com/twelvemonkeys/image/ImageUtil.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/ImageUtil.java b/common/common-image/src/main/java/com/twelvemonkeys/image/ImageUtil.java index bcfeeb43..4e057543 100644 --- a/common/common-image/src/main/java/com/twelvemonkeys/image/ImageUtil.java +++ b/common/common-image/src/main/java/com/twelvemonkeys/image/ImageUtil.java @@ -535,27 +535,27 @@ public final class ImageUtil { * * @param pOriginal the orignal image * @param pModel the original color model - * @param mWidth the requested width of the raster - * @param mHeight the requested height of the raster + * @param width the requested width of the raster + * @param height the requested height of the raster * * @return a new WritableRaster */ - static WritableRaster createCompatibleWritableRaster(BufferedImage pOriginal, ColorModel pModel, int mWidth, int mHeight) { + static WritableRaster createCompatibleWritableRaster(BufferedImage pOriginal, ColorModel pModel, int width, int height) { if (pModel == null || equals(pOriginal.getColorModel(), pModel)) { int[] bOffs; switch (pOriginal.getType()) { case BufferedImage.TYPE_3BYTE_BGR: bOffs = new int[]{2, 1, 0}; // NOTE: These are reversed from what the cm.createCompatibleWritableRaster would return return Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, - mWidth, mHeight, - mWidth * 3, 3, + width, height, + width * 3, 3, bOffs, null); case BufferedImage.TYPE_4BYTE_ABGR: case BufferedImage.TYPE_4BYTE_ABGR_PRE: bOffs = new int[] {3, 2, 1, 0}; // NOTE: These are reversed from what the cm.createCompatibleWritableRaster would return return Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, - mWidth, mHeight, - mWidth * 4, 4, + width, height, + width * 4, 4, bOffs, null); case BufferedImage.TYPE_CUSTOM: // Peek into the sample model to see if we have a sample model that will be incompatible with the default case @@ -563,16 +563,17 @@ public final class ImageUtil { if (sm instanceof ComponentSampleModel) { bOffs = ((ComponentSampleModel) sm).getBandOffsets(); return Raster.createInterleavedRaster(sm.getDataType(), - mWidth, mHeight, - mWidth * bOffs.length, bOffs.length, + width, height, + width * bOffs.length, bOffs.length, bOffs, null); } // Else fall through default: - return pOriginal.getColorModel().createCompatibleWritableRaster(mWidth, mHeight); + return pOriginal.getColorModel().createCompatibleWritableRaster(width, height); } } - return pModel.createCompatibleWritableRaster(mWidth, mHeight); + + return pModel.createCompatibleWritableRaster(width, height); } /**