Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/java.desktop/aix/classes/sun/awt/X11InputMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
public abstract class X11InputMethod extends X11InputMethodBase {

// to keep the instance of activating if IM resumed
static protected X11InputMethod activatedInstance = null;
protected static X11InputMethod activatedInstance = null;

/**
* Constructs an X11InputMethod instance. It initializes the XIM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*
* @see DesktopPeer
*/
final public class CDesktopPeer implements DesktopPeer {
public final class CDesktopPeer implements DesktopPeer {

@Override
public boolean isSupported(Action action) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import java.awt.Taskbar.Feature;
import java.awt.peer.TaskbarPeer;

final public class CTaskbarPeer implements TaskbarPeer {
public final class CTaskbarPeer implements TaskbarPeer {

CTaskbarPeer() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class CTrayIcon extends CFRetainedResource implements TrayIconPeer {
// events between MOUSE_PRESSED and MOUSE_RELEASED for particular button
private static int mouseClickButtons = 0;

private final static boolean useTemplateImages = AccessController.doPrivileged((PrivilegedAction<Boolean>)
private static final boolean useTemplateImages = AccessController.doPrivileged((PrivilegedAction<Boolean>)
() -> Boolean.getBoolean("apple.awt.enableTemplateImages")
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public final class JavaSoundAudioClip implements AudioClip, MetaEventListener, L
*
*/
private static final long CLIP_THRESHOLD = 1048576;
//private final static long CLIP_THRESHOLD = 1;
private static final int STREAM_BUFFER_SIZE = 1024;

public static JavaSoundAudioClip create(final URLConnection uc) {
Expand Down
4 changes: 2 additions & 2 deletions src/java.desktop/share/classes/java/awt/EventQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,8 @@ public SecondaryLoop createSecondaryLoop() {
}

private class FwSecondaryLoopWrapper implements SecondaryLoop {
final private SecondaryLoop loop;
final private EventFilter filter;
private final SecondaryLoop loop;
private final EventFilter filter;

public FwSecondaryLoopWrapper(SecondaryLoop loop, EventFilter filter) {
this.loop = loop;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public long getOwnerID(DialogOwner owner) {
}
}

static private Accessor accessor = new Accessor();
private static Accessor accessor = new Accessor();
static {
DialogOwnerAccessor.setAccessor(accessor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ public File[] getChooserComboBoxFiles() {
* possibly empty if there are no appropriate permissions.
* @since 12
*/
final public File[] getChooserShortcutPanelFiles() {
public final File[] getChooserShortcutPanelFiles() {
return (File[]) ShellFolder.get("fileChooserShortcutPanelFolders");
}

Expand Down
127 changes: 7 additions & 120 deletions src/java.desktop/share/classes/sun/awt/image/PNGImageDecoder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright year in other files might be updated as well.

* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -33,11 +33,6 @@

/** PNG - Portable Network Graphics - image file reader.
See <a href=http://www.ietf.org/rfc/rfc2083.txt>RFC2083</a> for details. */

/* this is changed
public class PNGImageDecoder extends FilterInputStream implements Runnable
{ */

public class PNGImageDecoder extends ImageDecoder
{
private static final int GRAY=0;
Expand Down Expand Up @@ -69,18 +64,11 @@ public class PNGImageDecoder extends ImageDecoder
private int interlaceMethod;
private int gamma = 100000;
private java.util.Hashtable<String, Object> properties;
/* this is not needed
ImageConsumer target;
*/
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) {
if(value==null) return;
if(properties==null) properties=new java.util.Hashtable<>();
Expand Down Expand Up @@ -153,9 +141,6 @@ protected boolean handleChunk(int key, byte[] buf, int st, int len)
compressionMethod = getByte(st+10);
filterMethod = getByte(st+11);
interlaceMethod = getByte(st+12);
/* this is not needed
if(target!=null) target.setDimensions(width,height);
*/
break;
case PLTEChunk:
{ int tsize = len/3;
Expand Down Expand Up @@ -235,14 +220,7 @@ protected boolean handleChunk(int key, byte[] buf, int st, int len)
public class PNGException extends IOException {
PNGException(String s) { super(s); }
}
/* this is changed
public void run() {
*/
public void produceImage() throws IOException, ImageFormatException {
/* this is not needed
ImageConsumer t = target;
if(t!=null) try {
*/
try {
for(int i=0; i<signature.length; i++)
if((signature[i]&0xFF)!=underlyingInputStream.read())
Expand Down Expand Up @@ -310,14 +288,6 @@ public void produceImage() throws IOException, ImageFormatException {
default:
throw new PNGException("invalid color type");
}
/* this is going to be set in the pixel store
t.setColorModel(cm);
t.setHints(interlaceMethod !=0
? ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES
: ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES |
ImageConsumer.SINGLEPASS | ImageConsumer.SINGLEFRAME);
*/
// code added to make it work with ImageDecoder architecture
setDimensions(width, height);
setColorModel(cm);
int flags = (interlaceMethod !=0
Expand All @@ -326,7 +296,6 @@ public void produceImage() throws IOException, ImageFormatException {
ImageConsumer.SINGLEPASS | ImageConsumer.SINGLEFRAME);
setHints(flags);
headerComplete();
// end of adding

int samplesPerPixel = ((colorType&PALETTE)!=0 ? 1
: ((colorType&COLOR)!=0 ? 3 : 1)+((colorType&ALPHA)!=0?1:0));
Expand All @@ -335,11 +304,6 @@ public void produceImage() throws IOException, ImageFormatException {
int pass, passLimit;
if(interlaceMethod==0) { pass = -1; passLimit = 0; }
else { pass = 0; passLimit = 7; }
// These loops are far from being tuned. They're this way to make them easy to
// debug. Tuning comes later.
/* code changed. target not needed here
while(++pass<=passLimit && (t=target)!=null) {
*/
while(++pass<=passLimit) {
int row = startingRow[pass];
int rowInc = rowIncrement[pass];
Expand All @@ -356,9 +320,6 @@ public void produceImage() throws IOException, ImageFormatException {

byte[] rowByteBuffer = new byte[rowByteWidth];
byte[] prevRowByteBuffer = new byte[rowByteWidth];
/* code changed. target not needed here
while (row < height && (t=target)!=null) {
*/
while (row < height) {
int rowFilter = is.read();
for (int rowFillPos=0;rowFillPos<rowByteWidth; ) {
Expand Down Expand Up @@ -457,27 +418,13 @@ public void produceImage() throws IOException, ImageFormatException {
break;
default: throw new PNGException("illegal type/depth");
}
/*visit (row, col,
min (bHeight, height - row),
min (bWidth, width - col)); */
col += colInc;
}
if(interlaceMethod==0)
if(wPixels!=null) {
/* code changed. target not needed here
t.setPixels(0,row,width,1,cm,wPixels,0,width);
*/
// code added to make it work with ImageDecoder arch
sendPixels(0,row,width,1,wPixels,0,width);
// end of adding
}
else {
/* code changed. target not needed here
t.setPixels(0,row,width,1,cm,bPixels,0,width);
*/
// code added to make it work with ImageDecoder arch
} else {
sendPixels(0,row,width,1,bPixels,0,width);
//end of adding
}
row += rowInc;
rowOffset += rowInc*rowStride;
Expand All @@ -488,20 +435,9 @@ public void produceImage() throws IOException, ImageFormatException {
}
if(interlaceMethod!=0)
if(wPixels!=null) {
/* code changed. target not needed here
t.setPixels(0,0,width,height,cm,wPixels,0,width);
*/
// code added to make it work with ImageDecoder arch
sendPixels(0,0,width,height,wPixels,0,width);
//end of adding
}
else {
/* code changed. target not needed here
t.setPixels(0,0,width,height,cm,bPixels,0,width);
*/
// code added to make it work with ImageDecoder arch
} else {
sendPixels(0,0,width,height,bPixels,0,width);
//end of adding
}
}

Expand All @@ -511,37 +447,15 @@ public void produceImage() throws IOException, ImageFormatException {
and column, using the color indicated by the pixel. Note that row
and column are measured from 0,0 at the upper left corner. */

/* code not needed, don't deal with target
if((t=target)!=null) {
if(properties!=null) t.setProperties(properties);
t.imageComplete(ImageConsumer.STATICIMAGEDONE);
*/

imageComplete(ImageConsumer.STATICIMAGEDONE, true);

/* code not needed }
is.close();
*/
} catch(IOException e) {
if(!aborted) {
/* code not needed
if((t=target)!=null) {
PNGEncoder.prChunk(e.toString(),inbuf,pos,limit-pos,true);
*/
property("error", e);
/* code not needed
t.setProperties(properties);
t.imageComplete(ImageConsumer.IMAGEERROR|ImageConsumer.STATICIMAGEDONE);
*/
imageComplete(ImageConsumer.IMAGEERROR|ImageConsumer.STATICIMAGEDONE, true);
throw e;
}
} finally {
try { close(); } catch(Throwable e){}
/* code not needed
target = null;
endTurn();
*/
}
}

Expand Down Expand Up @@ -620,47 +534,22 @@ private void filterRow(byte[] rowByteBuffer, byte[] prevRow,
private static final byte[] blockHeight = { 1, 8, 8, 4, 4, 2, 2, 1 };
private static final byte[] blockWidth = { 1, 8, 4, 4, 2, 2, 1, 1 };

//abstract public class ChunkReader extends FilterInputStream {
int pos, limit;
int pos, limit;
int chunkStart;
int chunkKey, chunkLength, chunkCRC;
int chunkKey, chunkLength, chunkCRC;
boolean seenEOF;

private static final byte[] signature = { (byte) 137, (byte) 80, (byte) 78,
(byte) 71, (byte) 13, (byte) 10, (byte) 26, (byte) 10 };

PNGFilterInputStream inputStream;
InputStream underlyingInputStream;
PNGFilterInputStream inputStream;
InputStream underlyingInputStream;

/* code changed
public PNGImageDecoder(InputStream in, ImageConsumer t) throws IOException {
*/
public PNGImageDecoder(InputStreamImageSource src, InputStream input) throws IOException {
// code added
super(src, input);
inputStream = new PNGFilterInputStream(this, input);
underlyingInputStream = inputStream.underlyingInputStream;
// end of adding
/* code changed
super(in);
target = t;
waitTurn();
new Thread(this).start();
*/
}
/* code changed to make it work with ImageDecoder architecture
static int ThreadLimit = 10;
private static synchronized void waitTurn() {
try {
while(ThreadLimit<=0) PNGImageDecoder.class.wait(1000);
} catch(InterruptedException e){}
ThreadLimit--;
}
private static synchronized void endTurn() {
if(ThreadLimit<=0) PNGImageDecoder.class.notify();
ThreadLimit++;
}
*/
byte[] inbuf = new byte[4096];
private void fill() throws IOException {
if(!seenEOF) {
Expand Down Expand Up @@ -728,8 +617,6 @@ boolean getData() throws IOException {
chunkLength = 0;
return chunkLength>0;
}
//abstract protected boolean handleChunk(int key, byte[] buf, int st, int len)
// throws IOException;
private static boolean checkCRC = true;
public static boolean getCheckCRC() { return checkCRC; }
public static void setCheckCRC(boolean c) { checkCRC = c; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
public final class JDKFontLookup {

public final static String getJDKFontDir() {
public static final String getJDKFontDir() {
return SunFontManager.getJDKFontDir();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ public synchronized void makePipes() {
}
}

private final static class X11WindowSurfaceData extends X11SurfaceData {
private static final class X11WindowSurfaceData extends X11SurfaceData {

private final int scale;

Expand Down Expand Up @@ -744,7 +744,7 @@ public double getDefaultScaleY() {
}
}

private final static class X11PixmapSurfaceData extends X11SurfaceData {
private static final class X11PixmapSurfaceData extends X11SurfaceData {

private final Image offscreenImage;
private final int width;
Expand Down