Bug 598798 patch 4: Remove hard-coded GraphicsFilter from nsLayoutUtils::DrawSingleUnscaledImage, and make its dirty-rect argument optional. r=roc a=blocking-betaN
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 11 Oct 2010 13:08:07 -0700
changeset 55322 a29efb7cb08de8e8f208b79152614ff22c631b09
parent 55321 9f566f515e92442f46042dd45f348380fe33365e
child 55323 8576b55d017e6fde1e2b2c58c55d3be486ed11b3
push idunknown
push userunknown
push dateunknown
reviewersroc, blocking-betaN
bugs598798
milestone2.0b8pre
Bug 598798 patch 4: Remove hard-coded GraphicsFilter from nsLayoutUtils::DrawSingleUnscaledImage, and make its dirty-rect argument optional. r=roc a=blocking-betaN
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3112,18 +3112,19 @@ nsLayoutUtils::DrawPixelSnapped(nsIRende
                              drawingParams.mUserSpaceToImageSpace, subimage,
                              sourceRect, imageRect, drawingParams.mFillRect,
                              gfxASurface::ImageFormatARGB32, aFilter);
 }
 
 /* static */ nsresult
 nsLayoutUtils::DrawSingleUnscaledImage(nsIRenderingContext* aRenderingContext,
                                        imgIContainer*       aImage,
+                                       GraphicsFilter       aGraphicsFilter,
                                        const nsPoint&       aDest,
-                                       const nsRect&        aDirty,
+                                       const nsRect*        aDirty,
                                        PRUint32             aImageFlags,
                                        const nsRect*        aSourceArea)
 {
   nsIntSize imageSize;
   aImage->GetWidth(&imageSize.width);
   aImage->GetHeight(&imageSize.height);
   NS_ENSURE_TRUE(imageSize.width > 0 && imageSize.height > 0, NS_ERROR_FAILURE);
 
@@ -3139,18 +3140,19 @@ nsLayoutUtils::DrawSingleUnscaledImage(n
   }
 
   nsRect dest(aDest - source.TopLeft(), size);
   nsRect fill(aDest, source.Size());
   // Ensure that only a single image tile is drawn. If aSourceArea extends
   // outside the image bounds, we want to honor the aSourceArea-to-aDest
   // translation but we don't want to actually tile the image.
   fill.IntersectRect(fill, dest);
-  return DrawImageInternal(aRenderingContext, aImage, gfxPattern::FILTER_NEAREST,
-                           dest, fill, aDest, aDirty, imageSize, aImageFlags);
+  return DrawImageInternal(aRenderingContext, aImage, aGraphicsFilter,
+                           dest, fill, aDest, aDirty ? *aDirty : dest,
+                           imageSize, aImageFlags);
 }
 
 /* static */ nsresult
 nsLayoutUtils::DrawSingleImage(nsIRenderingContext* aRenderingContext,
                                imgIContainer*       aImage,
                                GraphicsFilter       aGraphicsFilter,
                                const nsRect&        aDest,
                                const nsRect&        aDirty,
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -991,27 +991,29 @@ public:
   /**
    * Draw a whole image without scaling or tiling.
    *
    *   @param aRenderingContext Where to draw the image, set up with an
    *                            appropriate scale and transform for drawing in
    *                            app units.
    *   @param aImage            The image.
    *   @param aDest             The top-left where the image should be drawn
-   *   @param aDirty            Pixels outside this area may be skipped.
+   *   @param aDirty            If non-null, then pixels outside this area may
+   *                            be skipped.
    *   @param aImageFlags       Image flags of the imgIContainer::FLAG_* variety
    *   @param aSourceArea       If non-null, this area is extracted from
    *                            the image and drawn at aDest. It's
    *                            in appunits. For best results it should
    *                            be aligned with image pixels.
    */
   static nsresult DrawSingleUnscaledImage(nsIRenderingContext* aRenderingContext,
                                           imgIContainer*       aImage,
+                                          GraphicsFilter       aGraphicsFilter,
                                           const nsPoint&       aDest,
-                                          const nsRect&        aDirty,
+                                          const nsRect*        aDirty,
                                           PRUint32             aImageFlags,
                                           const nsRect*        aSourceArea = nsnull);
 
   /**
    * Draw a whole image without tiling.
    *
    *   @param aRenderingContext Where to draw the image, set up with an
    *                            appropriate scale and transform for drawing in
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -3380,17 +3380,18 @@ nsTreeBodyFrame::PaintTwisty(PRInt32    
 
         // Center the image. XXX Obey vertical-align style prop?
         if (imageSize.height < twistyRect.height) {
           pt.y += (twistyRect.height - imageSize.height)/2;
         }
           
         // Paint the image.
         nsLayoutUtils::DrawSingleUnscaledImage(&aRenderingContext, image,
-            pt, aDirtyRect, imgIContainer::FLAG_NONE, &imageSize);
+            gfxPattern::FILTER_NEAREST, pt, &aDirtyRect,
+            imgIContainer::FLAG_NONE, &imageSize);
       }
     }
   }
 }
 
 void
 nsTreeBodyFrame::PaintImage(PRInt32              aRowIndex,
                             nsTreeColumn*        aColumn,
@@ -3688,17 +3689,18 @@ nsTreeBodyFrame::PaintCheckbox(PRInt32  
     }
 
     if (imageSize.width < checkboxRect.width) {
       pt.x += (checkboxRect.width - imageSize.width)/2;
     }
 
     // Paint the image.
     nsLayoutUtils::DrawSingleUnscaledImage(&aRenderingContext, image,
-        pt, aDirtyRect, imgIContainer::FLAG_NONE, &imageSize);
+        gfxPattern::FILTER_NEAREST, pt, &aDirtyRect,
+        imgIContainer::FLAG_NONE, &imageSize);
   }
 }
 
 void
 nsTreeBodyFrame::PaintProgressMeter(PRInt32              aRowIndex,
                                     nsTreeColumn*        aColumn,
                                     const nsRect&        aProgressMeterRect,
                                     nsPresContext*      aPresContext,