Bug 885016. Avoid using uninitiated extend in gfxPattern. r=bas
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Wed, 19 Jun 2013 17:06:42 -0400
changeset 136076 f85cd92c190612967f1e0681fbb66bc670e359a5
parent 136075 ec6f95743c5d777906bc4743d671500956eeacd2
child 136077 872cb1c92a731fc6cf5f56caf07250140ebbc415
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbas
bugs885016
milestone24.0a1
Bug 885016. Avoid using uninitiated extend in gfxPattern. r=bas This changes gfxPattern to use GraphicsExtend. All of the inputs and outputs are GraphicsExtend so there's no point storing it in a type of ExtendMode. We also intialize gfxPattern to EXTEND_NONE when constructing it for Azure.
gfx/thebes/gfxPattern.cpp
gfx/thebes/gfxPattern.h
--- a/gfx/thebes/gfxPattern.cpp
+++ b/gfx/thebes/gfxPattern.cpp
@@ -50,16 +50,17 @@ gfxPattern::gfxPattern(gfxFloat cx0, gfx
 }
 
 // Azure
 gfxPattern::gfxPattern(SourceSurface *aSurface, const Matrix &aTransform)
   : mPattern(NULL)
   , mGfxPattern(NULL)
   , mSourceSurface(aSurface)
   , mTransform(aTransform)
+  , mExtend(EXTEND_NONE)
 {
 }
 
 gfxPattern::~gfxPattern()
 {
     cairo_pattern_destroy(mPattern);
 
     if (mGfxPattern) {
@@ -318,17 +319,17 @@ gfxPattern::SetExtend(GraphicsExtend ext
         if (extend == EXTEND_PAD_EDGE)
             extend = EXTEND_PAD;
     }
 
     cairo_pattern_set_extend(mPattern, (cairo_extend_t)extend);
   } else {
     // This is always a surface pattern and will default to EXTEND_PAD
     // for EXTEND_PAD_EDGE.
-    mExtend = ToExtendMode(extend);
+    mExtend = extend;
   }
 }
 
 bool
 gfxPattern::IsOpaque()
 {
   if (mPattern) {
     switch (cairo_pattern_get_type(mPattern)) {
@@ -353,17 +354,17 @@ gfxPattern::IsOpaque()
 }
 
 gfxPattern::GraphicsExtend
 gfxPattern::Extend() const
 {
   if (mPattern) {
     return (GraphicsExtend)cairo_pattern_get_extend(mPattern);
   } else {
-    return ThebesExtend(mExtend);
+    return mExtend;
   }
 }
 
 void
 gfxPattern::SetFilter(GraphicsFilter filter)
 {
   if (mPattern) {
     cairo_pattern_set_filter(mPattern, (cairo_filter_t)filter);
--- a/gfx/thebes/gfxPattern.h
+++ b/gfx/thebes/gfxPattern.h
@@ -131,13 +131,13 @@ protected:
       mozilla::AlignedStorage2<mozilla::gfx::SurfacePattern> mSurfacePattern;
     };
 
     mozilla::gfx::Pattern *mGfxPattern;
 
     mozilla::RefPtr<mozilla::gfx::SourceSurface> mSourceSurface;
     mozilla::gfx::Matrix mTransform;
     mozilla::RefPtr<mozilla::gfx::GradientStops> mStops;
-    mozilla::gfx::ExtendMode mExtend;
+    GraphicsExtend mExtend;
     mozilla::gfx::Filter mFilter;
 };
 
 #endif /* GFX_PATTERN_H */