1.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java Thu May 23 15:36:42 2013 +0200
1.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/Style.java Fri May 24 12:29:58 2013 +0200
1.3 @@ -23,21 +23,34 @@
1.4 */
1.5 public class Style {
1.6
1.7 + private Object cached;
1.8 + private int cacheHash;
1.9 +
1.10 Style() {
1.11 }
1.12 -
1.13 - public static final RadialGradient createRadialGradient( double x0, double y0,double r0, double x1, double y1, double r1){
1.14 +
1.15 + public static final RadialGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1) {
1.16 return new RadialGradient(x0, y0, r0, x1, y1, r1);
1.17 }
1.18 -
1.19 - public static final LinearGradient createLinearGradient(double x0, double y0, double x1, double y1){
1.20 +
1.21 + public static final LinearGradient createLinearGradient(double x0, double y0, double x1, double y1) {
1.22 return new LinearGradient(x0, y0, x1, y1);
1.23 }
1.24 -
1.25 - public static final Pattern createPattern(ImageData imageData, String repeat){
1.26 +
1.27 + public static final Pattern createPattern(ImageData imageData, String repeat) {
1.28 return new Pattern(imageData, repeat);
1.29 }
1.30 -
1.31 -
1.32 -
1.33 +
1.34 + void cache(Object toCache) {
1.35 + cacheHash = hashCode();
1.36 + this.cached = toCache;
1.37 + }
1.38 +
1.39 + private boolean isCached() {
1.40 + return cacheHash == hashCode();
1.41 + }
1.42 +
1.43 + Object getCached() {
1.44 + return isCached() ? cached : null;
1.45 + }
1.46 }