Bug 1229662 (part 3) - Remove AzureState::fillRule. r=jrmuizel.
authorNicholas Nethercote <nnethercote@mozilla.com>
Sun, 06 Dec 2015 18:18:00 -0800
changeset 275848 66b2ca5d7bc281a29b310d8727450e15027ba597
parent 275847 91a6059833f5c7d4f2eb08785417a31a62e26096
child 275849 9bcd5408bd6030a22d9e51585b9d18b4671dbdf1
push id29768
push usercbook@mozilla.com
push dateMon, 07 Dec 2015 13:16:29 +0000
treeherdermozilla-central@59bc3c7a83de [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1229662
milestone45.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 1229662 (part 3) - Remove AzureState::fillRule. r=jrmuizel. AzureState::fillRule is never set to any value other than FILL_WINDING. It can be removed. Note that TransformedCopyToBuilder() and CopyToBuilder()'s FillRule arguments both default to FILL_WINDING.
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxContext.h
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -527,28 +527,16 @@ gfxContext::SetMiterLimit(gfxFloat limit
 }
 
 gfxFloat
 gfxContext::CurrentMiterLimit() const
 {
   return CurrentState().strokeOptions.mMiterLimit;
 }
 
-void
-gfxContext::SetFillRule(FillRule rule)
-{
-  CurrentState().fillRule = rule;
-}
-
-FillRule
-gfxContext::CurrentFillRule() const
-{
-  return CurrentState().fillRule;
-}
-
 // clipping
 void
 gfxContext::Clip(const Rect& rect)
 {
   AzureState::PushedClip clip = { nullptr, rect, mTransform };
   CurrentState().pushedClips.AppendElement(clip);
   mDT->PushClipRect(rect);
   NewPath();
@@ -1010,28 +998,28 @@ gfxContext::EnsurePath()
     mPathBuilder = nullptr;
   }
 
   if (mPath) {
     if (mTransformChanged) {
       Matrix mat = mTransform;
       mat.Invert();
       mat = mPathTransform * mat;
-      mPathBuilder = mPath->TransformedCopyToBuilder(mat, CurrentState().fillRule);
+      mPathBuilder = mPath->TransformedCopyToBuilder(mat);
       mPath = mPathBuilder->Finish();
       mPathBuilder = nullptr;
 
       mTransformChanged = false;
     }
 
-    if (CurrentState().fillRule == mPath->GetFillRule()) {
+    if (FillRule::FILL_WINDING == mPath->GetFillRule()) {
       return;
     }
 
-    mPathBuilder = mPath->CopyToBuilder(CurrentState().fillRule);
+    mPathBuilder = mPath->CopyToBuilder();
 
     mPath = mPathBuilder->Finish();
     mPathBuilder = nullptr;
     return;
   }
 
   EnsurePathBuilder();
   mPath = mPathBuilder->Finish();
@@ -1042,31 +1030,31 @@ void
 gfxContext::EnsurePathBuilder()
 {
   if (mPathBuilder && !mTransformChanged) {
     return;
   }
 
   if (mPath) {
     if (!mTransformChanged) {
-      mPathBuilder = mPath->CopyToBuilder(CurrentState().fillRule);
+      mPathBuilder = mPath->CopyToBuilder();
       mPath = nullptr;
     } else {
       Matrix invTransform = mTransform;
       invTransform.Invert();
       Matrix toNewUS = mPathTransform * invTransform;
-      mPathBuilder = mPath->TransformedCopyToBuilder(toNewUS, CurrentState().fillRule);
+      mPathBuilder = mPath->TransformedCopyToBuilder(toNewUS);
     }
     return;
   }
 
   DebugOnly<PathBuilder*> oldPath = mPathBuilder.get();
 
   if (!mPathBuilder) {
-    mPathBuilder = mDT->CreatePathBuilder(CurrentState().fillRule);
+    mPathBuilder = mDT->CreatePathBuilder(FillRule::FILL_WINDING);
 
     if (mPathIsRect) {
       mPathBuilder->MoveTo(mRect.TopLeft());
       mPathBuilder->LineTo(mRect.TopRight());
       mPathBuilder->LineTo(mRect.BottomRight());
       mPathBuilder->LineTo(mRect.BottomLeft());
       mPathBuilder->Close();
     }
@@ -1079,17 +1067,17 @@ gfxContext::EnsurePathBuilder()
     MOZ_ASSERT(oldPath);
     MOZ_ASSERT(!mPathIsRect);
 
     Matrix invTransform = mTransform;
     invTransform.Invert();
     Matrix toNewUS = mPathTransform * invTransform;
 
     RefPtr<Path> path = mPathBuilder->Finish();
-    mPathBuilder = path->TransformedCopyToBuilder(toNewUS, CurrentState().fillRule);
+    mPathBuilder = path->TransformedCopyToBuilder(toNewUS);
   }
 
   mPathIsRect = false;
 }
 
 void
 gfxContext::FillAzure(const Pattern& aPattern, Float aOpacity)
 {
@@ -1188,18 +1176,18 @@ gfxContext::ChangeTransform(const Matrix
     invMatrix.Invert();
 
     Matrix toNewUS = mTransform * invMatrix;
 
     if (toNewUS.IsRectilinear()) {
       mRect = toNewUS.TransformBounds(mRect);
       mRect.NudgeToIntegers();
     } else {
-      mPathBuilder = mDT->CreatePathBuilder(CurrentState().fillRule);
-      
+      mPathBuilder = mDT->CreatePathBuilder(FillRule::FILL_WINDING);
+
       mPathBuilder->MoveTo(toNewUS * mRect.TopLeft());
       mPathBuilder->LineTo(toNewUS * mRect.TopRight());
       mPathBuilder->LineTo(toNewUS * mRect.BottomRight());
       mPathBuilder->LineTo(toNewUS * mRect.BottomLeft());
       mPathBuilder->Close();
 
       mPathIsRect = false;
     }
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -362,23 +362,16 @@ public:
      */
     void SetLineJoin(JoinStyle join);
     JoinStyle CurrentLineJoin() const;
 
     void SetMiterLimit(gfxFloat limit);
     gfxFloat CurrentMiterLimit() const;
 
     /**
-     ** Fill Properties
-     **/
-
-    void SetFillRule(FillRule rule);
-    FillRule CurrentFillRule() const;
-
-    /**
      * Sets the operator used for all further drawing. The operator affects
      * how drawing something will modify the destination. For example, the
      * OVER operator will do alpha blending of source and destination, while
      * SOURCE will replace the destination with the source.
      */
     void SetOp(CompositionOp op);
     CompositionOp CurrentOp() const;
 
@@ -491,17 +484,16 @@ private:
   typedef mozilla::gfx::Float Float;
   typedef mozilla::gfx::PathBuilder PathBuilder;
   typedef mozilla::gfx::SourceSurface SourceSurface;
   
   struct AzureState {
     AzureState()
       : op(mozilla::gfx::CompositionOp::OP_OVER)
       , color(0, 0, 0, 1.0f)
-      , fillRule(mozilla::gfx::FillRule::FILL_WINDING)
       , aaMode(mozilla::gfx::AntialiasMode::SUBPIXEL)
       , patternTransformChanged(false)
     {}
 
     mozilla::gfx::CompositionOp op;
     Color color;
     RefPtr<gfxPattern> pattern;
     RefPtr<gfxASurface> sourceSurfCairo;
@@ -511,17 +503,16 @@ private:
     Matrix transform;
     struct PushedClip {
       RefPtr<Path> path;
       Rect rect;
       Matrix transform;
     };
     nsTArray<PushedClip> pushedClips;
     nsTArray<Float> dashPattern;
-    mozilla::gfx::FillRule fillRule;
     StrokeOptions strokeOptions;
     RefPtr<DrawTarget> drawTarget;
     mozilla::gfx::AntialiasMode aaMode;
     bool patternTransformChanged;
     Matrix patternTransform;
     Color fontSmoothingBackgroundColor;
     // This is used solely for using minimal intermediate surface size.
     mozilla::gfx::Point deviceOffset;