src/share/classes/javax/swing/RepaintManager.java
Print this page
*** 987,997 ****
--- 987,1002 ----
if (image == null || image.getWidth() < width ||
image.getHeight() < height) {
if (image != null) {
image.flush();
}
+ final Toolkit tk = Toolkit.getDefaultToolkit();
+ if ((tk instanceof SunToolkit) && ((SunToolkit)tk).isSwingBackbufferTranslucencySupported()) {
+ image = config.createCompatibleVolatileImage(width, height, Transparency.TRANSLUCENT);
+ }else {
image = config.createCompatibleVolatileImage(width, height);
+ }
volatileMap.put(config, image);
}
return image;
}
*** 1475,1493 ****
--- 1480,1512 ----
int clipW, int clipH) {
Graphics osg = image.getGraphics();
int bw = Math.min(clipW, image.getWidth(null));
int bh = Math.min(clipH, image.getHeight(null));
int x,y,maxx,maxy;
+ final Toolkit tk = Toolkit.getDefaultToolkit();
+ final boolean isTranslucent = (tk instanceof SunToolkit)
+ && ((SunToolkit) tk).isSwingBackbufferTranslucencySupported();
try {
for(x = clipX, maxx = clipX+clipW; x < maxx ; x += bw ) {
for(y=clipY, maxy = clipY + clipH; y < maxy ; y += bh) {
osg.translate(-x, -y);
osg.setClip(x,y,bw,bh);
+ if (isTranslucent && osg instanceof Graphics2D) {
+ Graphics2D g2d = (Graphics2D) osg.create();
+ g2d.setBackground(c.getBackground());
+ g2d.clearRect(x, y, bw, bh);
+ }
c.paintToOffscreen(osg, x, y, bw, bh, maxx, maxy);
g.setClip(x, y, bw, bh);
+ if (isTranslucent && g instanceof Graphics2D) {
+ Graphics2D g2d = (Graphics2D) g.create();
+ g2d.setComposite(AlphaComposite.Src);
+ g2d.drawImage(image, x, y, c);
+ } else {
g.drawImage(image, x, y, c);
+ }
osg.translate(x, y);
}
}
} finally {
osg.dispose();