src/share/classes/java/awt/MediaTracker.java

Print this page

        

@@ -224,11 +224,13 @@
      */
     public synchronized void addImage(Image image, int id, int w, int h) {
         addImageImpl(image, id, w, h);
         Image rvImage = getResolutionVariant(image);
         if (rvImage != null) {
-            addImageImpl(rvImage, id, 2 * w, 2 * h);
+            addImageImpl(rvImage, id,
+                    w == -1 ? -1 : 2 * w,
+                    h == -1 ? -1 : 2 * h);
         }
     }
 
     private void addImageImpl(Image image, int id, int w, int h) {
         head = MediaEntry.insert(head,

@@ -808,12 +810,13 @@
     public synchronized void removeImage(Image image, int id,
                                          int width, int height) {
         removeImageImpl(image, id, width, height);
         Image rvImage = getResolutionVariant(image);
         if (rvImage != null) {
-            removeImageImpl(rvImage, id, 2 * width, 2 * height);
-
+            removeImageImpl(rvImage, id,
+                    width == -1 ? -1 : 2 * width,
+                    height == -1 ? -1 : 2 * height);
         }
         notifyAll();    // Notify in case remaining images are "done".
     }
 
     private void removeImageImpl(Image image, int id, int width, int height) {