1.1 --- a/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386 Tue May 19 14:43:49 2009 +0400
1.2 +++ b/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386 Tue May 19 17:03:13 2009 +0400
1.3 @@ -186,6 +186,15 @@
1.4 XEvent.xkeymap 0
1.5 XEvent.pad 0
1.6 XEvent 192
1.7 +XRenderDirectFormat.red 0
1.8 +XRenderDirectFormat.redMask 2
1.9 +XRenderDirectFormat.green 4
1.10 +XRenderDirectFormat.greenMask 6
1.11 +XRenderDirectFormat.blue 8
1.12 +XRenderDirectFormat.blueMask 10
1.13 +XRenderDirectFormat.alpha 12
1.14 +XRenderDirectFormat.alphaMask 14
1.15 +XRenderDirectFormat 16
1.16 ColorData.awt_Colors 0
1.17 ColorData.awt_numICMcolors 8
1.18 ColorData.awt_icmLUT 16
1.19 @@ -440,6 +449,12 @@
1.20 XSetWindowAttributes.colormap 96
1.21 XSetWindowAttributes.cursor 104
1.22 XSetWindowAttributes 112
1.23 +XRenderPictFormat.id 0
1.24 +XRenderPictFormat.type 8
1.25 +XRenderPictFormat.depth 12
1.26 +XRenderPictFormat.direct 16
1.27 +XRenderPictFormat.colormap 32
1.28 +XRenderPictFormat 40
1.29 XReparentEvent.type 0
1.30 XReparentEvent.serial 8
1.31 XReparentEvent.send_event 16
1.32 @@ -985,7 +1000,8 @@
1.33 AwtGraphicsConfigData.color_data 144
1.34 AwtGraphicsConfigData.glxInfo 152
1.35 AwtGraphicsConfigData.isTranslucencySupported 160
1.36 -AwtGraphicsConfigData 168
1.37 +AwtGraphicsConfigData.renderPictFormat 168
1.38 +AwtGraphicsConfigData 208
1.39 XColor.pixel 0
1.40 XColor.red 8
1.41 XColor.green 10
2.1 --- a/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt Tue May 19 14:43:49 2009 +0400
2.2 +++ b/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt Tue May 19 17:03:13 2009 +0400
2.3 @@ -245,6 +245,21 @@
2.4 blue_mask long
2.5 colormap_size int
2.6 bits_per_rgb int
2.7 +XRenderDirectFormat
2.8 + red short
2.9 + redMask short
2.10 + green short
2.11 + greenMask short
2.12 + blue short
2.13 + blueMask short
2.14 + alpha short
2.15 + alphaMask short
2.16 +XRenderPictFormat
2.17 + id long
2.18 + type int
2.19 + depth int
2.20 + direct struct XRenderDirectFormat
2.21 + colormap long
2.22 XIMHotKeyTrigger
2.23 keysym long
2.24 modifier int
2.25 @@ -751,6 +766,7 @@
2.26 color_data pointer ColorData
2.27 glxInfo pointer
2.28 isTranslucencySupported int
2.29 + renderPictFormat struct XRenderPictFormat
2.30
2.31 AwtScreenData
2.32 numConfigs int
3.1 --- a/src/solaris/classes/sun/awt/X11GraphicsConfig.java Tue May 19 14:43:49 2009 +0400
3.2 +++ b/src/solaris/classes/sun/awt/X11GraphicsConfig.java Tue May 19 17:03:13 2009 +0400
3.3 @@ -37,7 +37,10 @@
3.4 import java.awt.Transparency;
3.5 import java.awt.image.BufferedImage;
3.6 import java.awt.image.ColorModel;
3.7 +import java.awt.color.ColorSpace;
3.8 +import java.awt.image.ComponentColorModel;
3.9 import java.awt.image.DirectColorModel;
3.10 +import java.awt.image.DataBuffer;
3.11 import java.awt.image.VolatileImage;
3.12 import java.awt.image.WritableRaster;
3.13 import java.awt.geom.AffineTransform;
3.14 @@ -230,6 +233,22 @@
3.15 }
3.16 }
3.17
3.18 + public static DirectColorModel createDCM32(int rMask, int gMask, int bMask,
3.19 + int aMask, boolean aPre) {
3.20 + return new DirectColorModel(
3.21 + ColorSpace.getInstance(ColorSpace.CS_sRGB),
3.22 + 32, rMask, gMask, bMask, aMask, aPre, DataBuffer.TYPE_INT);
3.23 + }
3.24 +
3.25 + public static ComponentColorModel createABGRCCM() {
3.26 + ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
3.27 + int[] nBits = {8, 8, 8, 8};
3.28 + int[] bOffs = {3, 2, 1, 0};
3.29 + return new ComponentColorModel(cs, nBits, true, true,
3.30 + Transparency.TRANSLUCENT,
3.31 + DataBuffer.TYPE_BYTE);
3.32 + }
3.33 +
3.34 /**
3.35 * Returns the default Transform for this configuration. This
3.36 * Transform is typically the Identity transform for most normal
4.1 --- a/src/solaris/classes/sun/java2d/x11/X11PMBlitBgLoops.java Tue May 19 14:43:49 2009 +0400
4.2 +++ b/src/solaris/classes/sun/java2d/x11/X11PMBlitBgLoops.java Tue May 19 17:03:13 2009 +0400
4.3 @@ -70,6 +70,10 @@
4.4 X11SurfaceData.UShort565RgbX11),
4.5 new X11PMBlitBgLoops(X11SurfaceData.UShortIndexedX11_BM,
4.6 X11SurfaceData.UShortIndexedX11),
4.7 + new X11PMBlitBgLoops(X11SurfaceData.IntRgbX11_BM,
4.8 + X11SurfaceData.IntArgbPreX11),
4.9 + new X11PMBlitBgLoops(X11SurfaceData.IntBgrX11_BM,
4.10 + X11SurfaceData.FourByteAbgrPreX11),
4.11 };
4.12 GraphicsPrimitiveMgr.register(primitives);
4.13 }
5.1 --- a/src/solaris/classes/sun/java2d/x11/X11PMBlitLoops.java Tue May 19 14:43:49 2009 +0400
5.2 +++ b/src/solaris/classes/sun/java2d/x11/X11PMBlitLoops.java Tue May 19 17:03:13 2009 +0400
5.3 @@ -95,6 +95,22 @@
5.4 new X11PMBlitLoops(X11SurfaceData.UShortIndexedX11_BM,
5.5 X11SurfaceData.UShortIndexedX11, true),
5.6
5.7 + new X11PMBlitLoops(X11SurfaceData.IntRgbX11,
5.8 + X11SurfaceData.IntArgbPreX11, true),
5.9 + new X11PMBlitLoops(X11SurfaceData.IntRgbX11,
5.10 + X11SurfaceData.IntArgbPreX11, false),
5.11 + new X11PMBlitLoops(X11SurfaceData.IntRgbX11_BM,
5.12 + X11SurfaceData.IntArgbPreX11, true),
5.13 +
5.14 + new X11PMBlitLoops(X11SurfaceData.IntBgrX11,
5.15 + X11SurfaceData.FourByteAbgrPreX11, true),
5.16 + new X11PMBlitLoops(X11SurfaceData.IntBgrX11,
5.17 + X11SurfaceData.FourByteAbgrPreX11, false),
5.18 + new X11PMBlitLoops(X11SurfaceData.IntBgrX11_BM,
5.19 + X11SurfaceData.FourByteAbgrPreX11, true),
5.20 +
5.21 +
5.22 +
5.23 // delegate loops
5.24 new DelegateBlitLoop(X11SurfaceData.IntBgrX11_BM,
5.25 X11SurfaceData.IntBgrX11),
6.1 --- a/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java Tue May 19 14:43:49 2009 +0400
6.2 +++ b/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java Tue May 19 17:03:13 2009 +0400
6.3 @@ -81,6 +81,13 @@
6.4 DESC_INT_BGR_X11 = "Integer BGR Pixmap";
6.5 public static final String
6.6 DESC_INT_RGB_X11 = "Integer RGB Pixmap";
6.7 +
6.8 + public static final String
6.9 + DESC_4BYTE_ABGR_PRE_X11 = "4 byte ABGR Pixmap with pre-multplied alpha";
6.10 + public static final String
6.11 + DESC_INT_ARGB_PRE_X11 = "Integer ARGB Pixmap with pre-multiplied " +
6.12 + "alpha";
6.13 +
6.14 public static final String
6.15 DESC_BYTE_IND_OPQ_X11 = "Byte Indexed Opaque Pixmap";
6.16
6.17 @@ -133,6 +140,11 @@
6.18 public static final SurfaceType IntRgbX11 =
6.19 SurfaceType.IntRgb.deriveSubType(DESC_INT_RGB_X11);
6.20
6.21 + public static final SurfaceType FourByteAbgrPreX11 =
6.22 + SurfaceType.FourByteAbgrPre.deriveSubType(DESC_4BYTE_ABGR_PRE_X11);
6.23 + public static final SurfaceType IntArgbPreX11 =
6.24 + SurfaceType.IntArgbPre.deriveSubType(DESC_INT_ARGB_PRE_X11);
6.25 +
6.26 public static final SurfaceType ThreeByteRgbX11 =
6.27 SurfaceType.ThreeByteRgb.deriveSubType(DESC_3BYTE_RGB_X11);
6.28 public static final SurfaceType ThreeByteBgrX11 =
6.29 @@ -413,7 +425,7 @@
6.30 int transparency)
6.31 {
6.32 return new X11PixmapSurfaceData(gc, width, height, image,
6.33 - getSurfaceType(gc, transparency),
6.34 + getSurfaceType(gc, transparency, true),
6.35 cm, drawable, transparency);
6.36 }
6.37
6.38 @@ -498,6 +510,13 @@
6.39 public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
6.40 int transparency)
6.41 {
6.42 + return getSurfaceType(gc, transparency, false);
6.43 + }
6.44 +
6.45 + public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
6.46 + int transparency,
6.47 + boolean pixmapSurface)
6.48 + {
6.49 boolean transparent = (transparency == Transparency.BITMASK);
6.50 SurfaceType sType;
6.51 ColorModel cm = gc.getColorModel();
6.52 @@ -524,11 +543,21 @@
6.53 // Fall through for 32 bit case
6.54 case 32:
6.55 if (cm instanceof DirectColorModel) {
6.56 - if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
6.57 - sType = transparent ? X11SurfaceData.IntRgbX11_BM : X11SurfaceData.IntRgbX11;
6.58 + if (((SunToolkit)java.awt.Toolkit.getDefaultToolkit()
6.59 + ).isTranslucencyCapable(gc) && !pixmapSurface)
6.60 + {
6.61 + sType = X11SurfaceData.IntArgbPreX11;
6.62 } else {
6.63 - sType = transparent ? X11SurfaceData.IntBgrX11_BM : X11SurfaceData.IntBgrX11;
6.64 + if (((DirectColorModel)cm).getRedMask() == 0xff0000) {
6.65 + sType = transparent ? X11SurfaceData.IntRgbX11_BM :
6.66 + X11SurfaceData.IntRgbX11;
6.67 + } else {
6.68 + sType = transparent ? X11SurfaceData.IntBgrX11_BM :
6.69 + X11SurfaceData.IntBgrX11;
6.70 + }
6.71 }
6.72 + } else if (cm instanceof ComponentColorModel) {
6.73 + sType = X11SurfaceData.FourByteAbgrPreX11;
6.74 } else {
6.75
6.76 throw new sun.java2d.InvalidPipeException("Unsupported bit " +
7.1 --- a/src/solaris/native/sun/awt/X11Color.c Tue May 19 14:43:49 2009 +0400
7.2 +++ b/src/solaris/native/sun/awt/X11Color.c Tue May 19 17:03:13 2009 +0400
7.3 @@ -886,6 +886,27 @@
7.4 #define blue(v) (((v) >> 0) & 0xFF)
7.5
7.6 #ifndef HEADLESS
7.7 +
7.8 +jobject getColorSpace(JNIEnv* env, jint csID) {
7.9 + jclass clazz;
7.10 + jobject cspaceL;
7.11 + jmethodID mid;
7.12 +
7.13 + clazz = (*env)->FindClass(env,"java/awt/color/ColorSpace");
7.14 + mid = (*env)->GetStaticMethodID(env, clazz, "getInstance",
7.15 + "(I)Ljava/awt/color/ColorSpace;");
7.16 + if (mid == NULL) {
7.17 + return NULL;
7.18 + }
7.19 +
7.20 + /* SECURITY: This is safe, because static methods cannot
7.21 + * be overridden, and this method does not invoke
7.22 + * client code
7.23 + */
7.24 +
7.25 + return (*env)->CallStaticObjectMethod(env, clazz, mid, csID);
7.26 +}
7.27 +
7.28 jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData)
7.29 {
7.30 jobject awt_colormodel = NULL;
7.31 @@ -899,21 +920,61 @@
7.32 (aData->awt_depth >= 15))
7.33 {
7.34 clazz = (*env)->FindClass(env,"java/awt/image/DirectColorModel");
7.35 + if (!aData->isTranslucencySupported) {
7.36
7.37 - mid = (*env)->GetMethodID(env,clazz,"<init>","(IIIII)V");
7.38 + mid = (*env)->GetMethodID(env,clazz,"<init>","(IIIII)V");
7.39
7.40 - if (mid == NULL) {
7.41 - (*env)->PopLocalFrame(env, 0);
7.42 - return NULL;
7.43 + if (mid == NULL) {
7.44 + (*env)->PopLocalFrame(env, 0);
7.45 + return NULL;
7.46 + }
7.47 + awt_colormodel = (*env)->NewObject(env,clazz, mid,
7.48 + aData->awt_visInfo.depth,
7.49 + aData->awt_visInfo.red_mask,
7.50 + aData->awt_visInfo.green_mask,
7.51 + aData->awt_visInfo.blue_mask,
7.52 + 0);
7.53 + } else {
7.54 + clazz = (*env)->FindClass(env,"sun/awt/X11GraphicsConfig");
7.55 + if (clazz == NULL) {
7.56 + (*env)->PopLocalFrame(env, 0);
7.57 + return NULL;
7.58 + }
7.59 +
7.60 + if (aData->renderPictFormat.direct.red == 16) {
7.61 + mid = (*env)->GetStaticMethodID( env,clazz,"createDCM32",
7.62 + "(IIIIZ)Ljava/awt/image/DirectColorModel;");
7.63 +
7.64 + if (mid == NULL) {
7.65 + (*env)->PopLocalFrame(env, 0);
7.66 + return NULL;
7.67 + }
7.68 +
7.69 + awt_colormodel = (*env)->CallStaticObjectMethod(
7.70 + env,clazz, mid,
7.71 + aData->renderPictFormat.direct.redMask
7.72 + << aData->renderPictFormat.direct.red,
7.73 + aData->renderPictFormat.direct.greenMask
7.74 + << aData->renderPictFormat.direct.green,
7.75 + aData->renderPictFormat.direct.blueMask
7.76 + << aData->renderPictFormat.direct.blue,
7.77 + aData->renderPictFormat.direct.alphaMask
7.78 + << aData->renderPictFormat.direct.alpha,
7.79 + JNI_TRUE);
7.80 + } else {
7.81 + mid = (*env)->GetStaticMethodID( env,clazz,"createABGRCCM",
7.82 + "()Ljava/awt/image/ComponentColorModel;");
7.83 +
7.84 + if (mid == NULL) {
7.85 + (*env)->PopLocalFrame(env, 0);
7.86 + return NULL;
7.87 + }
7.88 +
7.89 + awt_colormodel = (*env)->CallStaticObjectMethod(
7.90 + env,clazz, mid);
7.91 + }
7.92 }
7.93
7.94 - awt_colormodel = (*env)->NewObject(env,clazz, mid,
7.95 - aData->awt_visInfo.depth,
7.96 - aData->awt_visInfo.red_mask,
7.97 - aData->awt_visInfo.green_mask,
7.98 - aData->awt_visInfo.blue_mask,
7.99 - 0);
7.100 -
7.101 if(awt_colormodel == NULL)
7.102 {
7.103 (*env)->PopLocalFrame(env, 0);
7.104 @@ -923,25 +984,13 @@
7.105 }
7.106 else if (aData->awt_visInfo.class == StaticGray &&
7.107 aData->awt_num_colors == 256) {
7.108 - jclass clazz1;
7.109 jobject cspace = NULL;
7.110 jint bits[1];
7.111 jintArray bitsArray;
7.112 jboolean falseboolean = JNI_FALSE;
7.113
7.114 - clazz1 = (*env)->FindClass(env,"java/awt/color/ColorSpace");
7.115 - mid = (*env)->GetStaticMethodID(env, clazz1, "getInstance",
7.116 - "(I)Ljava/awt/color/ColorSpace;");
7.117 - if (mid == NULL) {
7.118 - (*env)->PopLocalFrame(env, 0);
7.119 - return NULL;
7.120 - }
7.121 - /* SECURITY: This is safe, because static methods cannot
7.122 - * be overridden, and this method does not invoke
7.123 - * client code
7.124 - */
7.125 - cspace = (*env)->CallStaticObjectMethod(env, clazz1, mid,
7.126 - java_awt_color_ColorSpace_CS_GRAY);
7.127 + cspace = getColorSpace(env, java_awt_color_ColorSpace_CS_GRAY);
7.128 +
7.129 if (cspace == NULL) {
7.130 (*env)->PopLocalFrame(env, 0);
7.131 return NULL;
8.1 --- a/src/solaris/native/sun/awt/awt_GraphicsEnv.c Tue May 19 14:43:49 2009 +0400
8.2 +++ b/src/solaris/native/sun/awt/awt_GraphicsEnv.c Tue May 19 17:03:13 2009 +0400
8.3 @@ -323,48 +323,6 @@
8.4 return NULL;
8.5 }
8.6
8.7 -/* Note: until we include the <X11/extensions/Xrender.h> explicitly
8.8 - * we have to define a couple of things ourselves.
8.9 - */
8.10 -typedef unsigned long PictFormat;
8.11 -#define PictTypeIndexed 0
8.12 -#define PictTypeDirect 1
8.13 -
8.14 -typedef struct {
8.15 - short red;
8.16 - short redMask;
8.17 - short green;
8.18 - short greenMask;
8.19 - short blue;
8.20 - short blueMask;
8.21 - short alpha;
8.22 - short alphaMask;
8.23 -} XRenderDirectFormat;
8.24 -
8.25 -typedef struct {
8.26 - PictFormat id;
8.27 - int type;
8.28 - int depth;
8.29 - XRenderDirectFormat direct;
8.30 - Colormap colormap;
8.31 -} XRenderPictFormat;
8.32 -
8.33 -#define PictFormatID (1 << 0)
8.34 -#define PictFormatType (1 << 1)
8.35 -#define PictFormatDepth (1 << 2)
8.36 -#define PictFormatRed (1 << 3)
8.37 -#define PictFormatRedMask (1 << 4)
8.38 -#define PictFormatGreen (1 << 5)
8.39 -#define PictFormatGreenMask (1 << 6)
8.40 -#define PictFormatBlue (1 << 7)
8.41 -#define PictFormatBlueMask (1 << 8)
8.42 -#define PictFormatAlpha (1 << 9)
8.43 -#define PictFormatAlphaMask (1 << 10)
8.44 -#define PictFormatColormap (1 << 11)
8.45 -
8.46 -typedef XRenderPictFormat *
8.47 -XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
8.48 -
8.49 static void
8.50 getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
8.51
8.52 @@ -504,6 +462,8 @@
8.53 format->direct.alphaMask)
8.54 {
8.55 graphicsConfigs [ind]->isTranslucencySupported = 1;
8.56 + memcpy(&graphicsConfigs [ind]->renderPictFormat, format,
8.57 + sizeof(*format));
8.58 }
8.59 }
8.60 }
9.1 --- a/src/solaris/native/sun/awt/awt_p.h Tue May 19 14:43:49 2009 +0400
9.2 +++ b/src/solaris/native/sun/awt/awt_p.h Tue May 19 17:03:13 2009 +0400
9.3 @@ -119,6 +119,50 @@
9.4 } DamageRect;
9.5
9.6 #ifndef HEADLESS
9.7 +
9.8 +/* Note: until we include the <X11/extensions/Xrender.h> explicitly
9.9 + * we have to define a couple of things ourselves.
9.10 + */
9.11 +typedef unsigned long PictFormat;
9.12 +#define PictTypeIndexed 0
9.13 +#define PictTypeDirect 1
9.14 +
9.15 +typedef struct {
9.16 + short red;
9.17 + short redMask;
9.18 + short green;
9.19 + short greenMask;
9.20 + short blue;
9.21 + short blueMask;
9.22 + short alpha;
9.23 + short alphaMask;
9.24 +} XRenderDirectFormat;
9.25 +
9.26 +typedef struct {
9.27 + PictFormat id;
9.28 + int type;
9.29 + int depth;
9.30 + XRenderDirectFormat direct;
9.31 + Colormap colormap;
9.32 +} XRenderPictFormat;
9.33 +
9.34 +#define PictFormatID (1 << 0)
9.35 +#define PictFormatType (1 << 1)
9.36 +#define PictFormatDepth (1 << 2)
9.37 +#define PictFormatRed (1 << 3)
9.38 +#define PictFormatRedMask (1 << 4)
9.39 +#define PictFormatGreen (1 << 5)
9.40 +#define PictFormatGreenMask (1 << 6)
9.41 +#define PictFormatBlue (1 << 7)
9.42 +#define PictFormatBlueMask (1 << 8)
9.43 +#define PictFormatAlpha (1 << 9)
9.44 +#define PictFormatAlphaMask (1 << 10)
9.45 +#define PictFormatColormap (1 << 11)
9.46 +
9.47 +typedef XRenderPictFormat *
9.48 +XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
9.49 +/* END OF Xrender.h chunk */
9.50 +
9.51 typedef struct _AwtGraphicsConfigData {
9.52 int awt_depth;
9.53 Colormap awt_cmap;
9.54 @@ -136,6 +180,7 @@
9.55 ColorData *color_data;
9.56 struct _GLXGraphicsConfigInfo *glxInfo;
9.57 int isTranslucencySupported; /* Uses Xrender to find this out. */
9.58 + XRenderPictFormat renderPictFormat; /*Used only if translucency supported*/
9.59 } AwtGraphicsConfigData;
9.60
9.61 typedef AwtGraphicsConfigData* AwtGraphicsConfigDataPtr;