< prev index next >

src/java.desktop/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2005, 2014, 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) 2005, 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
*** 572,582 **** private void write(boolean writeHeader, boolean writeTrailer, IIOMetadata sm, IIOImage iioimage, ImageWriteParam p) throws IOException { - clearAbortRequest(); RenderedImage image = iioimage.getRenderedImage(); // Check for ability to encode image. if (needToCreateIndex(image)) { --- 572,581 ----
*** 827,841 **** Raster raster = image.getNumXTiles() == 1 && image.getNumYTiles() == 1 ? image.getTile(0, 0) : image.getData(); for (int y = dy; y < dh; y += ddy) { if (numRowsWritten % progressReportRowPeriod == 0) { if (abortRequested()) { processWriteAborted(); return; } - processImageProgress((numRowsWritten*100.0F)/dh); } raster.getSamples(sx, sy, sw, 1, 0, sbuf); for (int i = 0, j = 0; i < dw; i++, j += sdx) { dbuf[i] = (byte)sbuf[j]; --- 826,840 ---- Raster raster = image.getNumXTiles() == 1 && image.getNumYTiles() == 1 ? image.getTile(0, 0) : image.getData(); for (int y = dy; y < dh; y += ddy) { if (numRowsWritten % progressReportRowPeriod == 0) { + processImageProgress((numRowsWritten*100.0F)/dh); if (abortRequested()) { processWriteAborted(); return; } } raster.getSamples(sx, sy, sw, 1, 0, sbuf); for (int i = 0, j = 0; i < dw; i++, j += sdx) { dbuf[i] = (byte)sbuf[j];
*** 855,869 **** offset += dy*lineStride; lineStride *= ddy; for (int y = dy; y < dh; y += ddy) { if (numRowsWritten % progressReportRowPeriod == 0) { if (abortRequested()) { processWriteAborted(); return; } - processImageProgress((numRowsWritten*100.0F)/dh); } compressor.compress(data, offset, dw); numRowsWritten++; offset += lineStride; --- 854,868 ---- offset += dy*lineStride; lineStride *= ddy; for (int y = dy; y < dh; y += ddy) { if (numRowsWritten % progressReportRowPeriod == 0) { + processImageProgress((numRowsWritten*100.0F)/dh); if (abortRequested()) { processWriteAborted(); return; } } compressor.compress(data, offset, dw); numRowsWritten++; offset += lineStride;
*** 922,932 **** --- 921,936 ---- int numRowsWritten = 0; int progressReportRowPeriod = Math.max(destHeight/20, 1); + clearAbortRequest(); processImageStarted(imageIndex); + if (abortRequested()) { + processWriteAborted(); + return; + } if (interlaceFlag) { if (DEBUG) System.out.println("Writing interlaced"); if (isOptimizedCase) {
*** 971,980 **** --- 975,987 ---- numRowsWritten += (destHeight - 2)/4; writeRowsOpt(data, offset, lineStride, compressor, 1, 2, destWidth, destHeight, numRowsWritten, progressReportRowPeriod); + if (abortRequested()) { + return; + } } else { writeRows(image, compressor, sourceXOffset, periodX, sourceYOffset, 8*periodY, sourceWidth,
*** 1014,1023 **** --- 1021,1033 ---- writeRows(image, compressor, sourceXOffset, periodX, sourceYOffset + periodY, 2*periodY, sourceWidth, 1, 2, destWidth, destHeight, numRowsWritten, progressReportRowPeriod); + if (abortRequested()) { + return; + } } } else { if (DEBUG) System.out.println("Writing non-interlaced"); if (isOptimizedCase) {
*** 1029,1053 **** int lineStride = csm.getScanlineStride(); writeRowsOpt(data, offset, lineStride, compressor, 0, 1, destWidth, destHeight, numRowsWritten, progressReportRowPeriod); } else { writeRows(image, compressor, sourceXOffset, periodX, sourceYOffset, periodY, sourceWidth, 0, 1, destWidth, destHeight, numRowsWritten, progressReportRowPeriod); - } - } - if (abortRequested()) { return; } ! ! processImageProgress(100.0F); compressor.flush(); stream.write(0x00); --- 1039,1063 ---- int lineStride = csm.getScanlineStride(); writeRowsOpt(data, offset, lineStride, compressor, 0, 1, destWidth, destHeight, numRowsWritten, progressReportRowPeriod); + if (abortRequested()) { + return; + } } else { writeRows(image, compressor, sourceXOffset, periodX, sourceYOffset, periodY, sourceWidth, 0, 1, destWidth, destHeight, numRowsWritten, progressReportRowPeriod); if (abortRequested()) { return; } ! } ! } compressor.flush(); stream.write(0x00);
< prev index next >