jdk/src/java.desktop/share/classes/java/awt/TexturePaintContext.java
changeset 32865 f9cb6e427f9e
parent 25859 3317bb8137f4
equal deleted inserted replaced
32864:2a338536e642 32865:f9cb6e427f9e
   235     }
   235     }
   236 
   236 
   237     private static WeakReference<Raster> xrgbRasRef;
   237     private static WeakReference<Raster> xrgbRasRef;
   238     private static WeakReference<Raster> argbRasRef;
   238     private static WeakReference<Raster> argbRasRef;
   239 
   239 
   240     synchronized static WritableRaster makeRaster(ColorModel cm,
   240     static synchronized WritableRaster makeRaster(ColorModel cm,
   241                                                   Raster srcRas,
   241                                                   Raster srcRas,
   242                                                   int w, int h)
   242                                                   int w, int h)
   243     {
   243     {
   244         if (xrgbmodel == cm) {
   244         if (xrgbmodel == cm) {
   245             if (xrgbRasRef != null) {
   245             if (xrgbRasRef != null) {
   271         } else {
   271         } else {
   272             return cm.createCompatibleWritableRaster(w, h);
   272             return cm.createCompatibleWritableRaster(w, h);
   273         }
   273         }
   274     }
   274     }
   275 
   275 
   276     synchronized static void dropRaster(ColorModel cm, Raster outRas) {
   276     static synchronized void dropRaster(ColorModel cm, Raster outRas) {
   277         if (outRas == null) {
   277         if (outRas == null) {
   278             return;
   278             return;
   279         }
   279         }
   280         if (xrgbmodel == cm) {
   280         if (xrgbmodel == cm) {
   281             xrgbRasRef = new WeakReference<>(outRas);
   281             xrgbRasRef = new WeakReference<>(outRas);
   284         }
   284         }
   285     }
   285     }
   286 
   286 
   287     private static WeakReference<Raster> byteRasRef;
   287     private static WeakReference<Raster> byteRasRef;
   288 
   288 
   289     synchronized static WritableRaster makeByteRaster(Raster srcRas,
   289     static synchronized WritableRaster makeByteRaster(Raster srcRas,
   290                                                       int w, int h)
   290                                                       int w, int h)
   291     {
   291     {
   292         if (byteRasRef != null) {
   292         if (byteRasRef != null) {
   293             WritableRaster wr = (WritableRaster) byteRasRef.get();
   293             WritableRaster wr = (WritableRaster) byteRasRef.get();
   294             if (wr != null && wr.getWidth() >= w && wr.getHeight() >= h) {
   294             if (wr != null && wr.getWidth() >= w && wr.getHeight() >= h) {
   301             w = h = 32;
   301             w = h = 32;
   302         }
   302         }
   303         return srcRas.createCompatibleWritableRaster(w, h);
   303         return srcRas.createCompatibleWritableRaster(w, h);
   304     }
   304     }
   305 
   305 
   306     synchronized static void dropByteRaster(Raster outRas) {
   306     static synchronized void dropByteRaster(Raster outRas) {
   307         if (outRas == null) {
   307         if (outRas == null) {
   308             return;
   308             return;
   309         }
   309         }
   310         byteRasRef = new WeakReference<>(outRas);
   310         byteRasRef = new WeakReference<>(outRas);
   311     }
   311     }