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

DebugGraphics.drawImage(...) methods don't log any debug information

    XMLWordPrintable

Details

    • 1.2.2
    • sparc
    • solaris_2.5.1
    • Verified

    Description



      Name: aaC67449 Date: 10/16/98



      DebugGraphics.drawImage(...) methods don't log any debug information (contrary to what the spec says).
      only drawImage(mage img, int x, int y, ImageObserver observe) does it.

      javadoc for DebugGraphics says:"
      public class DebugGraphics extends java.awt.Graphics

      Graphics subclass supporting graphics debugging. Overrides most methods from Graphics. DebugGraphics objects are rarely created by hand. They are most frequently created automatically when a JComponent's debugGraphicsOptions are changed using the setDebugGraphicsOptions() method.
      "


      javadoc for JComponent.setDebugGraphicsOptions() says:"

      public void setDebugGraphicsOptions(int debugOptions)

            Enables or disables diagnostic information about every graphics operation performed within the component or one of its children. The value of debugOptions determines how the component should display this information:
        
      DebugGraphics.LOG_OPTION - causes a text message to be printed.
                  DebugGraphics.FLASH_OPTION - causes the drawing to flash several times.
                  DebugGraphics.BUFFERED_OPTION - creates an ExternalWindow that displays the operations performed on the View's offscreen buffer.
            
            debug is bitwise OR'd into the current value. DebugGraphics.NONE_OPTION disables debugging. A value of 0
            causes no changes to the debugging options.setDebugGraphicsOptions
      "

      So debug information should be loged.
      See source code:


      ----------------- Source ----------------
      DebugGraphics.java:1032:
          /**
           * Overrides <code>Graphics.drawImage</code>.
           */
          public boolean drawImage(Image img, int x, int y, int width, int height,
                                   ImageObserver observer) {
              return graphics.drawImage(img, x, y, width, height, observer);
          }
       
          /**
           * Overrides <code>Graphics.drawImage</code>.
           */
          public boolean drawImage(Image img, int x, int y,
                                   Color bgcolor,
                                   ImageObserver observer) {
              return graphics.drawImage(img, x, y, bgcolor, observer);
          }
       
      .....

      DebugGraphics.java:987:


         /**
           * Overrides <code>Graphics.drawImage</code>.
           */
          public boolean drawImage(Image img, int x, int y,
                                   ImageObserver observer) {
              DebugGraphicsInfo info = info();
       
              if (debugLog()) {
                  info().log(toShortString() +
                            " Drawing image: " + img +
                            " at: " + new Point(x, y));
              }
       
              if (isDrawingBuffer()) {
                  if (debugBuffered()) {
                      Graphics debugGraphics = debugGraphics();
       
                      debugGraphics.drawImage(img, x, y, observer);
                      debugGraphics.dispose();
                  }
              } else if (debugFlash()) {
                  int i, count = (info.flashCount * 2) - 1;
                  ImageProducer oldProducer = img.getSource();
                  ImageProducer newProducer
                      = new FilteredImageSource(oldProducer,
                                      new DebugGraphicsFilter(info.flashColor));
                  Image newImage
                      = Toolkit.getDefaultToolkit().createImage(newProducer);
                  DebugGraphicsObserver imageObserver
                      = new DebugGraphicsObserver();
       
                  for (i = 0; i < count; i++) {
                      graphics.drawImage((i % 2) == 0 ? newImage : img, x, y,
                                         imageObserver);
                      Toolkit.getDefaultToolkit().sync();
                      while (!imageObserver.allBitsPresent() &&
                                             !imageObserver.imageHasProblem()) {
                          sleep(10);
                      }
                      sleep(info.flashTime);
                  }
              }
              return graphics.drawImage(img, x, y, observer);
          }
       

      ======================================================================

      Attachments

        Activity

          People

            tballsunw Tom Ball (Inactive)
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: