< prev index next >
src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2000, 2013, 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, 2016, 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
*** 935,950 ****
// 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);
-
- // If read has been aborted, just return
- // processReadAborted will be called later
- if (abortRequested()) {
- return;
- }
}
}
private void updateImageProgress(int newPixels) {
pixelsDone += newPixels;
--- 935,944 ----
*** 994,1003 ****
--- 988,1004 ----
// If no pixels need updating, just skip the input data
if (updateWidth == 0) {
for (int srcY = 0; srcY < passHeight; srcY++) {
// Update count of pixels read
updateImageProgress(passWidth);
+ /*
+ * If read has been aborted, just return
+ * processReadAborted will be called later
+ */
+ if (abortRequested()) {
+ return;
+ }
// Skip filter byte and the remaining row bytes
pixelStream.skipBytes(1 + bytesPerRow);
}
return;
}
*** 1103,1113 ****
// Decode the (sub)image row-by-row
for (int srcY = 0; srcY < passHeight; srcY++) {
// Update count of pixels read
updateImageProgress(passWidth);
!
// Read the filter type byte and a row of data
int filter = pixelStream.read();
try {
// Swap curr and prior
byte[] tmp = prior;
--- 1104,1120 ----
// Decode the (sub)image row-by-row
for (int srcY = 0; srcY < passHeight; srcY++) {
// Update count of pixels read
updateImageProgress(passWidth);
! /*
! * If read has been aborted, just return
! * processReadAborted will be called later
! */
! if (abortRequested()) {
! return;
! }
// Read the filter type byte and a row of data
int filter = pixelStream.read();
try {
// Swap curr and prior
byte[] tmp = prior;
*** 1193,1208 ****
processImageUpdate(theImage,
updateMinX, dstY,
updateWidth, 1,
updateXStep, updateYStep,
destinationBands);
-
- // If read has been aborted, just return
- // processReadAborted will be called later
- if (abortRequested()) {
- return;
- }
}
}
processPassComplete(theImage);
}
--- 1200,1209 ----
*** 1213,1224 ****
int height = metadata.IHDR_height;
this.pixelsDone = 0;
this.totalPixels = width*height;
- clearAbortRequest();
-
if (metadata.IHDR_interlaceMethod == 0) {
decodePass(0, 0, 0, 1, 1, width, height);
} else {
for (int i = 0; i <= sourceMaxProgressivePass; i++) {
int XOffset = adam7XOffset[i];
--- 1214,1223 ----
*** 1239,1250 ****
} else {
skipPass((width + xbump)/XSubsampling,
(height + ybump)/YSubsampling);
}
! // If read has been aborted, just return
! // processReadAborted will be called later
if (abortRequested()) {
return;
}
}
}
--- 1238,1251 ----
} else {
skipPass((width + xbump)/XSubsampling,
(height + ybump)/YSubsampling);
}
! /*
! * If read has been aborted, just return
! * processReadAborted will be called later
! */
if (abortRequested()) {
return;
}
}
}
*** 1330,1346 ****
--- 1331,1353 ----
int colorType = metadata.IHDR_colorType;
checkReadParamBandSettings(param,
inputBandsForColorType[colorType],
theImage.getSampleModel().getNumBands());
+ clearAbortRequest();
processImageStarted(0);
+ if (abortRequested()) {
+ processReadAborted();
+ } else {
decodeImage();
if (abortRequested()) {
processReadAborted();
} else {
processImageComplete();
}
+ }
+
} catch (IOException e) {
throw new IIOException("Error reading PNG image data", e);
} finally {
if (inf != null) {
inf.end();
< prev index next >