Bug 1507021. Use SnappedRectangle in more places. r=mattwoodrow
authorJeff Muizelaar <jrmuizel@gmail.com>
Mon, 19 Nov 2018 23:03:32 +0000
changeset 503497 8384aff8cc59b921445914e936dab3bb33701f8d
parent 503496 0c071afc1e4b8b91b34626676990c3736d03dbb6
child 503498 9e05a9bac1e53d9994946c32f8121523b8d9b5c1
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1507021
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507021. Use SnappedRectangle in more places. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D11840
gfx/thebes/gfxContext.h
gfx/thebes/gfxTextRun.cpp
layout/base/PresShell.cpp
layout/painting/DisplayItemClip.cpp
layout/painting/nsCSSRendering.cpp
layout/painting/nsDisplayList.cpp
layout/svg/nsSVGIntegrationUtils.cpp
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -144,20 +144,22 @@ public:
     // path helpers
     /**
      * Draws a line from start to end.
      */
     void Line(const gfxPoint& start, const gfxPoint& end); // XXX snapToPixels option?
 
     /**
      * Draws the rectangle given by rect.
-     * @param snapToPixels ?
      */
-    void Rectangle(const gfxRect& rect, bool snapToPixels = false);
+    void Rectangle(const gfxRect& rect) { return Rectangle(rect, false); }
     void SnappedRectangle(const gfxRect& rect) { return Rectangle(rect, true); }
+private:
+    void Rectangle(const gfxRect& rect, bool snapToPixels);
+public:
 
     /**
      ** Transformation Matrix manipulation
      **/
 
     /**
      * Post-multiplies 'other' onto the current CTM, i.e. this
      * matrix's transformation will take place before the previously set
--- a/gfx/thebes/gfxTextRun.cpp
+++ b/gfx/thebes/gfxTextRun.cpp
@@ -557,20 +557,20 @@ struct MOZ_STACK_CLASS BufferAlphaColor 
     }
 
     ~BufferAlphaColor() {}
 
     void PushSolidColor(const gfxRect& aBounds, const Color& aAlphaColor, uint32_t appsPerDevUnit)
     {
         mContext->Save();
         mContext->NewPath();
-        mContext->Rectangle(gfxRect(aBounds.X() / appsPerDevUnit,
+        mContext->SnappedRectangle(gfxRect(aBounds.X() / appsPerDevUnit,
                     aBounds.Y() / appsPerDevUnit,
                     aBounds.Width() / appsPerDevUnit,
-                    aBounds.Height() / appsPerDevUnit), true);
+                    aBounds.Height() / appsPerDevUnit));
         mContext->Clip();
         mContext->SetColor(Color(aAlphaColor.r, aAlphaColor.g, aAlphaColor.b));
         mContext->PushGroupForBlendBack(gfxContentType::COLOR_ALPHA, aAlphaColor.a);
     }
 
     void PopAlpha()
     {
         // pop the text, using the color alpha as the opacity
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -4707,17 +4707,17 @@ PresShell::RenderDocument(const nsRect& 
   nsAutoScriptBlocker blockScripts;
 
   // Set up the rectangle as the path in aThebesContext
   gfxRect r(0, 0,
             nsPresContext::AppUnitsToFloatCSSPixels(aRect.width),
             nsPresContext::AppUnitsToFloatCSSPixels(aRect.height));
   aThebesContext->NewPath();
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
-  aThebesContext->Rectangle(r, true);
+  aThebesContext->SnappedRectangle(r);
 #else
   aThebesContext->Rectangle(r);
 #endif
 
   nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
   if (!rootFrame) {
     // Nothing to paint, just fill the rect
     aThebesContext->SetColor(Color::FromABGR(aBackgroundColor));
--- a/layout/painting/DisplayItemClip.cpp
+++ b/layout/painting/DisplayItemClip.cpp
@@ -96,17 +96,17 @@ DisplayItemClip::ApplyTo(gfxContext* aCo
   ApplyRoundedRectClipsTo(aContext, A2D, 0, mRoundedClipRects.Length());
 }
 
 void
 DisplayItemClip::ApplyRectTo(gfxContext* aContext, int32_t A2D) const
 {
   aContext->NewPath();
   gfxRect clip = nsLayoutUtils::RectToGfxRect(mClipRect, A2D);
-  aContext->Rectangle(clip, true);
+  aContext->SnappedRectangle(clip);
   aContext->Clip();
 }
 
 void
 DisplayItemClip::ApplyRoundedRectClipsTo(gfxContext* aContext,
                                          int32_t A2D,
                                          uint32_t aBegin,
                                          uint32_t aEnd) const
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -2538,17 +2538,17 @@ SetupImageLayerClip(nsCSSRendering::Imag
   if (aClipState.mHasAdditionalBGClipArea) {
     gfxRect bgAreaGfx = nsLayoutUtils::RectToGfxRect(
       aClipState.mAdditionalBGClipArea, aAppUnitsPerPixel);
     bgAreaGfx.Round();
     gfxUtils::ConditionRect(bgAreaGfx);
 
     aAutoSR->EnsureSaved(aCtx);
     aCtx->NewPath();
-    aCtx->Rectangle(bgAreaGfx, true);
+    aCtx->SnappedRectangle(bgAreaGfx);
     aCtx->Clip();
   }
 
   if (aClipState.mHasRoundedCorners) {
     Rect bgAreaGfx = NSRectToRect(aClipState.mBGClipArea, aAppUnitsPerPixel);
     bgAreaGfx.Round();
 
     if (bgAreaGfx.IsEmpty()) {
@@ -2580,17 +2580,17 @@ DrawBackgroundColor(nsCSSRendering::Imag
   }
 
   DrawTarget* drawTarget = aCtx->GetDrawTarget();
 
   // We don't support custom clips and rounded corners, arguably a bug, but
   // table painting seems to depend on it.
   if (!aClipState.mHasRoundedCorners || aClipState.mCustomClip) {
     aCtx->NewPath();
-    aCtx->Rectangle(aClipState.mDirtyRectInDevPx, true);
+    aCtx->SnappedRectangle(aClipState.mDirtyRectInDevPx);
     aCtx->Fill();
     return;
   }
 
   Rect bgAreaGfx = NSRectToRect(aClipState.mBGClipArea, aAppUnitsPerPixel);
   bgAreaGfx.Round();
 
   if (bgAreaGfx.IsEmpty()) {
@@ -2601,26 +2601,26 @@ DrawBackgroundColor(nsCSSRendering::Imag
     aClipState.mDirtyRectInDevPx.SizeTo(gfxSize(0.0, 0.0));
     return;
   }
 
   aCtx->Save();
   gfxRect dirty = ThebesRect(bgAreaGfx).Intersect(aClipState.mDirtyRectInDevPx);
 
   aCtx->NewPath();
-  aCtx->Rectangle(dirty, true);
+  aCtx->SnappedRectangle(dirty);
   aCtx->Clip();
 
   if (aClipState.mHasAdditionalBGClipArea) {
     gfxRect bgAdditionalAreaGfx = nsLayoutUtils::RectToGfxRect(
       aClipState.mAdditionalBGClipArea, aAppUnitsPerPixel);
     bgAdditionalAreaGfx.Round();
     gfxUtils::ConditionRect(bgAdditionalAreaGfx);
     aCtx->NewPath();
-    aCtx->Rectangle(bgAdditionalAreaGfx, true);
+    aCtx->SnappedRectangle(bgAdditionalAreaGfx);
     aCtx->Clip();
   }
 
   RefPtr<Path> roundedRect =
     MakePathForRoundedRect(*drawTarget, bgAreaGfx, aClipState.mClippedRadii);
   aCtx->SetPath(roundedRect);
   aCtx->Fill();
   aCtx->Restore();
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -5115,25 +5115,25 @@ nsDisplayBackgroundColor::Paint(nsDispla
     mBackgroundStyle->StyleBackground()->mImage.mLayers[0].mClip;
   if (clip == StyleGeometryBox::Text) {
     if (!GenerateAndPushTextMask(mFrame, aCtx, mBackgroundRect, aBuilder)) {
       return;
     }
 
     ctx->SetColor(mColor);
     ctx->NewPath();
-    ctx->Rectangle(bounds, true);
+    ctx->SnappedRectangle(bounds);
     ctx->Fill();
     ctx->PopGroupAndBlend();
     return;
   }
 
   ctx->SetColor(mColor);
   ctx->NewPath();
-  ctx->Rectangle(bounds, true);
+  ctx->SnappedRectangle(bounds);
   ctx->Fill();
 #endif
 }
 
 nsRegion
 nsDisplayBackgroundColor::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                           bool* aSnap) const
 {
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -1048,17 +1048,17 @@ void PaintMaskAndClipPathInternal(const 
 
   if (gfxPrefs::DrawMaskLayer()) {
     gfxContextAutoSaveRestore saver(&context);
 
     context.NewPath();
     gfxRect drawingRect =
       nsLayoutUtils::RectToGfxRect(aParams.borderArea,
                                    frame->PresContext()->AppUnitsPerDevPixel());
-    context.Rectangle(drawingRect, true);
+    context.SnappedRectangle(drawingRect);
     Color overlayColor(0.0f, 0.0f, 0.0f, 0.8f);
     if (maskUsage.shouldGenerateMaskLayer) {
       overlayColor.r = 1.0f; // red represents css positioned mask.
     }
     if (maskUsage.shouldApplyClipPath ||
         maskUsage.shouldGenerateClipMaskLayer) {
       overlayColor.g = 1.0f; // green represents clip-path:<clip-source>.
     }