jdk/src/java.desktop/unix/classes/sun/java2d/xr/XRPMBlitLoops.java
changeset 40142 59833102e41b
parent 25859 3317bb8137f4
child 41571 37e93ae74ab8
equal deleted inserted replaced
40141:a7297a9dd5fa 40142:59833102e41b
   125         } else {
   125         } else {
   126             vImg = argbTmpPM.get();
   126             vImg = argbTmpPM.get();
   127             vImgSurfaceType = SurfaceType.IntArgbPre;
   127             vImgSurfaceType = SurfaceType.IntArgbPre;
   128         }
   128         }
   129 
   129 
   130         if (vImg == null || vImg.getWidth() < w || vImg.getHeight() < h) {
   130         if (vImg == null || vImg.getWidth() < w || vImg.getHeight() < h ||
       
   131             // Sometimes we get volatile image of wrong dest surface type,
       
   132             // so recreating it
       
   133             !(vImg.getDestSurface() instanceof XRSurfaceData))
       
   134         {
   131             if (vImg != null) {
   135             if (vImg != null) {
   132                 vImg.flush();
   136                 vImg.flush();
   133             }
   137             }
   134             vImg = (SunVolatileImage) dst.getGraphicsConfig().createCompatibleVolatileImage(w, h, src.getTransparency());
   138             vImg = (SunVolatileImage) dst.getGraphicsConfig().createCompatibleVolatileImage(w, h, src.getTransparency());
   135             vImg.setAccelerationPriority(1.0f);
   139             vImg.setAccelerationPriority(1.0f);
   140                 argbTmpPM = new WeakReference<SunVolatileImage>(vImg);
   144                 argbTmpPM = new WeakReference<SunVolatileImage>(vImg);
   141             }
   145             }
   142         }
   146         }
   143 
   147 
   144         Blit swToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, vImgSurfaceType);
   148         Blit swToSurfaceBlit = Blit.getFromCache(src.getSurfaceType(), CompositeType.SrcNoEa, vImgSurfaceType);
       
   149 
       
   150         if (!(vImg.getDestSurface() instanceof XRSurfaceData)) {
       
   151             throw new InvalidPipeException("wrong surface data type: " + vImg.getDestSurface());
       
   152         }
       
   153 
   145         XRSurfaceData vImgSurface = (XRSurfaceData) vImg.getDestSurface();
   154         XRSurfaceData vImgSurface = (XRSurfaceData) vImg.getDestSurface();
   146         swToSurfaceBlit.Blit(src, vImgSurface, AlphaComposite.Src, null,
   155         swToSurfaceBlit.Blit(src, vImgSurface, AlphaComposite.Src, null,
   147                              sx, sy, 0, 0, w, h);
   156                              sx, sy, 0, 0, w, h);
   148 
   157 
   149         return vImgSurface;
   158         return vImgSurface;