[OpenJDK 2D-Dev] 6603887: Where are transparent areas filled with bgColor?
Dmitri Trembovetski
Dmitri.Trembovetski at Sun.COM
Fri Sep 28 16:37:10 UTC 2007
Hi Clemens,
thanks for the suggested fix. It looks fine to me
so I could integrate it for you providing there are
no issues found by other reviewers.
Could you produce an automated regression test?
Just construct an 8-bit image with white as transparent
color, render it to a some-color-filled VI, then
get a snapshot and check that the color of the VI
didn't change. If it did, throw a RuntimeError..
If we do it quickly (like, today) we can integrate it into
the next build..
Thanks,
Dmitri
Clemens Eisserer wrote:
> Hi,
>
>> It may - if the transparent pixel is 0th entry in the colormap.
>>
>> I think we'll have to resort to another boolean which tells
>> whether bgPixel is valid - like you suggested.
> Yes, I also think this would be a better fix, and it would make the
> source more readable in my opinion.
>
> I copied my first attemp to fix the problem below.
>
> lg Clemens
>
> PS: Thanks for open-sourcing java!
>
> --- /home/ce/mozilla_java_prob/jdk7_original/j2se/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
> 2007-09-12 20:11:42.000000000 +0200
> +++ /home/ce/mozilla_java_prob/jdk7_modified/j2se/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
> 2007-09-28 12:25:19.000000000 +0200
> @@ -256,6 +256,7 @@
> xsdo->isPixmap = JNI_FALSE;
> xsdo->bitmask = 0;
> xsdo->bgPixel = 0;
> + xsdo->isBgInitialized = JNI_FALSE;
> #ifdef MITSHM
> xsdo->shmPMData.shmSegInfo = NULL;
> xsdo->shmPMData.xRequestSent = JNI_FALSE;
> @@ -997,7 +998,7 @@
> }
> /* the background pixel is not valid anymore */
> if (xpriv->lockFlags & SD_LOCK_WRITE) {
> - xsdo->bgPixel = 0;
> + xsdo->isBgInitialized = JNI_FALSE;
> }
> xpriv->lockType = X11SD_LOCK_UNLOCKED;
> AWT_UNLOCK();
> @@ -1485,7 +1486,7 @@
>
> /* Check if current color of the transparent pixels is different
> from the specified one */
> - if (xsdo->bgPixel != pixel + 1) {
> + if (xsdo->bgPixel != pixel || xsdo->isBgInitialized == JNI_FALSE) {
> GC srcGC;
> GC bmGC;
>
> @@ -1525,7 +1526,8 @@
>
> XFreeGC(awt_display, bmGC);
> XFreeGC(awt_display, srcGC);
> - xsdo->bgPixel = pixel + 1;
> + xsdo->bgPixel = pixel;
> + xsdo->isBgInitialized = JNI_TRUE;
> }
>
> return xsdo->drawable;
>
>
> --- /home/ce/mozilla_java_prob/jdk7_original/j2se/src/solaris/native/sun/java2d/x11/X11SurfaceData.h
> 2007-09-12 20:11:42.000000000 +0200
> +++ /home/ce/mozilla_java_prob/jdk7_modified/j2se/src/solaris/native/sun/java2d/x11/X11SurfaceData.h
> 2007-09-28 12:22:45.000000000 +0200
> @@ -107,6 +107,7 @@
> void *dgaDev;
> Pixmap bitmask;
> jint bgPixel; /* bg pixel for the pixmap */
> + jboolean isBgInitialized;
> jint pmWidth; /* width, height of the */
> jint pmHeight; /* pixmap */
> #ifdef MITSHM
More information about the 2d-dev
mailing list