fix line dashing and patterns in svg

remove unused methods in PlatformGraphicsContext.h
make PlatformGraphicsContext constructors more similar
set local matrix in pattern
set dash path effect in graphics context
diff --git a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp
index 8800699..bd5baa0 100644
--- a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp
+++ b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp
@@ -84,6 +84,7 @@
 
     struct State {
         SkPath*             mPath;
+        SkPathEffect* mPathEffect;
         float               mMiterLimit;
         float               mAlpha;
         float               mStrokeThickness;
@@ -98,6 +99,7 @@
         
         State() {
             mPath            = NULL;    // lazily allocated
+            mPathEffect = 0;
             mMiterLimit      = 4;
             mAlpha           = 1;
             mStrokeThickness = 0.0f;  // Same as default in GraphicsContextPrivate.h
@@ -114,10 +116,12 @@
         State(const State& other) {
             memcpy(this, &other, sizeof(State));
             mPath = deepCopyPtr<SkPath>(other.mPath);
+            mPathEffect->safeRef();
         }
         
         ~State() {
             delete mPath;
+            mPathEffect->safeUnref();
         }
         
         void setShadow(int radius, int dx, int dy, SkColor c) {
@@ -269,6 +273,11 @@
             rect->inset(-SK_ScalarHalf, -SK_ScalarHalf);
         }
 
+        SkPathEffect* pe = mState->mPathEffect;
+        if (pe) {
+            paint->setPathEffect(pe);
+            return false;
+        }
         switch (mCG->strokeStyle()) {
             case NoStroke:
             case SolidStroke:
@@ -284,7 +293,7 @@
 
         if (width > 0) {
             SkScalar intervals[] = { width, width };
-            SkPathEffect* pe = new SkDashPathEffect(intervals, 2, 0);
+            pe = new SkDashPathEffect(intervals, 2, 0);
             paint->setPathEffect(pe)->unref();
             // return true if we're basically a dotted dash of squares
             return RoundToInt(width) == RoundToInt(paint->getStrokeWidth());
@@ -963,8 +972,6 @@
     if (paintingDisabled())
         return;
 
-    // FIXME: This is lifted directly off SkiaSupport, lines 49-74
-    // so it is not guaranteed to work correctly.
     size_t dashLength = dashes.size();
     if (!dashLength)
         return;
@@ -973,9 +980,10 @@
     SkScalar* intervals = new SkScalar[count];
 
     for (unsigned int i = 0; i < count; i++)
-        intervals[i] = dashes[i % dashLength];
-// FIXME: setDashPathEffect not defined
-//    platformContext()->setDashPathEffect(new SkDashPathEffect(intervals, count, dashOffset));
+        intervals[i] = SkFloatToScalar(dashes[i % dashLength]);
+    SkPathEffect **effectPtr = &m_data->mState->mPathEffect;
+    (*effectPtr)->safeUnref();
+    *effectPtr = new SkDashPathEffect(intervals, count, SkFloatToScalar(dashOffset));
 
     delete[] intervals;
 }
diff --git a/WebCore/platform/graphics/android/PatternAndroid.cpp b/WebCore/platform/graphics/android/PatternAndroid.cpp
index ffdbbb1..ff2b522 100644
--- a/WebCore/platform/graphics/android/PatternAndroid.cpp
+++ b/WebCore/platform/graphics/android/PatternAndroid.cpp
@@ -40,14 +40,13 @@
     return doRepeat ? SkShader::kRepeat_TileMode : SkShader::kClamp_TileMode;
 }
 
-SkShader* Pattern::createPlatformPattern(const TransformationMatrix& transform) const
+SkShader* Pattern::createPlatformPattern(const TransformationMatrix& ) const
 {
     SkBitmapRef* ref = tileImage()->nativeImageForCurrentFrame();
     SkShader* s = SkShader::CreateBitmapShader(ref->bitmap(),
                                                toTileMode(m_repeatX),
                                                toTileMode(m_repeatY));
-    
-    // TODO: do I treat transform as a local matrix???
+    s->setLocalMatrix(m_patternSpaceTransformation);
     return s;
 }
 
diff --git a/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp b/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp
index b13f45f..e0aecfa 100644
--- a/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp
+++ b/WebCore/platform/graphics/android/PlatformGraphicsContext.cpp
@@ -35,12 +35,9 @@
 {
 }
 
-PlatformGraphicsContext::PlatformGraphicsContext() : m_deleteCanvas(true)
+PlatformGraphicsContext::PlatformGraphicsContext()
+        : mCanvas(new SkCanvas), m_deleteCanvas(true), m_buttons(0)
 {
-    mCanvas = new SkCanvas;
-    // Since this is our own private SkCanvas, and has no relation to a picture
-    // storing button references would be meaningless.
-    m_buttons = NULL;
 }
 
 PlatformGraphicsContext::~PlatformGraphicsContext()
diff --git a/WebCore/platform/graphics/android/PlatformGraphicsContext.h b/WebCore/platform/graphics/android/PlatformGraphicsContext.h
index dce8ef3..546e4ef 100644
--- a/WebCore/platform/graphics/android/PlatformGraphicsContext.h
+++ b/WebCore/platform/graphics/android/PlatformGraphicsContext.h
@@ -149,9 +149,6 @@
     PlatformGraphicsContext(SkCanvas* canvas, WTF::Vector<Container>* buttons);
     ~PlatformGraphicsContext();
     
-    void setupFillPaint(GraphicsContext*, SkPaint*);
-    void setupStrokePaint(GraphicsContext*, SkPaint*);
-
     SkCanvas*                   mCanvas;
     
     bool deleteUs() const { return m_deleteCanvas; }