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

2D graphics - drawing to offscreen image performance too slow

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • CPU:
      x86
    • OS:
      windows_95

      Description

      Sometime between the JDK 1.1.4 and JDK 1.2s (which is the source code we
      have integrated with our modifications), Sun made radical changes to
      drawing to offscreen images. In 1.2s, when you call createImage (see
      WComponentPeer.java), it creates an instance of OffScreenImage which is
      essentially a block of memory set up as an RGBA bitmap. All drawing is
      done using a combination of Java and native code that draws to this
      bitmap by setting pixels. In contrast, in 1.1.4, a call to createImage
      would create a WOffScreenImage, which would create a bitmap using
      "CreateCompatibleBitmap", and draw to that bitmap using Windows calls in
      a manner identical to the way it was done for drawing to screen windows
      (through a WGraphics object).

      I believe the changes were made to accomodate the Java2D API changes,
      but the result has been to very dramatically slow down both drawing to
      offscreen images and the "drawImage" method used to blit them to a
      screen windows. (A very dramatic example of this slowdown can be seen by
      simply running the "Swingset" demo from Swing-0.5.1, which has
      acceptable performance in 1.1.4, but is pathetic in 1.2s). Also, I have
      attached a zip file with some test cases in it. To run, set your
      classpath to the install directory and enter:

      To run Offscreen performance test:
      ---------------------------------
      % java com.bentley.test.graphics.OSGraphTest map.log

      To run Onscreen performance test:
      --------------------------------
              % java com.bentley.test.graphics.GraphTest map.log

      My results show the offscreen test OSGraphTest taking about 4.3 seconds
      on JDK 1.1.4, and about 30 seconds on 1.2s.
      The onscreen test is comparable on the two.
      Note that there is a substantial delay when the test is started while it
      reads in and parses the map.log file.




       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              flar Jim Graham
              Reporter:
              jbenoit Jonathan Benoit (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: