Bug 1073363, part 1 - Rename gfxContext's GeneralPattern to PatternFromState. r=Bas
authorJonathan Watt <jwatt@jwatt.org>
Mon, 29 Sep 2014 14:12:05 +0100
changeset 207681 51d7456575e8f22c055cd4650adc61859cddf192
parent 207680 3c98330df76f138b27dad5d0621d1993345b6766
child 207682 f3e489423a767c984537c9b7ecf8099e438cb7f1
push id27564
push userryanvm@gmail.com
push dateMon, 29 Sep 2014 18:57:04 +0000
treeherdermozilla-central@ce9a0b34225e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1073363
milestone35.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 1073363, part 1 - Rename gfxContext's GeneralPattern to PatternFromState. r=Bas
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxContext.h
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -34,21 +34,21 @@
 using namespace mozilla;
 using namespace mozilla::gfx;
 
 UserDataKey gfxContext::sDontUseAsSourceKey;
 
 /* This class lives on the stack and allows gfxContext users to easily, and
  * performantly get a gfx::Pattern to use for drawing in their current context.
  */
-class GeneralPattern
+class PatternFromState
 {
 public:    
-  explicit GeneralPattern(gfxContext *aContext) : mContext(aContext), mPattern(nullptr) {}
-  ~GeneralPattern() { if (mPattern) { mPattern->~Pattern(); } }
+  explicit PatternFromState(gfxContext *aContext) : mContext(aContext), mPattern(nullptr) {}
+  ~PatternFromState() { if (mPattern) { mPattern->~Pattern(); } }
 
   operator mozilla::gfx::Pattern&()
   {
     gfxContext::AzureState &state = mContext->CurrentState();
 
     if (state.pattern) {
       return *state.pattern->GetPattern(mContext->mDT, state.patternTransformChanged ? &state.patternTransform : nullptr);
     } else if (state.sourceSurface) {
@@ -261,23 +261,23 @@ gfxContext::CurrentPoint()
 
 void
 gfxContext::Stroke()
 {
   AzureState &state = CurrentState();
   if (mPathIsRect) {
     MOZ_ASSERT(!mTransformChanged);
 
-    mDT->StrokeRect(mRect, GeneralPattern(this),
+    mDT->StrokeRect(mRect, PatternFromState(this),
                     state.strokeOptions,
                     DrawOptions(1.0f, GetOp(), state.aaMode));
   } else {
     EnsurePath();
 
-    mDT->Stroke(mPath, GeneralPattern(this), state.strokeOptions,
+    mDT->Stroke(mPath, PatternFromState(this), state.strokeOptions,
                 DrawOptions(1.0f, GetOp(), state.aaMode));
   }
 }
 
 void
 gfxContext::Fill()
 {
   PROFILER_LABEL("gfxContext", "Fill",
@@ -921,17 +921,17 @@ gfxContext::GetPattern()
 // masking
 void
 gfxContext::Mask(SourceSurface* aSurface, const Matrix& aTransform)
 {
   Matrix old = mTransform;
   Matrix mat = aTransform * mTransform;
 
   ChangeTransform(mat);
-  mDT->MaskSurface(GeneralPattern(this), aSurface, Point(),
+  mDT->MaskSurface(PatternFromState(this), aSurface, Point(),
                    DrawOptions(1.0f, CurrentState().op, CurrentState().aaMode));
   ChangeTransform(old);
 }
 
 void
 gfxContext::Mask(gfxASurface *surface, const gfxPoint& offset)
 {
   PROFILER_LABEL("gfxContext", "Mask",
@@ -949,17 +949,17 @@ gfxContext::Mask(gfxASurface *surface, c
 
   Mask(sourceSurf, Point(offset.x - pt.x, offset.y - pt.y));
 }
 
 void
 gfxContext::Mask(SourceSurface *surface, const Point& offset)
 {
   // We clip here to bind to the mask surface bounds, see above.
-  mDT->MaskSurface(GeneralPattern(this),
+  mDT->MaskSurface(PatternFromState(this),
             surface,
             offset,
             DrawOptions(1.0f, CurrentState().op, CurrentState().aaMode));
 }
 
 void
 gfxContext::Paint(gfxFloat alpha)
 {
@@ -990,17 +990,17 @@ gfxContext::Paint(gfxFloat alpha)
 
   Matrix mat = mDT->GetTransform();
   mat.Invert();
   Rect paintRect = mat.TransformBounds(Rect(Point(0, 0), Size(mDT->GetSize())));
 
   if (state.opIsClear) {
     mDT->ClearRect(paintRect);
   } else {
-    mDT->FillRect(paintRect, GeneralPattern(this),
+    mDT->FillRect(paintRect, PatternFromState(this),
                   DrawOptions(Float(alpha), GetOp()));
   }
 }
 
 // groups
 
 void
 gfxContext::PushGroup(gfxContentType content)
@@ -1394,26 +1394,26 @@ gfxContext::FillAzure(Float aOpacity)
   if (mPathIsRect) {
     MOZ_ASSERT(!mTransformChanged);
 
     if (state.opIsClear) {
       mDT->ClearRect(mRect);
     } else if (op == CompositionOp::OP_SOURCE) {
       // Emulate cairo operator source which is bound by mask!
       mDT->ClearRect(mRect);
-      mDT->FillRect(mRect, GeneralPattern(this), DrawOptions(aOpacity));
+      mDT->FillRect(mRect, PatternFromState(this), DrawOptions(aOpacity));
     } else {
-      mDT->FillRect(mRect, GeneralPattern(this), DrawOptions(aOpacity, op, state.aaMode));
+      mDT->FillRect(mRect, PatternFromState(this), DrawOptions(aOpacity, op, state.aaMode));
     }
   } else {
     EnsurePath();
 
     NS_ASSERTION(!state.opIsClear, "We shouldn't be clearing complex paths!");
 
-    mDT->Fill(mPath, GeneralPattern(this), DrawOptions(aOpacity, op, state.aaMode));
+    mDT->Fill(mPath, PatternFromState(this), DrawOptions(aOpacity, op, state.aaMode));
   }
 }
 
 void
 gfxContext::PushClipsToDT(DrawTarget *aDT)
 {
   // Tricky, we have to restore all clips -since the last time- the clip
   // was reset. If we didn't reset the clip, just popping the clips we
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -666,17 +666,17 @@ public:
     void CopyAsDataURI();
 #endif
 
     static mozilla::gfx::UserDataKey sDontUseAsSourceKey;
 
 private:
     ~gfxContext();
 
-  friend class GeneralPattern;
+  friend class PatternFromState;
   friend class GlyphBufferAzure;
 
   typedef mozilla::gfx::Matrix Matrix;
   typedef mozilla::gfx::DrawTarget DrawTarget;
   typedef mozilla::gfx::Color Color;
   typedef mozilla::gfx::StrokeOptions StrokeOptions;
   typedef mozilla::gfx::Float Float;
   typedef mozilla::gfx::Rect Rect;