< prev index next >
src/java.desktop/share/classes/sun/awt/image/PNGImageDecoder.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1999, 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) 1999, 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
*** 74,84 ****
*/
private ColorModel cm;
private byte[] red_map, green_map, blue_map, alpha_map;
private int transparentPixel = -1;
private byte[] transparentPixel_16 = null; // we need 6 bytes to store 16bpp value
! private static ColorModel greyModels[] = new ColorModel[4];
/* this is not needed
PNGImageDecoder next;
*/
private void property(String key,Object value) {
--- 74,84 ----
*/
private ColorModel cm;
private byte[] red_map, green_map, blue_map, alpha_map;
private int transparentPixel = -1;
private byte[] transparentPixel_16 = null; // we need 6 bytes to store 16bpp value
! private static ColorModel[] greyModels = new ColorModel[4];
/* this is not needed
PNGImageDecoder next;
*/
private void property(String key,Object value) {
*** 285,295 ****
case GRAY:
{ int llog = logDepth>=4 ? 3 : logDepth;
if((cm=greyModels[llog]) == null) {
int size = 1<<(1<<llog);
! byte ramp[] = new byte[size];
for(int i = 0; i<size; i++) ramp[i] = (byte)(255*i/(size-1));
if (transparentPixel == -1) {
cm = new IndexColorModel(bitDepth,ramp.length,ramp,ramp,ramp);
} else {
--- 285,295 ----
case GRAY:
{ int llog = logDepth>=4 ? 3 : logDepth;
if((cm=greyModels[llog]) == null) {
int size = 1<<(1<<llog);
! byte[] ramp = new byte[size];
for(int i = 0; i<size; i++) ramp[i] = (byte)(255*i/(size-1));
if (transparentPixel == -1) {
cm = new IndexColorModel(bitDepth,ramp.length,ramp,ramp,ramp);
} else {
*** 562,572 ****
aborted = true;
}
return !aborted;
}
! private void filterRow(byte rowByteBuffer[], byte[] prevRow,
int rowFilter, int rowByteWidth, int bytesPerSample)
throws IOException {
int x = 0;
switch (rowFilter) {
case 0:
--- 562,572 ----
aborted = true;
}
return !aborted;
}
! private void filterRow(byte[] rowByteBuffer, byte[] prevRow,
int rowFilter, int rowByteWidth, int bytesPerSample)
throws IOException {
int x = 0;
switch (rowFilter) {
case 0:
*** 682,692 ****
private boolean need(int n) throws IOException {
if(limit-pos>=n) return true;
fill();
if(limit-pos>=n) return true;
if(seenEOF) return false;
! byte nin[] = new byte[n+100];
System.arraycopy(inbuf,pos,nin,0,limit-pos);
limit = limit-pos;
pos = 0;
inbuf = nin;
fill();
--- 682,692 ----
private boolean need(int n) throws IOException {
if(limit-pos>=n) return true;
fill();
if(limit-pos>=n) return true;
if(seenEOF) return false;
! byte[] nin = new byte[n+100];
System.arraycopy(inbuf,pos,nin,0,limit-pos);
limit = limit-pos;
pos = 0;
inbuf = nin;
fill();
< prev index next >