jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java
changeset 2807 db01a7f6d657
parent 2760 f038acdbdf9c
child 4250 e88776b21913
--- a/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java	Tue May 19 14:43:49 2009 +0400
+++ b/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java	Tue May 19 17:03:13 2009 +0400
@@ -81,6 +81,13 @@
         DESC_INT_BGR_X11        = "Integer BGR Pixmap";
     public static final String
         DESC_INT_RGB_X11        = "Integer RGB Pixmap";
+
+    public static final String
+        DESC_4BYTE_ABGR_PRE_X11 = "4 byte ABGR Pixmap with pre-multplied alpha";
+    public static final String
+        DESC_INT_ARGB_PRE_X11   = "Integer ARGB Pixmap with pre-multiplied " +
+                                  "alpha";
+
     public static final String
         DESC_BYTE_IND_OPQ_X11   = "Byte Indexed Opaque Pixmap";
 
@@ -133,6 +140,11 @@
     public static final SurfaceType IntRgbX11 =
         SurfaceType.IntRgb.deriveSubType(DESC_INT_RGB_X11);
 
+    public static final SurfaceType FourByteAbgrPreX11 =
+        SurfaceType.FourByteAbgrPre.deriveSubType(DESC_4BYTE_ABGR_PRE_X11);
+    public static final SurfaceType IntArgbPreX11 =
+        SurfaceType.IntArgbPre.deriveSubType(DESC_INT_ARGB_PRE_X11);
+
     public static final SurfaceType ThreeByteRgbX11 =
         SurfaceType.ThreeByteRgb.deriveSubType(DESC_3BYTE_RGB_X11);
     public static final SurfaceType ThreeByteBgrX11 =
@@ -413,7 +425,7 @@
                                                   int transparency)
     {
         return new X11PixmapSurfaceData(gc, width, height, image,
-                                        getSurfaceType(gc, transparency),
+                                        getSurfaceType(gc, transparency, true),
                                         cm, drawable, transparency);
     }
 
@@ -498,6 +510,13 @@
     public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
                                              int transparency)
     {
+        return getSurfaceType(gc, transparency, false);
+    }
+
+    public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
+                                             int transparency,
+                                             boolean pixmapSurface)
+    {
         boolean transparent = (transparency == Transparency.BITMASK);
         SurfaceType sType;
         ColorModel cm = gc.getColorModel();
@@ -524,11 +543,21 @@
             // Fall through for 32 bit case
         case 32:
             if (cm instanceof DirectColorModel) {
-                if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
-                    sType = transparent ? X11SurfaceData.IntRgbX11_BM : X11SurfaceData.IntRgbX11;
+                if (((SunToolkit)java.awt.Toolkit.getDefaultToolkit()
+                     ).isTranslucencyCapable(gc) && !pixmapSurface)
+                {
+                    sType = X11SurfaceData.IntArgbPreX11;
                 } else {
-                    sType = transparent ? X11SurfaceData.IntBgrX11_BM : X11SurfaceData.IntBgrX11;
+                    if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
+                        sType = transparent ? X11SurfaceData.IntRgbX11_BM :
+                                              X11SurfaceData.IntRgbX11;
+                    } else {
+                        sType = transparent ? X11SurfaceData.IntBgrX11_BM :
+                                              X11SurfaceData.IntBgrX11;
+                    }
                 }
+            } else if (cm instanceof ComponentColorModel) {
+                   sType = X11SurfaceData.FourByteAbgrPreX11;
             } else {
 
                 throw new sun.java2d.InvalidPipeException("Unsupported bit " +