Hi Clemens,

  do you see the same issue with Java 6 or is it
  Java 7 specific?

Clemens Eisserer wrote:
Hi there,

I recently found a strange bug while fixing the
Mozilla-Browser-Plugin, somehow the Java2d/X11 pipeline has problems
with the graybox_error.gif which is shown when an applet fails to
initialize.
The image is a partially transparent gif which is drawn with a
background-color specified. It works for the first time, but at
subsequent blits the transparent pixels which should be white are
black.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6603887.

I played a bit with Java2D's trace functionality that came out:

1.) First draw, rendered correctly:
sun.java2d.loops.BlitBg::BlitBg(ByteIndexedBm, SrcNoEa, IntRgb)

2.) Seems like the accaleration-blit:
sun.java2d.x11.X11PMBlitLoops$DelegateBlitLoop::Blit(Any, SrcNoEa,
"Integer RGB Pixmap with 1-bit transp")
sun.java2d.loops.Blit::Blit(ByteIndexed, SrcNoEa, IntRgb)
sun.java2d.x11.X11PMBlitBgLoops::BlitBg("Integer RGB Pixmap with 1-bit
transp", SrcNoEa, "Integer RGB Pixmap")

3.) subsequent draws only do:
sun.java2d.x11.X11PMBlitBgLoops::BlitBg("Integer RGB Pixmap with 1-bit
transp", SrcNoEa, "Integer RGB Pixmap")

So the interesing opereations seem to habben in 2.) I guess.

In X11PMLoops I saw the following comment:
   /* do an unmasked copy as we've already filled transparent
      pixels of the source image with the desired color */
   XCopyArea(awt_display, srcDrawable, dstXsdo->drawable, dstGC,
             srcx, srcy, width, height, dstx, dsty);

So I guess somehow the filling of the transparent colors with the
background-color does something wrong.
However I did not find the code where this happens, so some
navigation-help would be really appiciated ;)

  It happens here during this call:
    srcDrawable = srcXsdo->GetPixmapWithBg(env, srcXsdo, pixel);
  Which can be found in X11SurfaceData.c (X11SD_GetPixmapWithBg).
  Here 'pixel' is the pixel value of the bg color.

  There were some changes in this area recently in jdk7.
  My guess would be that we don't initialize the bitmask.
  In the case of a Blit we call (see X11PMBlitLoops.Blit)
            updateBitmask(src, dst,
                          src.getColorModel() instanceof IndexColorModel);
  but I don't see us doing it for the BlitBg.

  So if you do only BlitBg blits from the image the
  bitmask will never get initialized.
  Try adding the updateBitmask call to BlitBg and see if it helps..

  Thanks,
    Dmitri




Thank you in advance, lg Clemens

Reply via email to