< prev index next >

src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 995,1005 **** if ((passWidth == 0) || (passHeight == 0)) { return; } int inputBands = inputBandsForColorType[metadata.IHDR_colorType]; ! int bytesPerRow = (inputBands*passWidth*metadata.IHDR_bitDepth + 7)/8; // Read the image row-by-row for (int srcY = 0; srcY < passHeight; srcY++) { // Skip filter byte and the remaining row bytes pixelStream.skipBytes(1 + bytesPerRow); --- 995,1007 ---- if ((passWidth == 0) || (passHeight == 0)) { return; } int inputBands = inputBandsForColorType[metadata.IHDR_colorType]; ! int bitsPerRow = Math. ! multiplyExact((inputBands * metadata.IHDR_bitDepth), passWidth); ! int bytesPerRow = (bitsPerRow + 7) / 8; // Read the image row-by-row for (int srcY = 0; srcY < passHeight; srcY++) { // Skip filter byte and the remaining row bytes pixelStream.skipBytes(1 + bytesPerRow);
*** 1046,1056 **** int bitDepth = metadata.IHDR_bitDepth; int inputBands = inputBandsForColorType[metadata.IHDR_colorType]; int bytesPerPixel = (bitDepth == 16) ? 2 : 1; bytesPerPixel *= inputBands; ! int bytesPerRow = (inputBands*passWidth*bitDepth + 7)/8; int eltsPerRow = (bitDepth == 16) ? bytesPerRow/2 : bytesPerRow; // If no pixels need updating, just skip the input data if (updateWidth == 0) { for (int srcY = 0; srcY < passHeight; srcY++) { --- 1048,1059 ---- int bitDepth = metadata.IHDR_bitDepth; int inputBands = inputBandsForColorType[metadata.IHDR_colorType]; int bytesPerPixel = (bitDepth == 16) ? 2 : 1; bytesPerPixel *= inputBands; ! int bitsPerRow = Math.multiplyExact((inputBands * bitDepth), passWidth); ! int bytesPerRow = (bitsPerRow + 7) / 8; int eltsPerRow = (bitDepth == 16) ? bytesPerRow/2 : bytesPerRow; // If no pixels need updating, just skip the input data if (updateWidth == 0) { for (int srcY = 0; srcY < passHeight; srcY++) {
< prev index next >