From 52e5206ff49034225d37a766a6d187b599ac27a7 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 5 Jun 2003 17:31:21 +0000 Subject: [PATCH] Keep a single colorization record around for each ColorRecord rather than creating the same Colorization instance over and over each time we're asked for one. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2641 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/media/image/ColorPository.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/java/com/threerings/media/image/ColorPository.java b/src/java/com/threerings/media/image/ColorPository.java index 7708e8257..f1e88238e 100644 --- a/src/java/com/threerings/media/image/ColorPository.java +++ b/src/java/com/threerings/media/image/ColorPository.java @@ -1,5 +1,5 @@ // -// $Id: ColorPository.java,v 1.2 2003/03/29 02:30:14 mdb Exp $ +// $Id: ColorPository.java,v 1.3 2003/06/05 17:31:21 mdb Exp $ package com.threerings.media.image; @@ -146,8 +146,11 @@ public class ColorPository implements Serializable */ public Colorization getColorization () { - return new Colorization(getColorPrint(), cclass.source, - cclass.range, offsets); + if (_zation == null) { + _zation = new Colorization(getColorPrint(), cclass.source, + cclass.range, offsets); + } + return _zation; } /** @@ -160,6 +163,9 @@ public class ColorPository implements Serializable ", starter=" + starter + "]"; } + /** Our data represented as a colorization. */ + protected transient Colorization _zation; + /** Increase this value when object's serialized state is impacted * by a class change (modification of fields, inheritance). */ private static final long serialVersionUID = 2;