Navigation Menu

Skip to content

Commit

Permalink
More missed changes. Man, I miss generics!
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Luc Paour committed Nov 4, 2006
1 parent eb30450 commit fecb4fd
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 136 deletions.
1 change: 0 additions & 1 deletion com/gallery/GalleryRemote/CoreUtils.java
Expand Up @@ -6,7 +6,6 @@
import javax.swing.*;
import java.util.Arrays;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;

/**
Expand Down
1 change: 0 additions & 1 deletion com/gallery/GalleryRemote/GRAppletMini.java
Expand Up @@ -18,7 +18,6 @@
import java.util.Iterator;
import java.util.Arrays;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
Expand Down
1 change: 0 additions & 1 deletion com/gallery/GalleryRemote/GalleryRemoteCore.java
Expand Up @@ -6,7 +6,6 @@
import javax.swing.*;
import java.util.Iterator;
import java.io.File;
import java.awt.image.BufferedImage;
import java.awt.*;

/**
Expand Down
1 change: 0 additions & 1 deletion com/gallery/GalleryRemote/GalleryRemoteScreenSaver.java
Expand Up @@ -12,7 +12,6 @@
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.*;
Expand Down
1 change: 0 additions & 1 deletion com/gallery/GalleryRemote/MainFrame.java
Expand Up @@ -40,7 +40,6 @@
import javax.swing.filechooser.FileFilter;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.event.*;
import java.io.*;
import java.lang.reflect.Method;
Expand Down
1 change: 0 additions & 1 deletion com/gallery/GalleryRemote/PictureInspector.java
Expand Up @@ -29,7 +29,6 @@
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
Expand Down
1 change: 0 additions & 1 deletion com/gallery/GalleryRemote/PreviewFrame.java
Expand Up @@ -29,7 +29,6 @@

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.NoninvertibleTransformException;
Expand Down
2 changes: 1 addition & 1 deletion com/gallery/GalleryRemote/SlideshowFrame.java
Expand Up @@ -400,7 +400,7 @@ public boolean previous(boolean user) {
return true;
}

public boolean blockPictureReady(BufferedImage image, Picture picture) {
public boolean blockPictureReady(Image image, Picture picture) {
Log.log(Log.LEVEL_TRACE, MODULE, "blockPictureReady: " + picture + " - pictureShowWant: " + loader.pictureShowWant);

if (picture == userPicture) {
Expand Down
95 changes: 0 additions & 95 deletions com/gallery/GalleryRemote/prefs/FilePanel.java

This file was deleted.

8 changes: 4 additions & 4 deletions com/gallery/GalleryRemote/util/ImageLoaderUtil.java
Expand Up @@ -74,7 +74,7 @@ public void preparePicture(Picture picture, boolean async, boolean notify) {
if (picture != pictureShowWant) {
pictureShowWant = picture;

BufferedImage r = (BufferedImage) images.get(picture);
Image r = (Image) images.get(picture);
if (r != null) {
Log.log(Log.LEVEL_TRACE, MODULE, "Cache hit: " + picture);
if (notify) {
Expand All @@ -98,7 +98,7 @@ public void preparePicture(Picture picture, boolean async, boolean notify) {
}

public Image getSizedIconForce(Picture picture) {
Image r = (BufferedImage) images.get(picture);
Image r = (Image) images.get(picture);

if (r == null) {
synchronized(picture) {
Expand Down Expand Up @@ -397,9 +397,9 @@ public void clear() {
// flush images before clearing hastables for quicker deletion
Iterator it = values().iterator();
while (it.hasNext()) {
ImageIcon i = (ImageIcon) it.next();
Image i = (Image) it.next();
if (i != null) {
i.getImage().flush();
i.flush();
}
}

Expand Down
58 changes: 29 additions & 29 deletions com/gallery/GalleryRemote/util/ImageUtils.java
Expand Up @@ -27,7 +27,6 @@
import com.gallery.GalleryRemote.prefs.PreferenceNames;
import com.gallery.GalleryRemote.prefs.GalleryProperties;

import javax.swing.*;
import javax.imageio.*;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
Expand Down Expand Up @@ -81,8 +80,6 @@ public class ImageUtils {
static String[] filterName = new String[3];
static String[] format = new String[3];

//public final static String DEFAULT_IMAGE = "img/default.gif";
//public final static String UNRECOGNIZED_IMAGE = "img/default.gif";
public final static String DEFAULT_RESOURCE = "/default.gif";
public final static String UNRECOGNIZED_RESOURCE = "/default.gif";

Expand All @@ -93,6 +90,12 @@ public class ImageUtils {
public static boolean deferredStopUsingJpegtran = false;
public static boolean deferredStopUsingJpegtranCrop = false;

public static ImageObserver observer = new ImageObserver() {
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
return false;
}
};

public static Image load(String filename, Dimension d, int usage) {
return load(filename, d, usage, false);
}
Expand Down Expand Up @@ -176,8 +179,16 @@ public static Image load(String filename, Dimension d, int usage, boolean ignore

public static Image loadJava(URL url, Dimension d, boolean noStretch) {
try {
BufferedImage r = ImageIO.read(url);
return loadJavaInternal(r, d, noStretch);
Log.log(Log.LEVEL_TRACE, MODULE, "Free before loading: " + Runtime.getRuntime().freeMemory());
Image r = ImageIO.read(url);
Log.log(Log.LEVEL_TRACE, MODULE, "Free after loading: " + Runtime.getRuntime().freeMemory());
r = loadJavaInternal(r, d, noStretch);
Log.log(Log.LEVEL_TRACE, MODULE, "Free after resize: " + Runtime.getRuntime().freeMemory());

System.gc();
Log.log(Log.LEVEL_TRACE, MODULE, "Free after gc: " + Runtime.getRuntime().freeMemory());

return r;
} catch (IOException e) {
Log.logException(Log.LEVEL_ERROR, MODULE, e);
return null;
Expand All @@ -186,18 +197,26 @@ public static Image loadJava(URL url, Dimension d, boolean noStretch) {

public static Image loadJava(String filename, Dimension d, boolean noStretch) {
try {
BufferedImage r = ImageIO.read(new File(filename));
return loadJavaInternal(r, d, noStretch);
Log.log(Log.LEVEL_TRACE, MODULE, "Free before loading: " + Runtime.getRuntime().freeMemory());
Image r = ImageIO.read(new File(filename));
Log.log(Log.LEVEL_TRACE, MODULE, "Free after loading: " + Runtime.getRuntime().freeMemory());
r = loadJavaInternal(r, d, noStretch);
Log.log(Log.LEVEL_TRACE, MODULE, "Free after resize: " + Runtime.getRuntime().freeMemory());

System.gc();
Log.log(Log.LEVEL_TRACE, MODULE, "Free after gc: " + Runtime.getRuntime().freeMemory());

return r;
} catch (IOException e) {
Log.logException(Log.LEVEL_ERROR, MODULE, e);
return null;
}
}

private static Image loadJavaInternal(BufferedImage r, Dimension d, boolean noStretch) {
Image scaled = null;
private static Image loadJavaInternal(Image r, Dimension d, boolean noStretch) {
Image scaled;
Dimension newD = getSizeKeepRatio(
new Dimension(r.getWidth(), r.getHeight()),
new Dimension(r.getWidth(observer), r.getHeight(observer)),
d, noStretch);

if (newD == null) {
Expand All @@ -209,25 +228,6 @@ private static Image loadJavaInternal(BufferedImage r, Dimension d, boolean noSt
r.flush();

return scaled;
/*Iterator iter = ImageIO.getImageReaders(iis);
if (!iter.hasNext()) {
return null;
}
ImageReader reader = (ImageReader)iter.next();
ImageReadParam param = reader.getDefaultReadParam();
reader.setInput(iis, true, false);
IIOMetadata metadata = reader.getImageMetadata(0);
String names[] = metadata.getMetadataFormatNames();
for (int i = 0; i < names.length; i++) {
displayMetadata(metadata.getAsTree(names[i]));
}
param.setSourceRenderSize(d);
BufferedImage image = (BufferedImage) reader.readAsRenderedImage(0, param);
return new ImageIcon(image);*/
}

public static File resize(String filename, Dimension d) {
Expand Down

0 comments on commit fecb4fd

Please sign in to comment.