Redundant scaleLargerThanOriginal method removed from ImageCache, preferences setting used directly instead.

This commit is contained in:
Doublestrike
2012-01-19 12:24:19 +00:00
parent 337322334a
commit 39f24f069d
3 changed files with 3 additions and 30 deletions

View File

@@ -70,9 +70,6 @@ public class ImageCache {
/** Constant <code>TAPPED="#Tapped"</code>. */ /** Constant <code>TAPPED="#Tapped"</code>. */
private static final String TOKEN = "#Token", NORMAL = "#Normal", TAPPED = "#Tapped"; private static final String TOKEN = "#Token", NORMAL = "#Normal", TAPPED = "#Tapped";
/** Constant <code>scaleLargerThanOriginal=true</code>. */
private static boolean scaleLargerThanOriginal = true;
static { static {
IMAGE_CACHE = CacheBuilder.newBuilder() IMAGE_CACHE = CacheBuilder.newBuilder()
.softValues() .softValues()
@@ -179,7 +176,7 @@ public class ImageCache {
double scale = Math.min((double) width / original.getWidth(), (double) height / original.getHeight()); double scale = Math.min((double) width / original.getWidth(), (double) height / original.getHeight());
// here would be the place to limit the scaling, scaling option in menu // here would be the place to limit the scaling, scaling option in menu
// ? // ?
if ((scale > 1) && !ImageCache.isScaleLargerThanOriginal()) { if ((scale > 1) && !Singletons.getModel().getPreferences().isScaleLargerThanOriginal()) {
scale = 1; scale = 1;
} }
@@ -205,9 +202,8 @@ public class ImageCache {
} }
double scale = Math.min((double) width / original.getWidth(), (double) height / original.getHeight()); double scale = Math.min((double) width / original.getWidth(), (double) height / original.getHeight());
// here would be the place to limit the scaling, scaling option in menu // here would be the place to limit the scaling option in menu ?
// ? if ((scale > 1) && !Singletons.getModel().getPreferences().isScaleLargerThanOriginal()) {
if ((scale > 1) && !ImageCache.isScaleLargerThanOriginal()) {
scale = 1; scale = 1;
} }
@@ -430,23 +426,4 @@ public class ImageCache {
public static void clear() { public static void clear() {
ImageCache.IMAGE_CACHE.invalidateAll(); ImageCache.IMAGE_CACHE.invalidateAll();
} }
/**
* Checks if is scale larger than original.
*
* @return the scaleLargerThanOriginal
*/
public static boolean isScaleLargerThanOriginal() {
return ImageCache.scaleLargerThanOriginal;
}
/**
* Sets the scale larger than original.
*
* @param scaleLargerThanOriginal0
* the scaleLargerThanOriginal0 to set
*/
public static void setScaleLargerThanOriginal(final boolean scaleLargerThanOriginal0) {
ImageCache.scaleLargerThanOriginal = scaleLargerThanOriginal0;
}
} }

View File

@@ -9,7 +9,6 @@ import javax.swing.event.ListSelectionListener;
import forge.AllZone; import forge.AllZone;
import forge.Constant; import forge.Constant;
import forge.ImageCache;
import forge.Singletons; import forge.Singletons;
import forge.properties.ForgePreferences; import forge.properties.ForgePreferences;
import forge.properties.ForgePreferences.CardSizeType; import forge.properties.ForgePreferences.CardSizeType;
@@ -67,7 +66,6 @@ public class ControlSettings {
public void actionPerformed(final ActionEvent arg0) { public void actionPerformed(final ActionEvent arg0) {
final boolean toggle = ControlSettings.this.view.getCbScaleLarger().isSelected(); final boolean toggle = ControlSettings.this.view.getCbScaleLarger().isSelected();
prefs.setScaleLargerThanOriginal(toggle); prefs.setScaleLargerThanOriginal(toggle);
ImageCache.setScaleLargerThanOriginal(toggle);
try { prefs.save(); } catch (Exception e) { e.printStackTrace(); } try { prefs.save(); } catch (Exception e) { e.printStackTrace(); }
} }
}); });

View File

@@ -28,7 +28,6 @@ import net.slightlymagic.braids.util.progress_monitor.BraidsProgressMonitor;
import arcane.util.MultiplexOutputStream; import arcane.util.MultiplexOutputStream;
import forge.Constant; import forge.Constant;
import forge.HttpUtil; import forge.HttpUtil;
import forge.ImageCache;
import forge.properties.ForgePreferences; import forge.properties.ForgePreferences;
import forge.properties.ForgeProps; import forge.properties.ForgeProps;
import forge.properties.NewConstants; import forge.properties.NewConstants;
@@ -94,7 +93,6 @@ public class FModel {
Constant.Runtime.DEV_MODE[0] = this.preferences.isDeveloperMode(); Constant.Runtime.DEV_MODE[0] = this.preferences.isDeveloperMode();
Constant.Runtime.UPLOAD_DRAFT[0] = this.preferences.isUploadDraftAI(); Constant.Runtime.UPLOAD_DRAFT[0] = this.preferences.isUploadDraftAI();
Constant.Runtime.RANDOM_FOIL[0] = this.preferences.isRandCFoil(); Constant.Runtime.RANDOM_FOIL[0] = this.preferences.isRandCFoil();
ImageCache.setScaleLargerThanOriginal(preferences.isScaleLargerThanOriginal());
///////// /////////
// Instantiate pinger // Instantiate pinger