Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4377680

[JAI] Non-RGB bufferedImage displayed w/positive translation is not converted to

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • Resolved In Build:
      beta
    • CPU:
      generic, sparc
    • OS:
      generic, solaris_2.5

      Description

      For a BufferedImage with CS_* color space other than CS_sRGB, when it is displayed with a negative translation, it is converted back to RGB color space and then displayed; if the translation parameters are positive, the image is displayed as it is a RGB image.

      Please see the attached test program.

      --------------------------------
      Also found a similar problem when running a TiledImageTest. This test is used to test the TiledImage class in JAI. The test loads a image then converts it from a single tile image to a multi-tile image. Then extract the subbands to create 6 single-band gray scale tiled image. When display these gray scale tiled images, the display is really slow (use about half a minute to display one gray scale image) and the result is not correct (the image is converted to some other color space instead of gray scale color space). This test is profiled. More than 80% of the time is used in ColorConvert and GetNumComponents:

               Stub + native Method
       48.6% 60 + 10504 sun.awt.color.CMM.cmmColorConvert
       33.1% 98 + 7094 sun.awt.color.CMM.cmmGetNumComponents
       81.6% 158 + 17598 Total stub

      The whole profile is attached to this bug.

      The code for displaying the image is listed as following:

                  if ( tile != null ) {
                      WritableRaster wr =
                          tile instanceof WritableRaster ?
                          ((WritableRaster)tile).createWritableTranslatedChild(0, 0) :
                          tile.createWritableRaster(sampleModel,
                                                    tile.getDataBuffer(),
                                                    new Point(0, 0));

                      BufferedImage bi =
                          new BufferedImage(colorModel,
                                            wr,
                                            colorModel.isAlphaPremultiplied(),
                                            null);

                      AffineTransform transform =
                          AffineTransform.getTranslateInstance(tx + transX,
                                                               ty + transY);
                      if (backgroundColor != null) {
                          g2D.fillRect(tx + transX, ty + transY,
                                       tileWidth, tileHeight);
                      }
                      g2D.drawRenderedImage(bi, transform);
                  }

      Most of the time (more than 80% as listed above) is used in the sentence:
      g2D.drawRenderedImage(bi, transform);

      Running the same test using different jdks shows that only when use /import/jai/jdk1.3fcs, this test runs very slow. When use /import/jai/jdk1.3 and /import/jai/jdk1.2, the test runs very fast.

      Then load the old Jai1.0.2 and run the same test. It is slow when use /import/jai/jdk1.3fcs. It works well with other jdks.


      qinghuai.gao@eng 2000-10-16

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              flar Jim Graham
              Reporter:
              qgao Qinghuai Gao (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: