Bug 1304011 - Part 2. typedef nsSVGIntegrationUtils::PaintFramesParams to shorten code length. r=mstange
authorcku <cku@mozilla.com>
Thu, 22 Sep 2016 11:12:54 +0800
changeset 417633 a0eb7d02a8957504a5c2ff55e56007ca01400de2
parent 417632 0de5ca60147c1657cafd088e1b8b094736eb5d41
child 417634 bca355313274af6ad2499b660ceaedf810a88226
push id30444
push userbmo:pbrosset@mozilla.com
push dateMon, 26 Sep 2016 14:07:09 +0000
reviewersmstange
bugs1304011
milestone52.0a1
Bug 1304011 - Part 2. typedef nsSVGIntegrationUtils::PaintFramesParams to shorten code length. r=mstange MozReview-Commit-ID: Iw7Khv8ee0r
layout/svg/nsSVGIntegrationUtils.cpp
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -429,18 +429,20 @@ ComputeClipExtsInDeviceSpace(gfxContext&
   clippedFrameSurfaceRect.RoundOut();
 
   IntRect result;
   ToRect(clippedFrameSurfaceRect).ToIntRect(&result);
   return mozilla::gfx::Factory::CheckSurfaceSize(result.Size()) ? result
                                                                 : IntRect();
 }
 
+typedef nsSVGIntegrationUtils::PaintFramesParams PaintFramesParams;
+
 static IntRect
-ComputeMaskGeometry(const nsSVGIntegrationUtils::PaintFramesParams& aParams,
+ComputeMaskGeometry(const PaintFramesParams& aParams,
                     const nsStyleSVGReset *svgReset,
                     const nsPoint& aOffsetToUserSpace,
                     const nsTArray<nsSVGMaskFrame *>& aMaskFrames)
 {
   gfxContext& ctx = aParams.ctx;
   nsIFrame* frame = aParams.frame;
 
   // Convert boaderArea and dirtyRect to user space.
@@ -489,17 +491,17 @@ ComputeMaskGeometry(const nsSVGIntegrati
 
   IntRect result = ComputeClipExtsInDeviceSpace(ctx);
   ctx.Restore();
 
   return result;
 }
 
 static DrawResult
-GenerateMaskSurface(const nsSVGIntegrationUtils::PaintFramesParams& aParams,
+GenerateMaskSurface(const PaintFramesParams& aParams,
                     float aOpacity, nsStyleContext* aSC,
                     const nsTArray<nsSVGMaskFrame *>& aMaskFrames,
                     const nsPoint& aOffsetToUserSpace,
                     Matrix& aOutMaskTransform,
                     RefPtr<SourceSurface>& aOutMaskSurface)
 {
   const nsStyleSVGReset *svgReset = aSC->StyleSVGReset();
   MOZ_ASSERT(aMaskFrames.Length() > 0);
@@ -607,32 +609,32 @@ GenerateMaskSurface(const nsSVGIntegrati
     return DrawResult::SUCCESS;
   }
 
   aOutMaskSurface = maskDT->Snapshot();
   return DrawResult::SUCCESS;
 }
 
 static float
-ComputeOpacity(const nsSVGIntegrationUtils::PaintFramesParams& aParams)
+ComputeOpacity(const PaintFramesParams& aParams)
 {
   nsIFrame* frame = aParams.frame;
   float opacity = frame->StyleEffects()->mOpacity;
 
   if (opacity != 1.0f &&
       (nsSVGUtils::CanOptimizeOpacity(frame) || !aParams.handleOpacity)) {
     return 1.0f;
   }
 
   return opacity;
 }
 
 static bool
-ValidateSVGFrame(const nsSVGIntegrationUtils::PaintFramesParams& aParams,
-                 bool aHasSVGLayout, DrawResult* aResult)
+ValidateSVGFrame(const PaintFramesParams& aParams, bool aHasSVGLayout,
+                 DrawResult* aResult)
 {
 #ifdef DEBUG
   NS_ASSERTION(!(aParams.frame->GetStateBits() & NS_FRAME_SVG_LAYOUT) ||
                (NS_SVGDisplayListPaintingEnabled() &&
                 !(aParams.frame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)),
                "Should not use nsSVGIntegrationUtils on this SVG frame");
 #endif
 
@@ -651,17 +653,17 @@ ValidateSVGFrame(const nsSVGIntegrationU
       return false;
     }
   }
 
   return true;
 }
 
 static void
-SetupContextMatrix(const nsSVGIntegrationUtils::PaintFramesParams& aParams,
+SetupContextMatrix(const PaintFramesParams& aParams,
                    nsPoint& aOffsetToBoundingBox,
                    nsPoint& aToUserSpace,
                    nsPoint& aOffsetToUserSpace)
 {
   nsIFrame* frame = aParams.frame;
   nsIFrame* firstFrame =
     nsLayoutUtils::FirstContinuationOrIBSplitSibling(frame);
 
@@ -701,18 +703,17 @@ SetupContextMatrix(const nsSVGIntegratio
 
   gfxPoint devPixelOffsetToUserSpace =
     nsLayoutUtils::PointToGfxPoint(aOffsetToUserSpace,
                                    frame->PresContext()->AppUnitsPerDevPixel());
   aParams.ctx.SetMatrix(aParams.ctx.CurrentMatrix().Translate(devPixelOffsetToUserSpace));
 }
 
 static already_AddRefed<gfxContext>
-CreateBlendTarget(const nsSVGIntegrationUtils::PaintFramesParams& aParams,
-                  IntPoint& aTargetOffset)
+CreateBlendTarget(const PaintFramesParams& aParams, IntPoint& aTargetOffset)
 {
   MOZ_ASSERT(aParams.frame->StyleEffects()->mMixBlendMode !=
              NS_STYLE_BLEND_NORMAL);
 
   // Create a temporary context to draw to so we can blend it back with
   // another operator.
   IntRect drawRect = ComputeClipExtsInDeviceSpace(aParams.ctx);
 
@@ -726,18 +727,18 @@ CreateBlendTarget(const nsSVGIntegration
   target->SetMatrix(aParams.ctx.CurrentMatrix() *
                     gfxMatrix::Translation(-drawRect.TopLeft()));
   aTargetOffset = drawRect.TopLeft();
 
   return target.forget();
 }
 
 static void
-BlendToTarget(const nsSVGIntegrationUtils::PaintFramesParams& aParams,
-              gfxContext* aTarget, const IntPoint& aTargetOffset)
+BlendToTarget(const PaintFramesParams& aParams, gfxContext* aTarget,
+              const IntPoint& aTargetOffset)
 {
   MOZ_ASSERT(aParams.frame->StyleEffects()->mMixBlendMode !=
              NS_STYLE_BLEND_NORMAL);
 
   RefPtr<DrawTarget> targetDT = aTarget->GetDrawTarget();
   RefPtr<SourceSurface> targetSurf = targetDT->Snapshot();
 
   gfxContext& context = aParams.ctx;