diff options
author | Carsten Weisse <[email protected]> | 2005-05-07 17:31:37 +0000 |
---|---|---|
committer | Carsten Weisse <[email protected]> | 2005-05-07 17:31:37 +0000 |
commit | d81625e5a465f258d724359d026f4bde39e9837a (patch) | |
tree | 8ed36aced52de9f27fb6fd1081047fe6a05e9b8f | |
parent | f3adb1e8792fd077cd0c8c3183c03fd32a949e46 (diff) |
preconstruct a Throwable is faster; (is used in control flow)
-rw-r--r-- | src/jake2/render/lwjgl/Image.java | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/jake2/render/lwjgl/Image.java b/src/jake2/render/lwjgl/Image.java index 02b4039..0642f96 100644 --- a/src/jake2/render/lwjgl/Image.java +++ b/src/jake2/render/lwjgl/Image.java @@ -2,7 +2,7 @@ * Image.java * Copyright (C) 2003 * - * $Id: Image.java,v 1.2 2004-12-14 12:56:59 cawe Exp $ + * $Id: Image.java,v 1.3 2005-05-07 17:31:37 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -29,11 +29,7 @@ import jake2.Defines; import jake2.client.VID; import jake2.client.particle_t; import jake2.game.cvar_t; -import jake2.qcommon.Com; -import jake2.qcommon.Cvar; -import jake2.qcommon.FS; -import jake2.qcommon.longjmpException; -import jake2.qcommon.qfiles; +import jake2.qcommon.*; import jake2.render.image_t; import jake2.util.Lib; import jake2.util.Vargs; @@ -42,9 +38,7 @@ import java.awt.Dimension; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image.BufferedImage; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.IntBuffer; +import java.nio.*; import java.util.Arrays; import org.lwjgl.BufferUtils; @@ -525,6 +519,9 @@ public abstract class Image extends Main { } return pix; } + + private Throwable gotoBreakOut = new Throwable(); + private Throwable gotoDone = gotoBreakOut; // /* // ========================================================= @@ -657,7 +654,7 @@ public abstract class Image extends Main { row--; else // goto label breakOut; - throw new longjmpException(); + throw gotoBreakOut; pixbuf = row * columns * 4; } @@ -693,14 +690,14 @@ public abstract class Image extends Main { row--; else // goto label breakOut; - throw new longjmpException(); + throw gotoBreakOut; pixbuf = row * columns * 4; } } } } - } catch (longjmpException e){ + } catch (Throwable e){ // label breakOut: } } @@ -1155,7 +1152,7 @@ public abstract class Image extends Main { tex); } //goto done; - throw new longjmpException(); + throw gotoDone; } //memcpy (scaled, data, width*height*4); were bytes System.arraycopy(data, 0, scaled, 0, width * height); @@ -1228,8 +1225,8 @@ public abstract class Image extends Main { } // label done: } - catch (longjmpException e) { - ; // replaces label done + catch (Throwable e) { + // replaces label done } if (mipmap) { |