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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user