< prev index next >

src/java.desktop/share/classes/sun/awt/image/BufImgSurfaceData.java

Print this page




 381                              double scaleY)
 382     {
 383         super(SunWritableRaster.stealTrackable(db),
 384               sType, bufImg.getColorModel());
 385         this.bufImg = bufImg;
 386         this.scaleX = scaleX;
 387         this.scaleY = scaleY;
 388     }
 389 
 390     protected BufImgSurfaceData(SurfaceType surfaceType, ColorModel cm) {
 391         super(surfaceType, cm);
 392         this.scaleX = 1;
 393         this.scaleY = 1;
 394     }
 395 
 396     public void initSolidLoops() {
 397         this.solidloops = getSolidLoops(getSurfaceType());
 398     }
 399 
 400     private static final int CACHE_SIZE = 5;
 401     private static RenderLoops loopcache[] = new RenderLoops[CACHE_SIZE];
 402     private static SurfaceType typecache[] = new SurfaceType[CACHE_SIZE];
 403     public static synchronized RenderLoops getSolidLoops(SurfaceType type) {
 404         for (int i = CACHE_SIZE - 1; i >= 0; i--) {
 405             SurfaceType t = typecache[i];
 406             if (t == type) {
 407                 return loopcache[i];
 408             } else if (t == null) {
 409                 break;
 410             }
 411         }
 412         RenderLoops l = makeRenderLoops(SurfaceType.OpaqueColor,
 413                                         CompositeType.SrcNoEa,
 414                                         type);
 415         System.arraycopy(loopcache, 1, loopcache, 0, CACHE_SIZE-1);
 416         System.arraycopy(typecache, 1, typecache, 0, CACHE_SIZE-1);
 417         loopcache[CACHE_SIZE - 1] = l;
 418         typecache[CACHE_SIZE - 1] = type;
 419         return l;
 420     }
 421 
 422     public SurfaceData getReplacement() {




 381                              double scaleY)
 382     {
 383         super(SunWritableRaster.stealTrackable(db),
 384               sType, bufImg.getColorModel());
 385         this.bufImg = bufImg;
 386         this.scaleX = scaleX;
 387         this.scaleY = scaleY;
 388     }
 389 
 390     protected BufImgSurfaceData(SurfaceType surfaceType, ColorModel cm) {
 391         super(surfaceType, cm);
 392         this.scaleX = 1;
 393         this.scaleY = 1;
 394     }
 395 
 396     public void initSolidLoops() {
 397         this.solidloops = getSolidLoops(getSurfaceType());
 398     }
 399 
 400     private static final int CACHE_SIZE = 5;
 401     private static RenderLoops[] loopcache = new RenderLoops[CACHE_SIZE];
 402     private static SurfaceType[] typecache = new SurfaceType[CACHE_SIZE];
 403     public static synchronized RenderLoops getSolidLoops(SurfaceType type) {
 404         for (int i = CACHE_SIZE - 1; i >= 0; i--) {
 405             SurfaceType t = typecache[i];
 406             if (t == type) {
 407                 return loopcache[i];
 408             } else if (t == null) {
 409                 break;
 410             }
 411         }
 412         RenderLoops l = makeRenderLoops(SurfaceType.OpaqueColor,
 413                                         CompositeType.SrcNoEa,
 414                                         type);
 415         System.arraycopy(loopcache, 1, loopcache, 0, CACHE_SIZE-1);
 416         System.arraycopy(typecache, 1, typecache, 0, CACHE_SIZE-1);
 417         loopcache[CACHE_SIZE - 1] = l;
 418         typecache[CACHE_SIZE - 1] = type;
 419         return l;
 420     }
 421 
 422     public SurfaceData getReplacement() {


< prev index next >