< prev index next >
src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -154,10 +154,14 @@
throw new IllegalArgumentException(I18N.getString("BMPImageWriter8"));
}
clearAbortRequest();
processImageStarted(0);
+ if (abortRequested()) {
+ processWriteAborted();
+ return;
+ }
if (param == null)
param = getDefaultWriteParam();
BMPImageWriteParam bmpParam = (BMPImageWriteParam)param;
@@ -581,16 +585,12 @@
writeSize(imageSize, 34);
stream.seek(endPos);
stream.write(embedded_stream.toByteArray());
embedded_stream = null;
- if (abortRequested()) {
- processWriteAborted();
- } else {
processImageComplete();
stream.flushBefore(stream.getStreamPosition());
- }
return;
}
int maxBandOffset = bandOffsets[0];
@@ -604,13 +604,10 @@
if (noTransform && noSubband) {
destScanlineLength = destScanlineBytes / (DataBuffer.getDataTypeSize(dataType)>>3);
}
for (int i = 0; i < h; i++) {
- if (abortRequested()) {
- break;
- }
int row = minY + i;
if (!isTopDown)
row = minY + h - i -1;
@@ -722,10 +719,13 @@
writePixels(0, scanlineBytes, bitsPerPixel, pixels,
padding, numBands, icm);
}
processImageProgress(100.0f * (((float)i) / ((float)h)));
+ if (abortRequested()) {
+ break;
+ }
}
if (compressionType == BI_RLE4 ||
compressionType == BI_RLE8) {
// Write the RLE EOF marker and
< prev index next >