Bug 777614 - Update patches directory for patches applied against upstream Skia
authorGeorge Wright <gw@gwright.org.uk>
Tue, 18 Sep 2012 15:32:26 -0400
changeset 111014 dab1d80a04f4b553a7166a4ededafbd70911e757
parent 111013 21d43bc68505b2feb836fafba7ebdd3f64a1c66f
child 111015 5321d02d564b4c74026eaadd27723dfd487df316
push idunknown
push userunknown
push dateunknown
bugs777614
milestone18.0a1
Bug 777614 - Update patches directory for patches applied against upstream Skia
gfx/skia/patches/0001-Bug-687189-Implement-SkPaint-getPosTextPath.patch
gfx/skia/patches/0001-Bug-777614-Re-add-our-SkUserConfig.h-r-nrc.patch
gfx/skia/patches/0002-Bug-688366-Dont-invalidate-all-radial-gradients.patch
gfx/skia/patches/0003-SkUserConfig-for-Mozilla.patch
gfx/skia/patches/0004-Bug-722011-Fix-trailing-commas-in-enums.patch
gfx/skia/patches/0004-Bug-777614-Re-apply-bug-719872-Fix-crash-on-Android-.patch
gfx/skia/patches/0005-Bug-731384-Fix-clang-SK_OVERRIDE.patch
gfx/skia/patches/0005-Bug-777614-Re-apply-bug-687188-Expand-the-gradient-c.patch
gfx/skia/patches/0006-Bug-751814-ARM-EDSP-ARMv6-Skia-fixes.patch
gfx/skia/patches/0007-Bug-719872-Old-Android-FontHost.patch
gfx/skia/patches/0008-Bug-687188-Skia-radial-gradients.patch
gfx/skia/patches/0009-Bug-755869-FreeBSD-Hurd.patch
gfx/skia/patches/0009-Bug-777614-Re-apply-759683-Handle-compilers-that-don.patch
gfx/skia/patches/0010-Bug-689069-ARM-Opts.patch
gfx/skia/patches/0011-Bug-719575-Fix-clang-build.patch
gfx/skia/patches/0012-Bug-759683-make-ssse3-conditional.patch
gfx/skia/patches/0013-Bug-761890-fonts.patch
gfx/skia/patches/0014-Bug-765038-Fix-clang-build.patch
gfx/skia/patches/0015-Bug-766017-warnings.patch
gfx/skia/patches/0016-Bug-718849-Radial-gradients.patch
gfx/skia/patches/0017-Bug-740194-SkMemory-mozalloc.patch
gfx/skia/patches/README
gfx/skia/patches/archive/0001-Bug-687189-Implement-SkPaint-getPosTextPath.patch
gfx/skia/patches/archive/0002-Bug-688366-Dont-invalidate-all-radial-gradients.patch
gfx/skia/patches/archive/0003-SkUserConfig-for-Mozilla.patch
gfx/skia/patches/archive/0004-Bug-722011-Fix-trailing-commas-in-enums.patch
gfx/skia/patches/archive/0005-Bug-731384-Fix-clang-SK_OVERRIDE.patch
gfx/skia/patches/archive/0006-Bug-751814-ARM-EDSP-ARMv6-Skia-fixes.patch
gfx/skia/patches/archive/0007-Bug-719872-Old-Android-FontHost.patch
gfx/skia/patches/archive/0008-Bug-687188-Skia-radial-gradients.patch
gfx/skia/patches/archive/0009-Bug-755869-FreeBSD-Hurd.patch
gfx/skia/patches/archive/0010-Bug-689069-ARM-Opts.patch
gfx/skia/patches/archive/0011-Bug-719575-Fix-clang-build.patch
gfx/skia/patches/archive/0012-Bug-759683-make-ssse3-conditional.patch
gfx/skia/patches/archive/0013-Bug-761890-fonts.patch
gfx/skia/patches/archive/0014-Bug-765038-Fix-clang-build.patch
gfx/skia/patches/archive/0015-Bug-766017-warnings.patch
gfx/skia/patches/archive/0016-Bug-718849-Radial-gradients.patch
gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch
deleted file mode 100644
--- a/gfx/skia/patches/0001-Bug-687189-Implement-SkPaint-getPosTextPath.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From 27a914815e757ed12523edf968c9da134dabeaf8 Mon Sep 17 00:00:00 2001
-From: George Wright <gwright@mozilla.com>
-Date: Fri, 18 May 2012 14:10:44 -0400
-Subject: [PATCH 01/10]     Bug 755869 - [4] Re-apply bug 687189 - Implement
- SkPaint::getPosTextPath r=mattwoodrow
-
----
- gfx/skia/include/core/SkPaint.h |    3 +++
- gfx/skia/src/core/SkPaint.cpp   |   27 +++++++++++++++++++++++++++
- 2 files changed, 30 insertions(+), 0 deletions(-)
-
-diff --git a/gfx/skia/include/core/SkPaint.h b/gfx/skia/include/core/SkPaint.h
-index 1930db1..ff37d77 100644
---- a/gfx/skia/include/core/SkPaint.h
-+++ b/gfx/skia/include/core/SkPaint.h
-@@ -813,6 +813,9 @@ public:
-     void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
-                      SkPath* path) const;
- 
-+    void getPosTextPath(const void* text, size_t length, 
-+                        const SkPoint pos[], SkPath* path) const;
-+
- #ifdef SK_BUILD_FOR_ANDROID
-     const SkGlyph& getUnicharMetrics(SkUnichar);
-     const SkGlyph& getGlyphMetrics(uint16_t);
-diff --git a/gfx/skia/src/core/SkPaint.cpp b/gfx/skia/src/core/SkPaint.cpp
-index 1b74fa1..4c119aa 100644
---- a/gfx/skia/src/core/SkPaint.cpp
-+++ b/gfx/skia/src/core/SkPaint.cpp
-@@ -1355,6 +1355,33 @@ void SkPaint::getTextPath(const void* textData, size_t length,
-     }
- }
- 
-+void SkPaint::getPosTextPath(const void* textData, size_t length,
-+                             const SkPoint pos[], SkPath* path) const {
-+    SkASSERT(length == 0 || textData != NULL);
-+
-+    const char* text = (const char*)textData;
-+    if (text == NULL || length == 0 || path == NULL) {
-+        return;
-+    }
-+
-+    SkTextToPathIter    iter(text, length, *this, false);
-+    SkMatrix            matrix;
-+    SkPoint             prevPos;
-+    prevPos.set(0, 0);
-+
-+    matrix.setScale(iter.getPathScale(), iter.getPathScale());
-+    path->reset();
-+
-+    unsigned int    i = 0;
-+    const SkPath*   iterPath;
-+    while ((iterPath = iter.next(NULL)) != NULL) {
-+        matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY);
-+        path->addPath(*iterPath, matrix);
-+        prevPos = pos[i];
-+        i++;
-+    }
-+}
-+
- static void add_flattenable(SkDescriptor* desc, uint32_t tag,
-                             SkFlattenableWriteBuffer* buffer) {
-     buffer->flatten(desc->addEntry(tag, buffer->size(), NULL));
--- 
-1.7.5.4
-
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/0001-Bug-777614-Re-add-our-SkUserConfig.h-r-nrc.patch
@@ -0,0 +1,34 @@
+From 2dd8c789fc4ad3b5323c2c29f3e982d185f5b5d9 Mon Sep 17 00:00:00 2001
+From: George Wright <gw@gwright.org.uk>
+Date: Thu, 13 Sep 2012 22:33:38 -0400
+Subject: [PATCH 1/9] Bug 777614 - Re-add our SkUserConfig.h r=nrc
+
+---
+ gfx/skia/include/config/SkUserConfig.h | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/gfx/skia/include/config/SkUserConfig.h b/gfx/skia/include/config/SkUserConfig.h
+index 353272c..fbfbfe0 100644
+--- a/gfx/skia/include/config/SkUserConfig.h
++++ b/gfx/skia/include/config/SkUserConfig.h
+@@ -184,5 +184,16 @@
+    directories from your include search path when you're not building the GPU
+    backend. Defaults to 1 (build the GPU code).
+  */
+-//#define SK_SUPPORT_GPU 1
++#define SK_SUPPORT_GPU 0
++
++/*  Don't dither 32bit gradients, to match what the canvas test suite expects.
++ */
++#define SK_DISABLE_DITHER_32BIT_GRADIENT
++
++/*  Don't include stdint.h on windows as it conflicts with our build system.
++ */
++#ifdef SK_BUILD_FOR_WIN32 
++    #define SK_IGNORE_STDINT_DOT_H 
++#endif 
++
+ #endif
+-- 
+1.7.11.4
+
deleted file mode 100644
--- a/gfx/skia/patches/0002-Bug-688366-Dont-invalidate-all-radial-gradients.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From f310d7e8b8d9cf6870c739650324bb585b591c0c Mon Sep 17 00:00:00 2001
-From: George Wright <gwright@mozilla.com>
-Date: Fri, 18 May 2012 14:11:32 -0400
-Subject: [PATCH 02/10]     Bug 755869 - [5] Re-apply bug 688366 - Fix Skia
- marking radial gradients with the same radius as
- invalid. r=mattwoodrow
-
----
- gfx/skia/src/effects/SkGradientShader.cpp |    5 ++++-
- 1 files changed, 4 insertions(+), 1 deletions(-)
-
-diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp
-index 6de820b..59ba48c 100644
---- a/gfx/skia/src/effects/SkGradientShader.cpp
-+++ b/gfx/skia/src/effects/SkGradientShader.cpp
-@@ -1911,7 +1911,10 @@ public:
-         SkPMColor* SK_RESTRICT dstC = dstCParam;
- 
-         // Zero difference between radii:  fill with transparent black.
--        if (fDiffRadius == 0) {
-+        // TODO: Is removing this actually correct? Two circles with the 
-+        // same radius, but different centers doesn't sound like it
-+        // should be cleared
-+        if (fDiffRadius == 0 && fCenter1 == fCenter2) {
-           sk_bzero(dstC, count * sizeof(*dstC));
-           return;
-         }
--- 
-1.7.5.4
-
deleted file mode 100644
--- a/gfx/skia/patches/0003-SkUserConfig-for-Mozilla.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From ef53776c06cffc7607c3777702f93e04c0852981 Mon Sep 17 00:00:00 2001
-From: George Wright <gwright@mozilla.com>
-Date: Fri, 18 May 2012 14:13:49 -0400
-Subject: [PATCH 03/10]     Bug 755869 - [6] Re-apply SkUserConfig (no
- original bug) r=mattwoodrow
-
----
- gfx/skia/include/config/SkUserConfig.h |   10 ++++++++++
- 1 files changed, 10 insertions(+), 0 deletions(-)
-
-diff --git a/gfx/skia/include/config/SkUserConfig.h b/gfx/skia/include/config/SkUserConfig.h
-index 9fdbd0a..f98ba85 100644
---- a/gfx/skia/include/config/SkUserConfig.h
-+++ b/gfx/skia/include/config/SkUserConfig.h
-@@ -156,6 +156,10 @@
- //#define SK_SUPPORT_UNITTEST
- #endif
- 
-+/*  Don't dither 32bit gradients, to match what the canvas test suite expects.
-+ */
-+#define SK_DISABLE_DITHER_32BIT_GRADIENT
-+
- /* If your system embeds skia and has complex event logging, define this
-    symbol to name a file that maps the following macros to your system's
-    equivalents:
-@@ -177,4 +181,10 @@
-         #define SK_A32_SHIFT    24
- #endif
- 
-+/*  Don't include stdint.h on windows as it conflicts with our build system.
-+ */
-+#ifdef SK_BUILD_FOR_WIN32 
-+    #define SK_IGNORE_STDINT_DOT_H 
-+#endif 
-+
- #endif
--- 
-1.7.5.4
-
deleted file mode 100644
--- a/gfx/skia/patches/0004-Bug-722011-Fix-trailing-commas-in-enums.patch
+++ /dev/null
@@ -1,280 +0,0 @@
-From 81d61682a94d47be5b47fb7882ea7e7c7e6c3351 Mon Sep 17 00:00:00 2001
-From: George Wright <gwright@mozilla.com>
-Date: Fri, 18 May 2012 14:15:28 -0400
-Subject: [PATCH 04/10]     Bug 755869 - [7] Re-apply bug 722011 - Fix
- trailing commas at end of enum lists r=mattwoodrow
-
----
- gfx/skia/include/core/SkAdvancedTypefaceMetrics.h |    8 ++++----
- gfx/skia/include/core/SkBlitRow.h                 |    2 +-
- gfx/skia/include/core/SkCanvas.h                  |    2 +-
- gfx/skia/include/core/SkDevice.h                  |    2 +-
- gfx/skia/include/core/SkDeviceProfile.h           |    4 ++--
- gfx/skia/include/core/SkFlattenable.h             |    2 +-
- gfx/skia/include/core/SkFontHost.h                |    4 ++--
- gfx/skia/include/core/SkMaskFilter.h              |    2 +-
- gfx/skia/include/core/SkPaint.h                   |    4 ++--
- gfx/skia/include/core/SkScalerContext.h           |    9 +++++----
- gfx/skia/include/core/SkTypes.h                   |    2 +-
- gfx/skia/include/effects/SkLayerDrawLooper.h      |    2 +-
- gfx/skia/src/core/SkBitmap.cpp                    |    2 +-
- gfx/skia/src/core/SkGlyphCache.cpp                |    2 +-
- 14 files changed, 24 insertions(+), 23 deletions(-)
-
-diff --git a/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h b/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h
-index 09fc9a9..5ffdb45 100644
---- a/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h
-+++ b/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h
-@@ -34,7 +34,7 @@ public:
-         kCFF_Font,
-         kTrueType_Font,
-         kOther_Font,
--        kNotEmbeddable_Font,
-+        kNotEmbeddable_Font
-     };
-     // The type of the underlying font program.  This field determines which
-     // of the following fields are valid.  If it is kOther_Font or
-@@ -56,7 +56,7 @@ public:
-         kItalic_Style      = 0x00040,
-         kAllCaps_Style     = 0x10000,
-         kSmallCaps_Style   = 0x20000,
--        kForceBold_Style   = 0x40000,
-+        kForceBold_Style   = 0x40000
-     };
-     uint16_t fStyle;        // Font style characteristics.
-     int16_t fItalicAngle;   // Counterclockwise degrees from vertical of the
-@@ -75,7 +75,7 @@ public:
-       kHAdvance_PerGlyphInfo   = 0x1, // Populate horizontal advance data.
-       kVAdvance_PerGlyphInfo   = 0x2, // Populate vertical advance data.
-       kGlyphNames_PerGlyphInfo = 0x4, // Populate glyph names (Type 1 only).
--      kToUnicode_PerGlyphInfo  = 0x8, // Populate ToUnicode table, ignored
-+      kToUnicode_PerGlyphInfo  = 0x8  // Populate ToUnicode table, ignored
-                                       // for Type 1 fonts
-     };
- 
-@@ -84,7 +84,7 @@ public:
-         enum MetricType {
-             kDefault,  // Default advance: fAdvance.count = 1
-             kRange,    // Advances for a range: fAdvance.count = fEndID-fStartID
--            kRun,      // fStartID-fEndID have same advance: fAdvance.count = 1
-+            kRun       // fStartID-fEndID have same advance: fAdvance.count = 1
-         };
-         MetricType fType;
-         uint16_t fStartId;
-diff --git a/gfx/skia/include/core/SkBlitRow.h b/gfx/skia/include/core/SkBlitRow.h
-index 973ab4c..febc405 100644
---- a/gfx/skia/include/core/SkBlitRow.h
-+++ b/gfx/skia/include/core/SkBlitRow.h
-@@ -42,7 +42,7 @@ public:
- 
-     enum Flags32 {
-         kGlobalAlpha_Flag32     = 1 << 0,
--        kSrcPixelAlpha_Flag32   = 1 << 1,
-+        kSrcPixelAlpha_Flag32   = 1 << 1
-     };
- 
-     /** Function pointer that blends 32bit colors onto a 32bit destination.
-diff --git a/gfx/skia/include/core/SkCanvas.h b/gfx/skia/include/core/SkCanvas.h
-index 25cc94a..d942783 100644
---- a/gfx/skia/include/core/SkCanvas.h
-+++ b/gfx/skia/include/core/SkCanvas.h
-@@ -148,7 +148,7 @@ public:
-          * low byte to high byte: R, G, B, A.
-          */
-         kRGBA_Premul_Config8888,
--        kRGBA_Unpremul_Config8888,
-+        kRGBA_Unpremul_Config8888
-     };
- 
-     /**
-diff --git a/gfx/skia/include/core/SkDevice.h b/gfx/skia/include/core/SkDevice.h
-index 1e4e0a3..b4d44bf 100644
---- a/gfx/skia/include/core/SkDevice.h
-+++ b/gfx/skia/include/core/SkDevice.h
-@@ -139,7 +139,7 @@ public:
- protected:
-     enum Usage {
-        kGeneral_Usage,
--       kSaveLayer_Usage, // <! internal use only
-+       kSaveLayer_Usage  // <! internal use only
-     };
- 
-     struct TextFlags {
-diff --git a/gfx/skia/include/core/SkDeviceProfile.h b/gfx/skia/include/core/SkDeviceProfile.h
-index 46b9781..f6a0bca 100644
---- a/gfx/skia/include/core/SkDeviceProfile.h
-+++ b/gfx/skia/include/core/SkDeviceProfile.h
-@@ -17,7 +17,7 @@ public:
-         kRGB_Horizontal_LCDConfig,
-         kBGR_Horizontal_LCDConfig,
-         kRGB_Vertical_LCDConfig,
--        kBGR_Vertical_LCDConfig,
-+        kBGR_Vertical_LCDConfig
-     };
- 
-     enum FontHintLevel {
-@@ -25,7 +25,7 @@ public:
-         kSlight_FontHintLevel,
-         kNormal_FontHintLevel,
-         kFull_FontHintLevel,
--        kAuto_FontHintLevel,
-+        kAuto_FontHintLevel
-     };
- 
-     /**
-diff --git a/gfx/skia/include/core/SkFlattenable.h b/gfx/skia/include/core/SkFlattenable.h
-index 5714f9d..dc115fc 100644
---- a/gfx/skia/include/core/SkFlattenable.h
-+++ b/gfx/skia/include/core/SkFlattenable.h
-@@ -272,7 +272,7 @@ public:
-          *  Instructs the writer to inline Factory names as there are seen the
-          *  first time (after that we store an index). The pipe code uses this.
-          */
--        kInlineFactoryNames_Flag = 0x02,
-+        kInlineFactoryNames_Flag = 0x02
-     };
-     Flags getFlags() const { return (Flags)fFlags; }
-     void setFlags(Flags flags) { fFlags = flags; }
-diff --git a/gfx/skia/include/core/SkFontHost.h b/gfx/skia/include/core/SkFontHost.h
-index 732de5c..10f9bdf 100644
---- a/gfx/skia/include/core/SkFontHost.h
-+++ b/gfx/skia/include/core/SkFontHost.h
-@@ -240,7 +240,7 @@ public:
-     */
-     enum LCDOrientation {
-         kHorizontal_LCDOrientation = 0,    //!< this is the default
--        kVertical_LCDOrientation   = 1,
-+        kVertical_LCDOrientation   = 1
-     };
- 
-     static void SetSubpixelOrientation(LCDOrientation orientation);
-@@ -259,7 +259,7 @@ public:
-     enum LCDOrder {
-         kRGB_LCDOrder = 0,    //!< this is the default
-         kBGR_LCDOrder = 1,
--        kNONE_LCDOrder = 2,
-+        kNONE_LCDOrder = 2
-     };
- 
-     static void SetSubpixelOrder(LCDOrder order);
-diff --git a/gfx/skia/include/core/SkMaskFilter.h b/gfx/skia/include/core/SkMaskFilter.h
-index 9a470a4..3422e27 100644
---- a/gfx/skia/include/core/SkMaskFilter.h
-+++ b/gfx/skia/include/core/SkMaskFilter.h
-@@ -61,7 +61,7 @@ public:
-         kNormal_BlurType,  //!< fuzzy inside and outside
-         kSolid_BlurType,   //!< solid inside, fuzzy outside
-         kOuter_BlurType,   //!< nothing inside, fuzzy outside
--        kInner_BlurType,   //!< fuzzy inside, nothing outside
-+        kInner_BlurType    //!< fuzzy inside, nothing outside
-     };
- 
-     struct BlurInfo {
-diff --git a/gfx/skia/include/core/SkPaint.h b/gfx/skia/include/core/SkPaint.h
-index ff37d77..7c96e193 100644
---- a/gfx/skia/include/core/SkPaint.h
-+++ b/gfx/skia/include/core/SkPaint.h
-@@ -76,7 +76,7 @@ public:
-         kNo_Hinting            = 0,
-         kSlight_Hinting        = 1,
-         kNormal_Hinting        = 2,     //!< this is the default
--        kFull_Hinting          = 3,
-+        kFull_Hinting          = 3
-     };
- 
-     Hinting getHinting() const {
-@@ -289,7 +289,7 @@ public:
-         kStroke_Style,          //!< stroke the geometry
-         kStrokeAndFill_Style,   //!< fill and stroke the geometry
- 
--        kStyleCount,
-+        kStyleCount
-     };
- 
-     /** Return the paint's style, used for controlling how primitives'
-diff --git a/gfx/skia/include/core/SkScalerContext.h b/gfx/skia/include/core/SkScalerContext.h
-index 2cb171b..3dbce27 100644
---- a/gfx/skia/include/core/SkScalerContext.h
-+++ b/gfx/skia/include/core/SkScalerContext.h
-@@ -182,21 +182,22 @@ public:
-         kGenA8FromLCD_Flag        = 0x0800,
- 
- #ifdef SK_USE_COLOR_LUMINANCE
--        kLuminance_Bits           = 3,
-+        kLuminance_Bits           = 3
- #else
-         // luminance : 0 for black text, kLuminance_Max for white text
-         kLuminance_Shift          = 13, // shift to land in the high 3-bits of Flags
--        kLuminance_Bits           = 3,  // ensure Flags doesn't exceed 16bits
-+        kLuminance_Bits           = 3   // ensure Flags doesn't exceed 16bits
- #endif
-     };
-     
-     // computed values
-     enum {
--        kHinting_Mask   = kHintingBit1_Flag | kHintingBit2_Flag,
- #ifdef SK_USE_COLOR_LUMINANCE
-+        kHinting_Mask   = kHintingBit1_Flag | kHintingBit2_Flag
- #else
-+        kHinting_Mask   = kHintingBit1_Flag | kHintingBit2_Flag,
-         kLuminance_Max  = (1 << kLuminance_Bits) - 1,
--        kLuminance_Mask = kLuminance_Max << kLuminance_Shift,
-+        kLuminance_Mask = kLuminance_Max << kLuminance_Shift
- #endif
-     };
- 
-diff --git a/gfx/skia/include/core/SkTypes.h b/gfx/skia/include/core/SkTypes.h
-index 7963a7d..0c5c2d7 100644
---- a/gfx/skia/include/core/SkTypes.h
-+++ b/gfx/skia/include/core/SkTypes.h
-@@ -438,7 +438,7 @@ public:
-          *  current block is dynamically allocated, just return the old
-          *  block.
-          */
--        kReuse_OnShrink,
-+        kReuse_OnShrink
-     };
- 
-     /**
-diff --git a/gfx/skia/include/effects/SkLayerDrawLooper.h b/gfx/skia/include/effects/SkLayerDrawLooper.h
-index 0bc4af2..6cb8ef6 100644
---- a/gfx/skia/include/effects/SkLayerDrawLooper.h
-+++ b/gfx/skia/include/effects/SkLayerDrawLooper.h
-@@ -41,7 +41,7 @@ public:
-          *  - Flags and Color are always computed using the LayerInfo's
-          *    fFlagsMask and fColorMode.
-          */
--        kEntirePaint_Bits = -1,
-+        kEntirePaint_Bits = -1
-         
-     };
-     typedef int32_t BitFlags;
-diff --git a/gfx/skia/src/core/SkBitmap.cpp b/gfx/skia/src/core/SkBitmap.cpp
-index 6b99145..aff52fd 100644
---- a/gfx/skia/src/core/SkBitmap.cpp
-+++ b/gfx/skia/src/core/SkBitmap.cpp
-@@ -1376,7 +1376,7 @@ enum {
-     SERIALIZE_PIXELTYPE_RAW_WITH_CTABLE,
-     SERIALIZE_PIXELTYPE_RAW_NO_CTABLE,
-     SERIALIZE_PIXELTYPE_REF_DATA,
--    SERIALIZE_PIXELTYPE_REF_PTR,
-+    SERIALIZE_PIXELTYPE_REF_PTR
- };
- 
- /*
-diff --git a/gfx/skia/src/core/SkGlyphCache.cpp b/gfx/skia/src/core/SkGlyphCache.cpp
-index f3363cd..1fddc9d 100644
---- a/gfx/skia/src/core/SkGlyphCache.cpp
-+++ b/gfx/skia/src/core/SkGlyphCache.cpp
-@@ -417,7 +417,7 @@ class SkGlyphCache_Globals {
- public:
-     enum UseMutex {
-         kNo_UseMutex,  // thread-local cache
--        kYes_UseMutex, // shared cache
-+        kYes_UseMutex  // shared cache
-     };
- 
-     SkGlyphCache_Globals(UseMutex um) {
--- 
-1.7.5.4
-
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/0004-Bug-777614-Re-apply-bug-719872-Fix-crash-on-Android-.patch
@@ -0,0 +1,684 @@
+From 0d730a94e9f6676d5cde45f955fe025a4549817e Mon Sep 17 00:00:00 2001
+From: George Wright <gw@gwright.org.uk>
+Date: Thu, 23 Aug 2012 16:45:38 -0400
+Subject: [PATCH 4/9] Bug 777614 - Re-apply bug 719872 - Fix crash on Android
+ by reverting to older FontHost r=nrc
+
+---
+ gfx/skia/src/ports/SkFontHost_android_old.cpp | 664 ++++++++++++++++++++++++++
+ 1 file changed, 664 insertions(+)
+ create mode 100644 gfx/skia/src/ports/SkFontHost_android_old.cpp
+
+diff --git a/gfx/skia/src/ports/SkFontHost_android_old.cpp b/gfx/skia/src/ports/SkFontHost_android_old.cpp
+new file mode 100644
+index 0000000..b5c4f3c
+--- /dev/null
++++ b/gfx/skia/src/ports/SkFontHost_android_old.cpp
+@@ -0,0 +1,664 @@
++
++/*
++ * Copyright 2006 The Android Open Source Project
++ *
++ * Use of this source code is governed by a BSD-style license that can be
++ * found in the LICENSE file.
++ */
++
++
++#include "SkFontHost.h"
++#include "SkDescriptor.h"
++#include "SkMMapStream.h"
++#include "SkPaint.h"
++#include "SkString.h"
++#include "SkStream.h"
++#include "SkThread.h"
++#include "SkTSearch.h"
++#include <stdio.h>
++
++#define FONT_CACHE_MEMORY_BUDGET    (768 * 1024)
++
++#ifndef SK_FONT_FILE_PREFIX
++    #define SK_FONT_FILE_PREFIX          "/fonts/"
++#endif
++
++bool find_name_and_attributes(SkStream* stream, SkString* name, SkTypeface::Style* style,
++                                           bool* isFixedWidth);
++
++static void GetFullPathForSysFonts(SkString* full, const char name[]) {
++    full->set(getenv("ANDROID_ROOT"));
++    full->append(SK_FONT_FILE_PREFIX);
++    full->append(name);
++}
++
++///////////////////////////////////////////////////////////////////////////////
++
++struct FamilyRec;
++
++/*  This guy holds a mapping of a name -> family, used for looking up fonts.
++    Since it is stored in a stretchy array that doesn't preserve object
++    semantics, we don't use constructor/destructors, but just have explicit
++    helpers to manage our internal bookkeeping.
++*/
++struct NameFamilyPair {
++    const char* fName;      // we own this
++    FamilyRec*  fFamily;    // we don't own this, we just reference it
++
++    void construct(const char name[], FamilyRec* family) {
++        fName = strdup(name);
++        fFamily = family;   // we don't own this, so just record the referene
++    }
++
++    void destruct() {
++        free((char*)fName);
++        // we don't own family, so just ignore our reference
++    }
++};
++
++// we use atomic_inc to grow this for each typeface we create
++static int32_t gUniqueFontID;
++
++// this is the mutex that protects these globals
++static SkMutex gFamilyMutex;
++static FamilyRec* gFamilyHead;
++static SkTDArray<NameFamilyPair> gNameList;
++
++struct FamilyRec {
++    FamilyRec*  fNext;
++    SkTypeface* fFaces[4];
++
++    FamilyRec()
++    {
++        fNext = gFamilyHead;
++        memset(fFaces, 0, sizeof(fFaces));
++        gFamilyHead = this;
++    }
++};
++
++static SkTypeface* find_best_face(const FamilyRec* family,
++                                  SkTypeface::Style style) {
++    SkTypeface* const* faces = family->fFaces;
++
++    if (faces[style] != NULL) { // exact match
++        return faces[style];
++    }
++    // look for a matching bold
++    style = (SkTypeface::Style)(style ^ SkTypeface::kItalic);
++    if (faces[style] != NULL) {
++        return faces[style];
++    }
++    // look for the plain
++    if (faces[SkTypeface::kNormal] != NULL) {
++        return faces[SkTypeface::kNormal];
++    }
++    // look for anything
++    for (int i = 0; i < 4; i++) {
++        if (faces[i] != NULL) {
++            return faces[i];
++        }
++    }
++    // should never get here, since the faces list should not be empty
++    SkASSERT(!"faces list is empty");
++    return NULL;
++}
++
++static FamilyRec* find_family(const SkTypeface* member) {
++    FamilyRec* curr = gFamilyHead;
++    while (curr != NULL) {
++        for (int i = 0; i < 4; i++) {
++            if (curr->fFaces[i] == member) {
++                return curr;
++            }
++        }
++        curr = curr->fNext;
++    }
++    return NULL;
++}
++
++/*  Returns the matching typeface, or NULL. If a typeface is found, its refcnt
++    is not modified.
++ */
++static SkTypeface* find_from_uniqueID(uint32_t uniqueID) {
++    FamilyRec* curr = gFamilyHead;
++    while (curr != NULL) {
++        for (int i = 0; i < 4; i++) {
++            SkTypeface* face = curr->fFaces[i];
++            if (face != NULL && face->uniqueID() == uniqueID) {
++                return face;
++            }
++        }
++        curr = curr->fNext;
++    }
++    return NULL;
++}
++
++/*  Remove reference to this face from its family. If the resulting family
++    is empty (has no faces), return that family, otherwise return NULL
++*/
++static FamilyRec* remove_from_family(const SkTypeface* face) {
++    FamilyRec* family = find_family(face);
++    SkASSERT(family->fFaces[face->style()] == face);
++    family->fFaces[face->style()] = NULL;
++
++    for (int i = 0; i < 4; i++) {
++        if (family->fFaces[i] != NULL) {    // family is non-empty
++            return NULL;
++        }
++    }
++    return family;  // return the empty family
++}
++
++// maybe we should make FamilyRec be doubly-linked
++static void detach_and_delete_family(FamilyRec* family) {
++    FamilyRec* curr = gFamilyHead;
++    FamilyRec* prev = NULL;
++
++    while (curr != NULL) {
++        FamilyRec* next = curr->fNext;
++        if (curr == family) {
++            if (prev == NULL) {
++                gFamilyHead = next;
++            } else {
++                prev->fNext = next;
++            }
++            SkDELETE(family);
++            return;
++        }
++        prev = curr;
++        curr = next;
++    }
++    SkASSERT(!"Yikes, couldn't find family in our list to remove/delete");
++}
++
++static SkTypeface* find_typeface(const char name[], SkTypeface::Style style) {
++    NameFamilyPair* list = gNameList.begin();
++    int             count = gNameList.count();
++
++    int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0]));
++
++    if (index >= 0) {
++        return find_best_face(list[index].fFamily, style);
++    }
++    return NULL;
++}
++
++static SkTypeface* find_typeface(const SkTypeface* familyMember,
++                                 SkTypeface::Style style) {
++    const FamilyRec* family = find_family(familyMember);
++    return family ? find_best_face(family, style) : NULL;
++}
++
++static void add_name(const char name[], FamilyRec* family) {
++    SkAutoAsciiToLC tolc(name);
++    name = tolc.lc();
++
++    NameFamilyPair* list = gNameList.begin();
++    int             count = gNameList.count();
++
++    int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0]));
++
++    if (index < 0) {
++        list = gNameList.insert(~index);
++        list->construct(name, family);
++    }
++}
++
++static void remove_from_names(FamilyRec* emptyFamily)
++{
++#ifdef SK_DEBUG
++    for (int i = 0; i < 4; i++) {
++        SkASSERT(emptyFamily->fFaces[i] == NULL);
++    }
++#endif
++
++    SkTDArray<NameFamilyPair>& list = gNameList;
++
++    // must go backwards when removing
++    for (int i = list.count() - 1; i >= 0; --i) {
++        NameFamilyPair* pair = &list[i];
++        if (pair->fFamily == emptyFamily) {
++            pair->destruct();
++            list.remove(i);
++        }
++    }
++}
++
++///////////////////////////////////////////////////////////////////////////////
++
++class FamilyTypeface : public SkTypeface {
++public:
++    FamilyTypeface(Style style, bool sysFont, SkTypeface* familyMember,
++                   bool isFixedWidth)
++    : SkTypeface(style, sk_atomic_inc(&gUniqueFontID) + 1, isFixedWidth) {
++        fIsSysFont = sysFont;
++
++        SkAutoMutexAcquire  ac(gFamilyMutex);
++
++        FamilyRec* rec = NULL;
++        if (familyMember) {
++            rec = find_family(familyMember);
++            SkASSERT(rec);
++        } else {
++            rec = SkNEW(FamilyRec);
++        }
++        rec->fFaces[style] = this;
++    }
++
++    virtual ~FamilyTypeface() {
++        SkAutoMutexAcquire  ac(gFamilyMutex);
++
++        // remove us from our family. If the family is now empty, we return
++        // that and then remove that family from the name list
++        FamilyRec* family = remove_from_family(this);
++        if (NULL != family) {
++            remove_from_names(family);
++            detach_and_delete_family(family);
++        }
++    }
++
++    bool isSysFont() const { return fIsSysFont; }
++
++    virtual SkStream* openStream() = 0;
++    virtual const char* getUniqueString() const = 0;
++    virtual const char* getFilePath() const = 0;
++
++private:
++    bool    fIsSysFont;
++
++    typedef SkTypeface INHERITED;
++};
++
++///////////////////////////////////////////////////////////////////////////////
++
++class StreamTypeface : public FamilyTypeface {
++public:
++    StreamTypeface(Style style, bool sysFont, SkTypeface* familyMember,
++                   SkStream* stream, bool isFixedWidth)
++    : INHERITED(style, sysFont, familyMember, isFixedWidth) {
++        SkASSERT(stream);
++        stream->ref();
++        fStream = stream;
++    }
++    virtual ~StreamTypeface() {
++        fStream->unref();
++    }
++
++    // overrides
++    virtual SkStream* openStream() {
++        // we just ref our existing stream, since the caller will call unref()
++        // when they are through
++        fStream->ref();
++        // must rewind each time, since the caller assumes a "new" stream
++        fStream->rewind();
++        return fStream;
++    }
++    virtual const char* getUniqueString() const { return NULL; }
++    virtual const char* getFilePath() const { return NULL; }
++
++private:
++    SkStream* fStream;
++
++    typedef FamilyTypeface INHERITED;
++};
++
++class FileTypeface : public FamilyTypeface {
++public:
++    FileTypeface(Style style, bool sysFont, SkTypeface* familyMember,
++                 const char path[], bool isFixedWidth)
++    : INHERITED(style, sysFont, familyMember, isFixedWidth) {
++        SkString fullpath;
++
++        if (sysFont) {
++            GetFullPathForSysFonts(&fullpath, path);
++            path = fullpath.c_str();
++        }
++        fPath.set(path);
++    }
++
++    // overrides
++    virtual SkStream* openStream() {
++        SkStream* stream = SkNEW_ARGS(SkMMAPStream, (fPath.c_str()));
++
++        // check for failure
++        if (stream->getLength() <= 0) {
++            SkDELETE(stream);
++            // maybe MMAP isn't supported. try FILE
++            stream = SkNEW_ARGS(SkFILEStream, (fPath.c_str()));
++            if (stream->getLength() <= 0) {
++                SkDELETE(stream);
++                stream = NULL;
++            }
++        }
++        return stream;
++    }
++    virtual const char* getUniqueString() const {
++        const char* str = strrchr(fPath.c_str(), '/');
++        if (str) {
++            str += 1;   // skip the '/'
++        }
++        return str;
++    }
++    virtual const char* getFilePath() const {
++        return fPath.c_str();
++    }
++
++private:
++    SkString fPath;
++
++    typedef FamilyTypeface INHERITED;
++};
++
++///////////////////////////////////////////////////////////////////////////////
++///////////////////////////////////////////////////////////////////////////////
++
++static bool get_name_and_style(const char path[], SkString* name,
++                               SkTypeface::Style* style,
++                               bool* isFixedWidth, bool isExpected) {
++    SkString        fullpath;
++    GetFullPathForSysFonts(&fullpath, path);
++
++    SkMMAPStream stream(fullpath.c_str());
++    if (stream.getLength() > 0) {
++        find_name_and_attributes(&stream, name, style, isFixedWidth);
++        return true;
++    }
++    else {
++        SkFILEStream stream(fullpath.c_str());
++        if (stream.getLength() > 0) {
++            find_name_and_attributes(&stream, name, style, isFixedWidth);
++            return true;
++        }
++    }
++
++    if (isExpected) {
++        SkDebugf("---- failed to open <%s> as a font\n", fullpath.c_str());
++    }
++    return false;
++}
++
++// used to record our notion of the pre-existing fonts
++struct FontInitRec {
++    const char*         fFileName;
++    const char* const*  fNames;     // null-terminated list
++};
++
++static const char* gSansNames[] = {
++    "sans-serif", "arial", "helvetica", "tahoma", "verdana", NULL
++};
++
++static const char* gSerifNames[] = {
++    "serif", "times", "times new roman", "palatino", "georgia", "baskerville",
++    "goudy", "fantasy", "cursive", "ITC Stone Serif", NULL
++};
++
++static const char* gMonoNames[] = {
++    "monospace", "courier", "courier new", "monaco", NULL
++};
++
++// deliberately empty, but we use the address to identify fallback fonts
++static const char* gFBNames[] = { NULL };
++
++/*  Fonts must be grouped by family, with the first font in a family having the
++    list of names (even if that list is empty), and the following members having
++    null for the list. The names list must be NULL-terminated
++*/
++static const FontInitRec gSystemFonts[] = {
++    { "DroidSans.ttf",              gSansNames  },
++    { "DroidSans-Bold.ttf",         NULL        },
++    { "DroidSerif-Regular.ttf",     gSerifNames },
++    { "DroidSerif-Bold.ttf",        NULL        },
++    { "DroidSerif-Italic.ttf",      NULL        },
++    { "DroidSerif-BoldItalic.ttf",  NULL        },
++    { "DroidSansMono.ttf",          gMonoNames  },
++    /*  These are optional, and can be ignored if not found in the file system.
++        These are appended to gFallbackFonts[] as they are seen, so we list
++        them in the order we want them to be accessed by NextLogicalFont().
++     */
++    { "DroidSansArabic.ttf",        gFBNames    },
++    { "DroidSansHebrew.ttf",        gFBNames    },
++    { "DroidSansThai.ttf",          gFBNames    },
++    { "MTLmr3m.ttf",                gFBNames    }, // Motoya Japanese Font
++    { "MTLc3m.ttf",                 gFBNames    }, // Motoya Japanese Font
++    { "DroidSansJapanese.ttf",      gFBNames    },
++    { "DroidSansFallback.ttf",      gFBNames    }
++};
++
++#define DEFAULT_NAMES   gSansNames
++
++// these globals are assigned (once) by load_system_fonts()
++static FamilyRec* gDefaultFamily;
++static SkTypeface* gDefaultNormal;
++
++/*  This is sized conservatively, assuming that it will never be a size issue.
++    It will be initialized in load_system_fonts(), and will be filled with the
++    fontIDs that can be used for fallback consideration, in sorted order (sorted
++    meaning element[0] should be used first, then element[1], etc. When we hit
++    a fontID==0 in the array, the list is done, hence our allocation size is
++    +1 the total number of possible system fonts. Also see NextLogicalFont().
++ */
++static uint32_t gFallbackFonts[SK_ARRAY_COUNT(gSystemFonts)+1];
++
++/*  Called once (ensured by the sentinel check at the beginning of our body).
++    Initializes all the globals, and register the system fonts.
++ */
++static void load_system_fonts() {
++    // check if we've already be called
++    if (NULL != gDefaultNormal) {
++        return;
++    }
++
++    const FontInitRec* rec = gSystemFonts;
++    SkTypeface* firstInFamily = NULL;
++    int fallbackCount = 0;
++
++    for (size_t i = 0; i < SK_ARRAY_COUNT(gSystemFonts); i++) {
++        // if we're the first in a new family, clear firstInFamily
++        if (rec[i].fNames != NULL) {
++            firstInFamily = NULL;
++        }
++
++        bool isFixedWidth;
++        SkString name;
++        SkTypeface::Style style;
++
++        // we expect all the fonts, except the "fallback" fonts
++        bool isExpected = (rec[i].fNames != gFBNames);
++        if (!get_name_and_style(rec[i].fFileName, &name, &style,
++                                &isFixedWidth, isExpected)) {
++            continue;
++        }
++
++        SkTypeface* tf = SkNEW_ARGS(FileTypeface,
++                                    (style,
++                                     true,  // system-font (cannot delete)
++                                     firstInFamily, // what family to join
++                                     rec[i].fFileName,
++                                     isFixedWidth) // filename
++                                    );
++
++        if (rec[i].fNames != NULL) {
++            // see if this is one of our fallback fonts
++            if (rec[i].fNames == gFBNames) {
++            //    SkDebugf("---- adding %s as fallback[%d] fontID %d\n",
++            //             rec[i].fFileName, fallbackCount, tf->uniqueID());
++                gFallbackFonts[fallbackCount++] = tf->uniqueID();
++            }
++
++            firstInFamily = tf;
++            FamilyRec* family = find_family(tf);
++            const char* const* names = rec[i].fNames;
++
++            // record the default family if this is it
++            if (names == DEFAULT_NAMES) {
++                gDefaultFamily = family;
++            }
++            // add the names to map to this family
++            while (*names) {
++                add_name(*names, family);
++                names += 1;
++            }
++        }
++    }
++
++    // do this after all fonts are loaded. This is our default font, and it
++    // acts as a sentinel so we only execute load_system_fonts() once
++    gDefaultNormal = find_best_face(gDefaultFamily, SkTypeface::kNormal);
++    // now terminate our fallback list with the sentinel value
++    gFallbackFonts[fallbackCount] = 0;
++}
++
++///////////////////////////////////////////////////////////////////////////////
++
++void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) {
++    const char* name = ((FamilyTypeface*)face)->getUniqueString();
++
++    stream->write8((uint8_t)face->style());
++
++    if (NULL == name || 0 == *name) {
++        stream->writePackedUInt(0);
++//        SkDebugf("--- fonthost serialize null\n");
++    } else {
++        uint32_t len = strlen(name);
++        stream->writePackedUInt(len);
++        stream->write(name, len);
++//      SkDebugf("--- fonthost serialize <%s> %d\n", name, face->style());
++    }
++}
++
++SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
++    load_system_fonts();
++
++    int style = stream->readU8();
++
++    int len = stream->readPackedUInt();
++    if (len > 0) {
++        SkString str;
++        str.resize(len);
++        stream->read(str.writable_str(), len);
++
++        const FontInitRec* rec = gSystemFonts;
++        for (size_t i = 0; i < SK_ARRAY_COUNT(gSystemFonts); i++) {
++            if (strcmp(rec[i].fFileName, str.c_str()) == 0) {
++                // backup until we hit the fNames
++                for (int j = i; j >= 0; --j) {
++                    if (rec[j].fNames != NULL) {
++                        return SkFontHost::CreateTypeface(NULL,
++                                    rec[j].fNames[0], (SkTypeface::Style)style);
++                    }
++                }
++            }
++        }
++    }
++    return NULL;
++}
++
++///////////////////////////////////////////////////////////////////////////////
++
++SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
++                                       const char familyName[],
++                                       SkTypeface::Style style) {
++    load_system_fonts();
++
++    SkAutoMutexAcquire  ac(gFamilyMutex);
++
++    // clip to legal style bits
++    style = (SkTypeface::Style)(style & SkTypeface::kBoldItalic);
++
++    SkTypeface* tf = NULL;
++
++    if (NULL != familyFace) {
++        tf = find_typeface(familyFace, style);
++    } else if (NULL != familyName) {
++//        SkDebugf("======= familyName <%s>\n", familyName);
++        tf = find_typeface(familyName, style);
++    }
++
++    if (NULL == tf) {
++        tf = find_best_face(gDefaultFamily, style);
++    }
++
++    // we ref(), since the symantic is to return a new instance
++    tf->ref();
++    return tf;
++}
++
++SkStream* SkFontHost::OpenStream(uint32_t fontID) {
++    SkAutoMutexAcquire  ac(gFamilyMutex);
++
++    FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID);
++    SkStream* stream = tf ? tf->openStream() : NULL;
++
++    if (stream && stream->getLength() == 0) {
++        stream->unref();
++        stream = NULL;
++    }
++    return stream;
++}
++
++size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length,
++                               int32_t* index) {
++    SkAutoMutexAcquire  ac(gFamilyMutex);
++
++    FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID);
++    const char* src = tf ? tf->getFilePath() : NULL;
++
++    if (src) {
++        size_t size = strlen(src);
++        if (path) {
++            memcpy(path, src, SkMin32(size, length));
++        }
++        if (index) {
++            *index = 0; // we don't have collections (yet)
++        }
++        return size;
++    } else {
++        return 0;
++    }
++}
++
++SkFontID SkFontHost::NextLogicalFont(SkFontID currFontID, SkFontID origFontID) {
++    load_system_fonts();
++
++    /*  First see if fontID is already one of our fallbacks. If so, return
++        its successor. If fontID is not in our list, then return the first one
++        in our list. Note: list is zero-terminated, and returning zero means
++        we have no more fonts to use for fallbacks.
++     */
++    const uint32_t* list = gFallbackFonts;
++    for (int i = 0; list[i] != 0; i++) {
++        if (list[i] == currFontID) {
++            return list[i+1];
++        }
++    }
++    return list[0];
++}
++
++///////////////////////////////////////////////////////////////////////////////
++
++SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
++    if (NULL == stream || stream->getLength() <= 0) {
++        return NULL;
++    }
++
++    bool isFixedWidth;
++    SkString name;
++    SkTypeface::Style style;
++    find_name_and_attributes(stream, &name, &style, &isFixedWidth);
++
++    if (!name.isEmpty()) {
++        return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream, isFixedWidth));
++    } else {
++        return NULL;
++    }
++}
++
++SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) {
++    SkStream* stream = SkNEW_ARGS(SkMMAPStream, (path));
++    SkTypeface* face = SkFontHost::CreateTypefaceFromStream(stream);
++    // since we created the stream, we let go of our ref() here
++    stream->unref();
++    return face;
++}
++
++///////////////////////////////////////////////////////////////////////////////
+-- 
+1.7.11.4
+
deleted file mode 100644
--- a/gfx/skia/patches/0005-Bug-731384-Fix-clang-SK_OVERRIDE.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 80350275c72921ed5ac405c029ae33727467d7c5 Mon Sep 17 00:00:00 2001
-From: George Wright <gwright@mozilla.com>
-Date: Fri, 18 May 2012 14:15:50 -0400
-Subject: [PATCH 05/10]     Bug 755869 - [8] Re-apply bug 731384 - Fix compile
- errors on older versions of clang r=mattwoodrow
-
----
- gfx/skia/include/core/SkPostConfig.h |    9 +++++++++
- 1 files changed, 9 insertions(+), 0 deletions(-)
-
-diff --git a/gfx/skia/include/core/SkPostConfig.h b/gfx/skia/include/core/SkPostConfig.h
-index 8316f7a..041fe2a 100644
---- a/gfx/skia/include/core/SkPostConfig.h
-+++ b/gfx/skia/include/core/SkPostConfig.h
-@@ -288,9 +288,18 @@
- #if defined(_MSC_VER)
- #define SK_OVERRIDE override
- #elif defined(__clang__)
-+#if __has_feature(cxx_override_control)
- // Some documentation suggests we should be using __attribute__((override)),
- // but it doesn't work.
- #define SK_OVERRIDE override
-+#elif defined(__has_extension)
-+#if __has_extension(cxx_override_control)
-+#define SK_OVERRIDE override
-+#endif
-+#endif
-+#ifndef SK_OVERRIDE
-+#define SK_OVERRIDE
-+#endif
- #else
- // Linux GCC ignores "__attribute__((override))" and rejects "override".
- #define SK_OVERRIDE
--- 
-1.7.5.4
-
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/0005-Bug-777614-Re-apply-bug-687188-Expand-the-gradient-c.patch
@@ -0,0 +1,198 @@
+From 1ab13a923399aa638388231baca784ba89f2c82b Mon Sep 17 00:00:00 2001
+From: George Wright <gw@gwright.org.uk>
+Date: Wed, 12 Sep 2012 12:30:29 -0400
+Subject: [PATCH 5/9] Bug 777614 - Re-apply bug 687188 - Expand the gradient
+ cache by 2 to store 0/1 colour stop values for
+ clamping. r=nrc
+
+---
+ .../src/effects/gradients/SkGradientShader.cpp     | 22 +++++++++++----
+ .../src/effects/gradients/SkGradientShaderPriv.h   |  5 +++-
+ .../src/effects/gradients/SkLinearGradient.cpp     | 32 ++++++++++++++++------
+ .../gradients/SkTwoPointConicalGradient.cpp        | 11 ++++++--
+ .../effects/gradients/SkTwoPointRadialGradient.cpp | 11 ++++++--
+ 5 files changed, 61 insertions(+), 20 deletions(-)
+
+diff --git a/gfx/skia/src/effects/gradients/SkGradientShader.cpp b/gfx/skia/src/effects/gradients/SkGradientShader.cpp
+index f0dac4d..79e7202 100644
+--- a/gfx/skia/src/effects/gradients/SkGradientShader.cpp
++++ b/gfx/skia/src/effects/gradients/SkGradientShader.cpp
+@@ -426,15 +426,15 @@ static void complete_32bit_cache(SkPMColor* cache, int stride) {
+ 
+ const SkPMColor* SkGradientShaderBase::getCache32() const {
+     if (fCache32 == NULL) {
+-        // double the count for dither entries
+-        const int entryCount = kCache32Count * 2;
++        // double the count for dither entries, and have an extra two entries for clamp values
++        const int entryCount = kCache32Count * 2 + 2;
+         const size_t allocSize = sizeof(SkPMColor) * entryCount;
+ 
+         if (NULL == fCache32PixelRef) {
+             fCache32PixelRef = SkNEW_ARGS(SkMallocPixelRef,
+                                           (NULL, allocSize, NULL));
+         }
+-        fCache32 = (SkPMColor*)fCache32PixelRef->getAddr();
++        fCache32 = (SkPMColor*)fCache32PixelRef->getAddr() + 1;
+         if (fColorCount == 2) {
+             Build32bitCache(fCache32, fOrigColors[0], fOrigColors[1],
+                             kGradient32Length, fCacheAlpha);
+@@ -458,7 +458,7 @@ const SkPMColor* SkGradientShaderBase::getCache32() const {
+             SkMallocPixelRef* newPR = SkNEW_ARGS(SkMallocPixelRef,
+                                                  (NULL, allocSize, NULL));
+             SkPMColor* linear = fCache32;           // just computed linear data
+-            SkPMColor* mapped = (SkPMColor*)newPR->getAddr();    // storage for mapped data
++            SkPMColor* mapped = (SkPMColor*)newPR->getAddr() + 1;    // storage for mapped data
+             SkUnitMapper* map = fMapper;
+             for (int i = 0; i < kGradient32Length; i++) {
+                 int index = map->mapUnit16((i << 8) | i) >> 8;
+@@ -467,10 +467,22 @@ const SkPMColor* SkGradientShaderBase::getCache32() const {
+             }
+             fCache32PixelRef->unref();
+             fCache32PixelRef = newPR;
+-            fCache32 = (SkPMColor*)newPR->getAddr();
++            fCache32 = (SkPMColor*)newPR->getAddr() + 1;
+         }
+         complete_32bit_cache(fCache32, kCache32Count);
+     }
++
++    // Write the clamp colours into the first and last entries of fCache32
++    fCache32[kCache32ClampLower] = SkPackARGB32(fCacheAlpha,
++                                                SkColorGetR(fOrigColors[0]),
++                                                SkColorGetG(fOrigColors[0]),
++                                                SkColorGetB(fOrigColors[0]));
++
++    fCache32[kCache32ClampUpper] = SkPackARGB32(fCacheAlpha,
++                                                SkColorGetR(fOrigColors[fColorCount - 1]),
++                                                SkColorGetG(fOrigColors[fColorCount - 1]),
++                                                SkColorGetB(fOrigColors[fColorCount - 1]));
++
+     return fCache32;
+ }
+ 
+diff --git a/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h b/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
+index 0e7c2fc..7427935 100644
+--- a/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
++++ b/gfx/skia/src/effects/gradients/SkGradientShaderPriv.h
+@@ -133,7 +133,10 @@ public:
+         kDitherStride32 = 0,
+ #endif
+         kDitherStride16 = kCache16Count,
+-        kLerpRemainderMask32 = (1 << (16 - kCache32Bits)) - 1
++        kLerpRemainderMask32 = (1 << (16 - kCache32Bits)) - 1,
++
++        kCache32ClampLower = -1,
++        kCache32ClampUpper = kCache32Count * 2
+     };
+ 
+ 
+diff --git a/gfx/skia/src/effects/gradients/SkLinearGradient.cpp b/gfx/skia/src/effects/gradients/SkLinearGradient.cpp
+index bcebc26..d400b4d 100644
+--- a/gfx/skia/src/effects/gradients/SkLinearGradient.cpp
++++ b/gfx/skia/src/effects/gradients/SkLinearGradient.cpp
+@@ -126,6 +126,17 @@ void shadeSpan_linear_vertical(TileProc proc, SkFixed dx, SkFixed fx,
+                                SkPMColor* SK_RESTRICT dstC,
+                                const SkPMColor* SK_RESTRICT cache,
+                                int toggle, int count) {
++    if (proc == clamp_tileproc) {
++        // No need to lerp or dither for clamp values
++        if (fx < 0) {
++            sk_memset32(dstC, cache[SkGradientShaderBase::kCache32ClampLower], count);
++            return;
++        } else if (fx > 0xffff) {
++            sk_memset32(dstC, cache[SkGradientShaderBase::kCache32ClampUpper], count);
++            return;
++        }
++    }
++
+     // We're a vertical gradient, so no change in a span.
+     // If colors change sharply across the gradient, dithering is
+     // insufficient (it subsamples the color space) and we need to lerp.
+@@ -144,6 +155,17 @@ void shadeSpan_linear_vertical_lerp(TileProc proc, SkFixed dx, SkFixed fx,
+                                     SkPMColor* SK_RESTRICT dstC,
+                                     const SkPMColor* SK_RESTRICT cache,
+                                     int toggle, int count) {
++    if (proc == clamp_tileproc) {
++        // No need to lerp or dither for clamp values
++        if (fx < 0) {
++            sk_memset32(dstC, cache[SkGradientShaderBase::kCache32ClampLower], count);
++            return;
++        } else if (fx > 0xffff) {
++            sk_memset32(dstC, cache[SkGradientShaderBase::kCache32ClampUpper], count);
++            return;
++        }
++    }
++
+     // We're a vertical gradient, so no change in a span.
+     // If colors change sharply across the gradient, dithering is
+     // insufficient (it subsamples the color space) and we need to lerp.
+@@ -169,10 +191,7 @@ void shadeSpan_linear_clamp(TileProc proc, SkFixed dx, SkFixed fx,
+     range.init(fx, dx, count, 0, SkGradientShaderBase::kGradient32Length);
+ 
+     if ((count = range.fCount0) > 0) {
+-        sk_memset32_dither(dstC,
+-            cache[toggle + range.fV0],
+-            cache[(toggle ^ SkGradientShaderBase::kDitherStride32) + range.fV0],
+-            count);
++        sk_memset32(dstC, cache[SkGradientShaderBase::kCache32ClampLower], count);
+         dstC += count;
+     }
+     if ((count = range.fCount1) > 0) {
+@@ -191,10 +210,7 @@ void shadeSpan_linear_clamp(TileProc proc, SkFixed dx, SkFixed fx,
+         }
+     }
+     if ((count = range.fCount2) > 0) {
+-        sk_memset32_dither(dstC,
+-            cache[toggle + range.fV1],
+-            cache[(toggle ^ SkGradientShaderBase::kDitherStride32) + range.fV1],
+-            count);
++        sk_memset32(dstC, cache[SkGradientShaderBase::kCache32ClampUpper], count);
+     }
+ }
+ 
+diff --git a/gfx/skia/src/effects/gradients/SkTwoPointConicalGradient.cpp b/gfx/skia/src/effects/gradients/SkTwoPointConicalGradient.cpp
+index 3466d2c..764a444 100644
+--- a/gfx/skia/src/effects/gradients/SkTwoPointConicalGradient.cpp
++++ b/gfx/skia/src/effects/gradients/SkTwoPointConicalGradient.cpp
+@@ -123,9 +123,14 @@ static void twopoint_clamp(TwoPtRadial* rec, SkPMColor* SK_RESTRICT dstC,
+         if (TwoPtRadial::DontDrawT(t)) {
+             *dstC++ = 0;
+         } else {
+-            SkFixed index = SkClampMax(t, 0xFFFF);
+-            SkASSERT(index <= 0xFFFF);
+-            *dstC++ = cache[index >> SkGradientShaderBase::kCache32Shift];
++            if (t < 0) {
++                *dstC++ = cache[SkGradientShaderBase::kCache32ClampLower];
++            } else if (t > 0xFFFF) {
++                *dstC++ = cache[SkGradientShaderBase::kCache32ClampUpper];
++            } else {
++                SkASSERT(t <= 0xFFFF);
++                *dstC++ = cache[t >> SkGradientShaderBase::kCache32Shift];
++            }
+         }
+     }
+ }
+diff --git a/gfx/skia/src/effects/gradients/SkTwoPointRadialGradient.cpp b/gfx/skia/src/effects/gradients/SkTwoPointRadialGradient.cpp
+index 9362ded..22b028e 100644
+--- a/gfx/skia/src/effects/gradients/SkTwoPointRadialGradient.cpp
++++ b/gfx/skia/src/effects/gradients/SkTwoPointRadialGradient.cpp
+@@ -120,9 +120,14 @@ void shadeSpan_twopoint_clamp(SkScalar fx, SkScalar dx,
+     for (; count > 0; --count) {
+         SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
+                                      fOneOverTwoA, posRoot);
+-        SkFixed index = SkClampMax(t, 0xFFFF);
+-        SkASSERT(index <= 0xFFFF);
+-        *dstC++ = cache[index >> SkGradientShaderBase::kCache32Shift];
++        if (t < 0) {
++            *dstC++ = cache[SkGradientShaderBase::kCache32ClampLower];
++        } else if (t > 0xFFFF) {
++            *dstC++ = cache[SkGradientShaderBase::kCache32ClampUpper];
++        } else {
++            SkASSERT(t <= 0xFFFF);
++            *dstC++ = cache[t >> SkGradientShaderBase::kCache32Shift];
++        }
+         fx += dx;
+         fy += dy;
+         b += db;
+-- 
+1.7.11.4
+
deleted file mode 100644
--- a/gfx/skia/patches/0006-Bug-751814-ARM-EDSP-ARMv6-Skia-fixes.patch
+++ /dev/null
@@ -1,147 +0,0 @@
-From 94916fbbc7865c6fe23a57d6edc48c6daf93dda8 Mon Sep 17 00:00:00 2001
-From: George Wright <gwright@mozilla.com>
-Date: Fri, 18 May 2012 14:16:08 -0400
-Subject: [PATCH 06/10]     Bug 755869 - [9] Re-apply bug 751814 - Various
- Skia fixes for ARM without EDSP and ARMv6+
- r=mattwoodrow
-
----
- gfx/skia/include/core/SkMath.h                   |    5 +--
- gfx/skia/include/core/SkPostConfig.h             |   45 ++++++++++++++++++++++
- gfx/skia/src/opts/SkBitmapProcState_opts_arm.cpp |    6 +-
- gfx/skia/src/opts/SkBlitRow_opts_arm.cpp         |    9 ++++
- 4 files changed, 58 insertions(+), 7 deletions(-)
-
-diff --git a/gfx/skia/include/core/SkMath.h b/gfx/skia/include/core/SkMath.h
-index 5889103..7a4b707 100644
---- a/gfx/skia/include/core/SkMath.h
-+++ b/gfx/skia/include/core/SkMath.h
-@@ -153,10 +153,7 @@ static inline bool SkIsPow2(int value) {
-     With this requirement, we can generate faster instructions on some
-     architectures.
- */
--#if defined(__arm__) \
--  && !defined(__thumb__) \
--  && !defined(__ARM_ARCH_4T__) \
--  && !defined(__ARM_ARCH_5T__)
-+#ifdef SK_ARM_HAS_EDSP
-     static inline int32_t SkMulS16(S16CPU x, S16CPU y) {
-         SkASSERT((int16_t)x == x);
-         SkASSERT((int16_t)y == y);
-diff --git a/gfx/skia/include/core/SkPostConfig.h b/gfx/skia/include/core/SkPostConfig.h
-index 041fe2a..03105e4 100644
---- a/gfx/skia/include/core/SkPostConfig.h
-+++ b/gfx/skia/include/core/SkPostConfig.h
-@@ -311,3 +311,48 @@
- #ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
- #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 1
- #endif
-+
-+//////////////////////////////////////////////////////////////////////
-+// ARM defines
-+
-+#if defined(__GNUC__) && defined(__arm__)
-+
-+#  define SK_ARM_ARCH 3
-+
-+#  if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) \
-+   || defined(_ARM_ARCH_4)
-+#    undef SK_ARM_ARCH
-+#    define SK_ARM_ARCH 4
-+#  endif
-+
-+#  if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
-+   || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
-+   || defined(__ARM_ARCH_5TEJ__) || defined(_ARM_ARCH_5)
-+#    undef SK_ARM_ARCH
-+#    define SK_ARM_ARCH 5
-+#  endif
-+ 
-+#  if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
-+   || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
-+   || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
-+   || defined(__ARM_ARCH_6M__) || defined(_ARM_ARCH_6)
-+#    undef SK_ARM_ARCH
-+#    define SK_ARM_ARCH 6
-+#  endif
-+
-+#  if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
-+   || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
-+   || defined(__ARM_ARCH_7EM__) || defined(_ARM_ARCH_7)
-+#    undef SK_ARM_ARCH
-+#    define SK_ARM_ARCH 7
-+#  endif
-+
-+#  undef SK_ARM_HAS_EDSP
-+#  if defined(__thumb2__) && (SK_ARM_ARCH >= 6) \
-+   || !defined(__thumb__) \
-+   && ((SK_ARM_ARCH > 5) || defined(__ARM_ARCH_5E__) \
-+       || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__))
-+#    define SK_ARM_HAS_EDSP 1
-+#  endif
-+
-+#endif
-diff --git a/gfx/skia/src/opts/SkBitmapProcState_opts_arm.cpp b/gfx/skia/src/opts/SkBitmapProcState_opts_arm.cpp
-index 20d62e1..deb1bfe 100644
---- a/gfx/skia/src/opts/SkBitmapProcState_opts_arm.cpp
-+++ b/gfx/skia/src/opts/SkBitmapProcState_opts_arm.cpp
-@@ -11,7 +11,7 @@
- #include "SkColorPriv.h"
- #include "SkUtils.h"
- 
--#if __ARM_ARCH__ >= 6 && !defined(SK_CPU_BENDIAN)
-+#if SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
- void SI8_D16_nofilter_DX_arm(
-     const SkBitmapProcState& s,
-     const uint32_t* SK_RESTRICT xy,
-@@ -182,7 +182,7 @@ void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s,
- 
-     s.fBitmap->getColorTable()->unlockColors(false);
- }
--#endif //__ARM_ARCH__ >= 6 && !defined(SK_CPU_BENDIAN)
-+#endif // SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
- 
- ///////////////////////////////////////////////////////////////////////////////
- 
-@@ -200,7 +200,7 @@ void SkBitmapProcState::platformProcs() {
- 
-     switch (fBitmap->config()) {
-         case SkBitmap::kIndex8_Config:
--#if __ARM_ARCH__ >= 6 && !defined(SK_CPU_BENDIAN)
-+#if SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
-             if (justDx && !doFilter) {
- #if 0   /* crashing on android device */
-                 fSampleProc16 = SI8_D16_nofilter_DX_arm;
-diff --git a/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp b/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
-index 2490371..c928888 100644
---- a/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
-+++ b/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
-@@ -675,8 +675,13 @@ static void __attribute((noinline,optimize("-fomit-frame-pointer"))) S32A_Blend_
-                   /* dst1_scale and dst2_scale*/
-                   "lsr    r9, r5, #24                \n\t" /* src >> 24 */
-                   "lsr    r10, r6, #24               \n\t" /* src >> 24 */
-+#ifdef SK_ARM_HAS_EDSP
-                   "smulbb r9, r9, %[alpha]           \n\t" /* r9 = SkMulS16 r9 with src_scale */
-                   "smulbb r10, r10, %[alpha]         \n\t" /* r10 = SkMulS16 r10 with src_scale */
-+#else
-+                  "mul    r9, r9, %[alpha]           \n\t" /* r9 = SkMulS16 r9 with src_scale */
-+                  "mul    r10, r10, %[alpha]         \n\t" /* r10 = SkMulS16 r10 with src_scale */
-+#endif
-                   "lsr    r9, r9, #8                 \n\t" /* r9 >> 8 */
-                   "lsr    r10, r10, #8               \n\t" /* r10 >> 8 */
-                   "rsb    r9, r9, #256               \n\t" /* dst1_scale = r9 = 255 - r9 + 1 */
-@@ -745,7 +750,11 @@ static void __attribute((noinline,optimize("-fomit-frame-pointer"))) S32A_Blend_
- 
-                   "lsr    r6, r5, #24                \n\t" /* src >> 24 */
-                   "and    r8, r12, r5, lsr #8        \n\t" /* ag = r8 = r5 masked by r12 lsr by #8 */
-+#ifdef SK_ARM_HAS_EDSP
-                   "smulbb r6, r6, %[alpha]           \n\t" /* r6 = SkMulS16 with src_scale */
-+#else
-+                  "mul    r6, r6, %[alpha]           \n\t" /* r6 = SkMulS16 with src_scale */
-+#endif
-                   "and    r9, r12, r5                \n\t" /* rb = r9 = r5 masked by r12 */
-                   "lsr    r6, r6, #8                 \n\t" /* r6 >> 8 */
-                   "mul    r8, r8, %[alpha]           \n\t" /* ag = r8 times scale */
--- 
-1.7.5.4
-
deleted file mode 100644
--- a/gfx/skia/patches/0007-Bug-719872-Old-Android-FontHost.patch
+++ /dev/null
@@ -1,702 +0,0 @@
-From 6982ad469adcdfa2b7bdbf8bbd843bc22d3832fc Mon Sep 17 00:00:00 2001
-From: George Wright <gwright@mozilla.com>
-Date: Fri, 18 May 2012 14:52:40 -0400
-Subject: [PATCH 07/10]     Bug 755869 - [10] Re-apply bug 719872 - Fix crash
- on Android by reverting to older FontHost impl
- r=mattwoodrow
-
----
- gfx/skia/Makefile.in                          |    5 +-
- gfx/skia/src/ports/SkFontHost_android_old.cpp |  664 +++++++++++++++++++++++++
- 2 files changed, 668 insertions(+), 1 deletions(-)
- create mode 100644 gfx/skia/src/ports/SkFontHost_android_old.cpp
-
-diff --git a/gfx/skia/Makefile.in b/gfx/skia/Makefile.in
-index 9da098a..8184f1c 100644
---- a/gfx/skia/Makefile.in
-+++ b/gfx/skia/Makefile.in
-@@ -327,7 +327,10 @@ endif
- ifeq (android,$(MOZ_WIDGET_TOOLKIT))
- CPPSRCS += \
- 	SkDebug_android.cpp \
--	SkFontHost_none.cpp \
-+	SkFontHost_android_old.cpp \
-+	SkFontHost_gamma.cpp \
-+	SkFontHost_FreeType.cpp \
-+	SkFontHost_tables.cpp \
- 	SkMMapStream.cpp \
- 	SkTime_Unix.cpp \
- 	SkThread_pthread.cpp \
-diff --git a/gfx/skia/src/ports/SkFontHost_android_old.cpp b/gfx/skia/src/ports/SkFontHost_android_old.cpp
-new file mode 100644
-index 0000000..b5c4f3c
---- /dev/null
-+++ b/gfx/skia/src/ports/SkFontHost_android_old.cpp
-@@ -0,0 +1,664 @@
-+
-+/*
-+ * Copyright 2006 The Android Open Source Project
-+ *
-+ * Use of this source code is governed by a BSD-style license that can be
-+ * found in the LICENSE file.
-+ */
-+
-+
-+#include "SkFontHost.h"
-+#include "SkDescriptor.h"
-+#include "SkMMapStream.h"
-+#include "SkPaint.h"
-+#include "SkString.h"
-+#include "SkStream.h"
-+#include "SkThread.h"
-+#include "SkTSearch.h"
-+#include <stdio.h>
-+
-+#define FONT_CACHE_MEMORY_BUDGET    (768 * 1024)
-+
-+#ifndef SK_FONT_FILE_PREFIX
-+    #define SK_FONT_FILE_PREFIX          "/fonts/"
-+#endif
-+
-+bool find_name_and_attributes(SkStream* stream, SkString* name, SkTypeface::Style* style,
-+                                           bool* isFixedWidth);
-+
-+static void GetFullPathForSysFonts(SkString* full, const char name[]) {
-+    full->set(getenv("ANDROID_ROOT"));
-+    full->append(SK_FONT_FILE_PREFIX);
-+    full->append(name);
-+}
-+
-+///////////////////////////////////////////////////////////////////////////////
-+
-+struct FamilyRec;
-+
-+/*  This guy holds a mapping of a name -> family, used for looking up fonts.
-+    Since it is stored in a stretchy array that doesn't preserve object
-+    semantics, we don't use constructor/destructors, but just have explicit
-+    helpers to manage our internal bookkeeping.
-+*/
-+struct NameFamilyPair {
-+    const char* fName;      // we own this
-+    FamilyRec*  fFamily;    // we don't own this, we just reference it
-+
-+    void construct(const char name[], FamilyRec* family) {
-+        fName = strdup(name);
-+        fFamily = family;   // we don't own this, so just record the referene
-+    }
-+
-+    void destruct() {
-+        free((char*)fName);
-+        // we don't own family, so just ignore our reference
-+    }
-+};
-+
-+// we use atomic_inc to grow this for each typeface we create
-+static int32_t gUniqueFontID;
-+
-+// this is the mutex that protects these globals
-+static SkMutex gFamilyMutex;
-+static FamilyRec* gFamilyHead;
-+static SkTDArray<NameFamilyPair> gNameList;
-+
-+struct FamilyRec {
-+    FamilyRec*  fNext;
-+    SkTypeface* fFaces[4];
-+
-+    FamilyRec()
-+    {
-+        fNext = gFamilyHead;
-+        memset(fFaces, 0, sizeof(fFaces));
-+        gFamilyHead = this;
-+    }
-+};
-+
-+static SkTypeface* find_best_face(const FamilyRec* family,
-+                                  SkTypeface::Style style) {
-+    SkTypeface* const* faces = family->fFaces;
-+
-+    if (faces[style] != NULL) { // exact match
-+        return faces[style];
-+    }
-+    // look for a matching bold
-+    style = (SkTypeface::Style)(style ^ SkTypeface::kItalic);
-+    if (faces[style] != NULL) {
-+        return faces[style];
-+    }
-+    // look for the plain
-+    if (faces[SkTypeface::kNormal] != NULL) {
-+        return faces[SkTypeface::kNormal];
-+    }
-+    // look for anything
-+    for (int i = 0; i < 4; i++) {
-+        if (faces[i] != NULL) {
-+            return faces[i];
-+        }
-+    }
-+    // should never get here, since the faces list should not be empty
-+    SkASSERT(!"faces list is empty");
-+    return NULL;
-+}
-+
-+static FamilyRec* find_family(const SkTypeface* member) {
-+    FamilyRec* curr = gFamilyHead;
-+    while (curr != NULL) {
-+        for (int i = 0; i < 4; i++) {
-+            if (curr->fFaces[i] == member) {
-+                return curr;
-+            }
-+        }
-+        curr = curr->fNext;
-+    }
-+    return NULL;
-+}
-+
-+/*  Returns the matching typeface, or NULL. If a typeface is found, its refcnt
-+    is not modified.
-+ */
-+static SkTypeface* find_from_uniqueID(uint32_t uniqueID) {
-+    FamilyRec* curr = gFamilyHead;
-+    while (curr != NULL) {
-+        for (int i = 0; i < 4; i++) {
-+            SkTypeface* face = curr->fFaces[i];
-+            if (face != NULL && face->uniqueID() == uniqueID) {
-+                return face;
-+            }
-+        }
-+        curr = curr->fNext;
-+    }
-+    return NULL;
-+}
-+
-+/*  Remove reference to this face from its family. If the resulting family
-+    is empty (has no faces), return that family, otherwise return NULL
-+*/
-+static FamilyRec* remove_from_family(const SkTypeface* face) {
-+    FamilyRec* family = find_family(face);
-+    SkASSERT(family->fFaces[face->style()] == face);
-+    family->fFaces[face->style()] = NULL;
-+
-+    for (int i = 0; i < 4; i++) {
-+        if (family->fFaces[i] != NULL) {    // family is non-empty
-+            return NULL;
-+        }
-+    }
-+    return family;  // return the empty family
-+}
-+
-+// maybe we should make FamilyRec be doubly-linked
-+static void detach_and_delete_family(FamilyRec* family) {
-+    FamilyRec* curr = gFamilyHead;
-+    FamilyRec* prev = NULL;
-+
-+    while (curr != NULL) {
-+        FamilyRec* next = curr->fNext;
-+        if (curr == family) {
-+            if (prev == NULL) {
-+                gFamilyHead = next;
-+            } else {
-+                prev->fNext = next;
-+            }
-+            SkDELETE(family);
-+            return;
-+        }
-+        prev = curr;
-+        curr = next;
-+    }
-+    SkASSERT(!"Yikes, couldn't find family in our list to remove/delete");
-+}
-+
-+static SkTypeface* find_typeface(const char name[], SkTypeface::Style style) {
-+    NameFamilyPair* list = gNameList.begin();
-+    int             count = gNameList.count();
-+
-+    int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0]));
-+
-+    if (index >= 0) {
-+        return find_best_face(list[index].fFamily, style);
-+    }
-+    return NULL;
-+}
-+
-+static SkTypeface* find_typeface(const SkTypeface* familyMember,
-+                                 SkTypeface::Style style) {
-+    const FamilyRec* family = find_family(familyMember);
-+    return family ? find_best_face(family, style) : NULL;
-+}
-+
-+static void add_name(const char name[], FamilyRec* family) {
-+    SkAutoAsciiToLC tolc(name);
-+    name = tolc.lc();
-+
-+    NameFamilyPair* list = gNameList.begin();
-+    int             count = gNameList.count();
-+
-+    int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0]));
-+
-+    if (index < 0) {
-+        list = gNameList.insert(~index);
-+        list->construct(name, family);
-+    }
-+}
-+
-+static void remove_from_names(FamilyRec* emptyFamily)
-+{
-+#ifdef SK_DEBUG
-+    for (int i = 0; i < 4; i++) {
-+        SkASSERT(emptyFamily->fFaces[i] == NULL);
-+    }
-+#endif
-+
-+    SkTDArray<NameFamilyPair>& list = gNameList;
-+
-+    // must go backwards when removing
-+    for (int i = list.count() - 1; i >= 0; --i) {
-+        NameFamilyPair* pair = &list[i];
-+        if (pair->fFamily == emptyFamily) {
-+            pair->destruct();
-+            list.remove(i);
-+        }
-+    }
-+}
-+
-+///////////////////////////////////////////////////////////////////////////////
-+
-+class FamilyTypeface : public SkTypeface {
-+public:
-+    FamilyTypeface(Style style, bool sysFont, SkTypeface* familyMember,
-+                   bool isFixedWidth)
-+    : SkTypeface(style, sk_atomic_inc(&gUniqueFontID) + 1, isFixedWidth) {
-+        fIsSysFont = sysFont;
-+
-+        SkAutoMutexAcquire  ac(gFamilyMutex);
-+
-+        FamilyRec* rec = NULL;
-+        if (familyMember) {
-+            rec = find_family(familyMember);
-+            SkASSERT(rec);
-+        } else {
-+            rec = SkNEW(FamilyRec);
-+        }
-+        rec->fFaces[style] = this;
-+    }
-+
-+    virtual ~FamilyTypeface() {
-+        SkAutoMutexAcquire  ac(gFamilyMutex);
-+
-+        // remove us from our family. If the family is now empty, we return
-+        // that and then remove that family from the name list
-+        FamilyRec* family = remove_from_family(this);
-+        if (NULL != family) {
-+            remove_from_names(family);
-+            detach_and_delete_family(family);
-+        }
-+    }
-+
-+    bool isSysFont() const { return fIsSysFont; }
-+
-+    virtual SkStream* openStream() = 0;
-+    virtual const char* getUniqueString() const = 0;
-+    virtual const char* getFilePath() const = 0;
-+
-+private:
-+    bool    fIsSysFont;
-+
-+    typedef SkTypeface INHERITED;
-+};
-+
-+///////////////////////////////////////////////////////////////////////////////
-+
-+class StreamTypeface : public FamilyTypeface {
-+public:
-+    StreamTypeface(Style style, bool sysFont, SkTypeface* familyMember,
-+                   SkStream* stream, bool isFixedWidth)
-+    : INHERITED(style, sysFont, familyMember, isFixedWidth) {
-+        SkASSERT(stream);
-+        stream->ref();
-+        fStream = stream;
-+    }
-+    virtual ~StreamTypeface() {
-+        fStream->unref();
-+    }
-+
-+    // overrides
-+    virtual SkStream* openStream() {
-+        // we just ref our existing stream, since the caller will call unref()
-+        // when they are through
-+        fStream->ref();
-+        // must rewind each time, since the caller assumes a "new" stream
-+        fStream->rewind();
-+        return fStream;
-+    }
-+    virtual const char* getUniqueString() const { return NULL; }
-+    virtual const char* getFilePath() const { return NULL; }
-+
-+private:
-+    SkStream* fStream;
-+
-+    typedef FamilyTypeface INHERITED;
-+};
-+
-+class FileTypeface : public FamilyTypeface {
-+public:
-+    FileTypeface(Style style, bool sysFont, SkTypeface* familyMember,
-+                 const char path[], bool isFixedWidth)
-+    : INHERITED(style, sysFont, familyMember, isFixedWidth) {
-+        SkString fullpath;
-+
-+        if (sysFont) {
-+            GetFullPathForSysFonts(&fullpath, path);
-+            path = fullpath.c_str();
-+        }
-+        fPath.set(path);
-+    }
-+
-+    // overrides
-+    virtual SkStream* openStream() {
-+        SkStream* stream = SkNEW_ARGS(SkMMAPStream, (fPath.c_str()));
-+
-+        // check for failure
-+        if (stream->getLength() <= 0) {
-+            SkDELETE(stream);
-+            // maybe MMAP isn't supported. try FILE
-+            stream = SkNEW_ARGS(SkFILEStream, (fPath.c_str()));
-+            if (stream->getLength() <= 0) {
-+                SkDELETE(stream);
-+                stream = NULL;
-+            }
-+        }
-+        return stream;
-+    }
-+    virtual const char* getUniqueString() const {
-+        const char* str = strrchr(fPath.c_str(), '/');
-+        if (str) {
-+            str += 1;   // skip the '/'
-+        }
-+        return str;
-+    }
-+    virtual const char* getFilePath() const {
-+        return fPath.c_str();
-+    }
-+
-+private:
-+    SkString fPath;
-+
-+    typedef FamilyTypeface INHERITED;
-+};
-+
-+///////////////////////////////////////////////////////////////////////////////
-+///////////////////////////////////////////////////////////////////////////////
-+
-+static bool get_name_and_style(const char path[], SkString* name,
-+                               SkTypeface::Style* style,
-+                               bool* isFixedWidth, bool isExpected) {
-+    SkString        fullpath;
-+    GetFullPathForSysFonts(&fullpath, path);
-+
-+    SkMMAPStream stream(fullpath.c_str());
-+    if (stream.getLength() > 0) {
-+        find_name_and_attributes(&stream, name, style, isFixedWidth);
-+        return true;
-+    }
-+    else {
-+        SkFILEStream stream(fullpath.c_str());
-+        if (stream.getLength() > 0) {
-+            find_name_and_attributes(&stream, name, style, isFixedWidth);
-+            return true;
-+        }
-+    }
-+
-+    if (isExpected) {
-+        SkDebugf("---- failed to open <%s> as a font\n", fullpath.c_str());
-+    }
-+    return false;
-+}
-+
-+// used to record our notion of the pre-existing fonts
-+struct FontInitRec {
-+    const char*         fFileName;
-+    const char* const*  fNames;     // null-terminated list
-+};
-+
-+static const char* gSansNames[] = {
-+    "sans-serif", "arial", "helvetica", "tahoma", "verdana", NULL
-+};
-+
-+static const char* gSerifNames[] = {
-+    "serif", "times", "times new roman", "palatino", "georgia", "baskerville",
-+    "goudy", "fantasy", "cursive", "ITC Stone Serif", NULL
-+};
-+
-+static const char* gMonoNames[] = {
-+    "monospace", "courier", "courier new", "monaco", NULL
-+};
-+
-+// deliberately empty, but we use the address to identify fallback fonts
-+static const char* gFBNames[] = { NULL };
-+
-+/*  Fonts must be grouped by family, with the first font in a family having the
-+    list of names (even if that list is empty), and the following members having
-+    null for the list. The names list must be NULL-terminated
-+*/
-+static const FontInitRec gSystemFonts[] = {
-+    { "DroidSans.ttf",              gSansNames  },
-+    { "DroidSans-Bold.ttf",         NULL        },
-+    { "DroidSerif-Regular.ttf",     gSerifNames },
-+    { "DroidSerif-Bold.ttf",        NULL        },
-+    { "DroidSerif-Italic.ttf",      NULL        },
-+    { "DroidSerif-BoldItalic.ttf",  NULL        },
-+    { "DroidSansMono.ttf",          gMonoNames  },
-+    /*  These are optional, and can be ignored if not found in the file system.
-+        These are appended to gFallbackFonts[] as they are seen, so we list
-+        them in the order we want them to be accessed by NextLogicalFont().
-+     */
-+    { "DroidSansArabic.ttf",        gFBNames    },
-+    { "DroidSansHebrew.ttf",        gFBNames    },
-+    { "DroidSansThai.ttf",          gFBNames    },
-+    { "MTLmr3m.ttf",                gFBNames    }, // Motoya Japanese Font
-+    { "MTLc3m.ttf",                 gFBNames    }, // Motoya Japanese Font
-+    { "DroidSansJapanese.ttf",      gFBNames    },
-+    { "DroidSansFallback.ttf",      gFBNames    }
-+};
-+
-+#define DEFAULT_NAMES   gSansNames
-+
-+// these globals are assigned (once) by load_system_fonts()
-+static FamilyRec* gDefaultFamily;
-+static SkTypeface* gDefaultNormal;
-+
-+/*  This is sized conservatively, assuming that it will never be a size issue.
-+    It will be initialized in load_system_fonts(), and will be filled with the
-+    fontIDs that can be used for fallback consideration, in sorted order (sorted
-+    meaning element[0] should be used first, then element[1], etc. When we hit
-+    a fontID==0 in the array, the list is done, hence our allocation size is
-+    +1 the total number of possible system fonts. Also see NextLogicalFont().
-+ */
-+static uint32_t gFallbackFonts[SK_ARRAY_COUNT(gSystemFonts)+1];
-+
-+/*  Called once (ensured by the sentinel check at the beginning of our body).
-+    Initializes all the globals, and register the system fonts.
-+ */
-+static void load_system_fonts() {
-+    // check if we've already be called
-+    if (NULL != gDefaultNormal) {
-+        return;
-+    }
-+
-+    const FontInitRec* rec = gSystemFonts;
-+    SkTypeface* firstInFamily = NULL;
-+    int fallbackCount = 0;
-+
-+    for (size_t i = 0; i < SK_ARRAY_COUNT(gSystemFonts); i++) {
-+        // if we're the first in a new family, clear firstInFamily
-+        if (rec[i].fNames != NULL) {
-+            firstInFamily = NULL;
-+        }
-+
-+        bool isFixedWidth;
-+        SkString name;
-+        SkTypeface::Style style;
-+
-+        // we expect all the fonts, except the "fallback" fonts
-+        bool isExpected = (rec[i].fNames != gFBNames);
-+        if (!get_name_and_style(rec[i].fFileName, &name, &style,
-+                                &isFixedWidth, isExpected)) {
-+            continue;
-+        }
-+
-+        SkTypeface* tf = SkNEW_ARGS(FileTypeface,
-+                                    (style,
-+                                     true,  // system-font (cannot delete)
-+                                     firstInFamily, // what family to join
-+                                     rec[i].fFileName,
-+                                     isFixedWidth) // filename
-+                                    );
-+
-+        if (rec[i].fNames != NULL) {
-+            // see if this is one of our fallback fonts
-+            if (rec[i].fNames == gFBNames) {
-+            //    SkDebugf("---- adding %s as fallback[%d] fontID %d\n",
-+            //             rec[i].fFileName, fallbackCount, tf->uniqueID());
-+                gFallbackFonts[fallbackCount++] = tf->uniqueID();
-+            }
-+
-+            firstInFamily = tf;
-+            FamilyRec* family = find_family(tf);
-+            const char* const* names = rec[i].fNames;
-+
-+            // record the default family if this is it
-+            if (names == DEFAULT_NAMES) {
-+                gDefaultFamily = family;
-+            }
-+            // add the names to map to this family
-+            while (*names) {
-+                add_name(*names, family);
-+                names += 1;
-+            }
-+        }
-+    }
-+
-+    // do this after all fonts are loaded. This is our default font, and it
-+    // acts as a sentinel so we only execute load_system_fonts() once
-+    gDefaultNormal = find_best_face(gDefaultFamily, SkTypeface::kNormal);
-+    // now terminate our fallback list with the sentinel value
-+    gFallbackFonts[fallbackCount] = 0;
-+}
-+
-+///////////////////////////////////////////////////////////////////////////////
-+
-+void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) {
-+    const char* name = ((FamilyTypeface*)face)->getUniqueString();
-+
-+    stream->write8((uint8_t)face->style());
-+
-+    if (NULL == name || 0 == *name) {
-+        stream->writePackedUInt(0);
-+//        SkDebugf("--- fonthost serialize null\n");
-+    } else {
-+        uint32_t len = strlen(name);
-+        stream->writePackedUInt(len);
-+        stream->write(name, len);
-+//      SkDebugf("--- fonthost serialize <%s> %d\n", name, face->style());
-+    }
-+}
-+
-+SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
-+    load_system_fonts();
-+
-+    int style = stream->readU8();
-+
-+    int len = stream->readPackedUInt();
-+    if (len > 0) {
-+        SkString str;
-+        str.resize(len);
-+        stream->read(str.writable_str(), len);
-+
-+        const FontInitRec* rec = gSystemFonts;
-+        for (size_t i = 0; i < SK_ARRAY_COUNT(gSystemFonts); i++) {
-+            if (strcmp(rec[i].fFileName, str.c_str()) == 0) {
-+                // backup until we hit the fNames
-+                for (int j = i; j >= 0; --j) {
-+                    if (rec[j].fNames != NULL) {
-+                        return SkFontHost::CreateTypeface(NULL,
-+                                    rec[j].fNames[0], (SkTypeface::Style)style);
-+                    }
-+                }
-+            }
-+        }
-+    }
-+    return NULL;
-+}
-+
-+///////////////////////////////////////////////////////////////////////////////
-+
-+SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
-+                                       const char familyName[],
-+                                       SkTypeface::Style style) {
-+    load_system_fonts();
-+
-+    SkAutoMutexAcquire  ac(gFamilyMutex);
-+
-+    // clip to legal style bits
-+    style = (SkTypeface::Style)(style & SkTypeface::kBoldItalic);
-+
-+    SkTypeface* tf = NULL;
-+
-+    if (NULL != familyFace) {
-+        tf = find_typeface(familyFace, style);
-+    } else if (NULL != familyName) {
-+//        SkDebugf("======= familyName <%s>\n", familyName);
-+        tf = find_typeface(familyName, style);
-+    }
-+
-+    if (NULL == tf) {
-+        tf = find_best_face(gDefaultFamily, style);
-+    }
-+
-+    // we ref(), since the symantic is to return a new instance
-+    tf->ref();
-+    return tf;
-+}
-+
-+SkStream* SkFontHost::OpenStream(uint32_t fontID) {
-+    SkAutoMutexAcquire  ac(gFamilyMutex);
-+
-+    FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID);
-+    SkStream* stream = tf ? tf->openStream() : NULL;
-+
-+    if (stream && stream->getLength() == 0) {
-+        stream->unref();
-+        stream = NULL;
-+    }
-+    return stream;
-+}
-+
-+size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length,
-+                               int32_t* index) {
-+    SkAutoMutexAcquire  ac(gFamilyMutex);
-+
-+    FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID);
-+    const char* src = tf ? tf->getFilePath() : NULL;
-+
-+    if (src) {
-+        size_t size = strlen(src);
-+        if (path) {
-+            memcpy(path, src, SkMin32(size, length));
-+        }
-+        if (index) {
-+            *index = 0; // we don't have collections (yet)
-+        }
-+        return size;
-+    } else {
-+        return 0;
-+    }
-+}
-+
-+SkFontID SkFontHost::NextLogicalFont(SkFontID currFontID, SkFontID origFontID) {
-+    load_system_fonts();
-+
-+    /*  First see if fontID is already one of our fallbacks. If so, return
-+        its successor. If fontID is not in our list, then return the first one
-+        in our list. Note: list is zero-terminated, and returning zero means
-+        we have no more fonts to use for fallbacks.
-+     */
-+    const uint32_t* list = gFallbackFonts;
-+    for (int i = 0; list[i] != 0; i++) {
-+        if (list[i] == currFontID) {
-+            return list[i+1];
-+        }
-+    }
-+    return list[0];
-+}
-+
-+///////////////////////////////////////////////////////////////////////////////
-+
-+SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
-+    if (NULL == stream || stream->getLength() <= 0) {
-+        return NULL;
-+    }
-+
-+    bool isFixedWidth;
-+    SkString name;
-+    SkTypeface::Style style;
-+    find_name_and_attributes(stream, &name, &style, &isFixedWidth);
-+
-+    if (!name.isEmpty()) {
-+        return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream, isFixedWidth));
-+    } else {
-+        return NULL;
-+    }
-+}
-+
-+SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) {
-+    SkStream* stream = SkNEW_ARGS(SkMMAPStream, (path));
-+    SkTypeface* face = SkFontHost::CreateTypefaceFromStream(stream);
-+    // since we created the stream, we let go of our ref() here
-+    stream->unref();
-+    return face;
-+}
-+
-+///////////////////////////////////////////////////////////////////////////////
--- 
-1.7.5.4
-
deleted file mode 100644
--- a/gfx/skia/patches/0008-Bug-687188-Skia-radial-gradients.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-From f941ea32e44a2436d235e83ef1a434289a9d9c1e Mon Sep 17 00:00:00 2001
-From: George Wright <gwright@mozilla.com>
-Date: Wed, 23 May 2012 11:40:25 -0400
-Subject: [PATCH 08/10]     Bug 755869 - [11] Re-apply bug 687188 - Skia
- radial gradients should use the 0/1 color stop values
- for clamping. r=mattwoodrow
-
----
- gfx/skia/src/effects/SkGradientShader.cpp |   76 +++++++++++++++++++++++------
- 1 files changed, 61 insertions(+), 15 deletions(-)
-
-diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp
-index 59ba48c..ea05a39 100644
---- a/gfx/skia/src/effects/SkGradientShader.cpp
-+++ b/gfx/skia/src/effects/SkGradientShader.cpp
-@@ -204,6 +204,7 @@ private:
-     mutable SkMallocPixelRef* fCache32PixelRef;
-     mutable unsigned    fCacheAlpha;        // the alpha value we used when we computed the cache. larger than 8bits so we can store uninitialized value
- 
-+    static SkPMColor PremultiplyColor(SkColor c0, U8CPU alpha);
-     static void Build16bitCache(uint16_t[], SkColor c0, SkColor c1, int count);
-     static void Build32bitCache(SkPMColor[], SkColor c0, SkColor c1, int count,
-                                 U8CPU alpha);
-@@ -507,6 +508,21 @@ static inline U8CPU dither_ceil_fixed_to_8(SkFixed n) {
-     return ((n << 1) - (n | (n >> 8))) >> 8;
- }
- 
-+SkPMColor Gradient_Shader::PremultiplyColor(SkColor c0, U8CPU paintAlpha)
-+{
-+    SkFixed a = SkMulDiv255Round(SkColorGetA(c0), paintAlpha);
-+    SkFixed r = SkColorGetR(c0);
-+    SkFixed g = SkColorGetG(c0);
-+    SkFixed b = SkColorGetB(c0);
-+
-+    a = SkIntToFixed(a) + 0x8000;
-+    r = SkIntToFixed(r) + 0x8000;
-+    g = SkIntToFixed(g) + 0x8000;
-+    b = SkIntToFixed(b) + 0x8000;
-+
-+    return SkPremultiplyARGBInline(a >> 16, r >> 16, g >> 16, b >> 16);
-+}
-+
- void Gradient_Shader::Build32bitCache(SkPMColor cache[], SkColor c0, SkColor c1,
-                                       int count, U8CPU paintAlpha) {
-     SkASSERT(count > 1);
-@@ -628,14 +644,14 @@ static void complete_32bit_cache(SkPMColor* cache, int stride) {
- const SkPMColor* Gradient_Shader::getCache32() const {
-     if (fCache32 == NULL) {
-         // double the count for dither entries
--        const int entryCount = kCache32Count * 2;
-+        const int entryCount = kCache32Count * 2 + 2;
-         const size_t allocSize = sizeof(SkPMColor) * entryCount;
- 
-         if (NULL == fCache32PixelRef) {
-             fCache32PixelRef = SkNEW_ARGS(SkMallocPixelRef,
-                                           (NULL, allocSize, NULL));
-         }
--        fCache32 = (SkPMColor*)fCache32PixelRef->getAddr();
-+        fCache32 = (SkPMColor*)fCache32PixelRef->getAddr() + 1;
-         if (fColorCount == 2) {
-             Build32bitCache(fCache32, fOrigColors[0], fOrigColors[1],
-                             kGradient32Length, fCacheAlpha);
-@@ -659,7 +675,7 @@ const SkPMColor* Gradient_Shader::getCache32() const {
-             SkMallocPixelRef* newPR = SkNEW_ARGS(SkMallocPixelRef,
-                                                  (NULL, allocSize, NULL));
-             SkPMColor* linear = fCache32;           // just computed linear data
--            SkPMColor* mapped = (SkPMColor*)newPR->getAddr();    // storage for mapped data
-+            SkPMColor* mapped = (SkPMColor*)newPR->getAddr() + 1;    // storage for mapped data
-             SkUnitMapper* map = fMapper;
-             for (int i = 0; i < kGradient32Length; i++) {
-                 int index = map->mapUnit16((i << 8) | i) >> 8;
-@@ -668,10 +684,13 @@ const SkPMColor* Gradient_Shader::getCache32() const {
-             }
-             fCache32PixelRef->unref();
-             fCache32PixelRef = newPR;
--            fCache32 = (SkPMColor*)newPR->getAddr();
-+            fCache32 = (SkPMColor*)newPR->getAddr() + 1;
-         }
-         complete_32bit_cache(fCache32, kCache32Count);
-     }
-+    //Write the clamp colours into the first and last entries of fCache32
-+    fCache32[-1] = PremultiplyColor(fOrigColors[0], fCacheAlpha);
-+    fCache32[kCache32Count * 2] = PremultiplyColor(fOrigColors[fColorCount - 1], fCacheAlpha);
-     return fCache32;
- }
- 
-@@ -857,6 +876,18 @@ void shadeSpan_linear_vertical(TileProc proc, SkFixed dx, SkFixed fx,
-                                SkPMColor* SK_RESTRICT dstC,
-                                const SkPMColor* SK_RESTRICT cache,
-                                int toggle, int count) {
-+    if (proc == clamp_tileproc) {
-+        // Read out clamp values from beginning/end of the cache. No need to lerp
-+        // or dither
-+        if (fx < 0) {
-+            sk_memset32(dstC, cache[-1], count);
-+            return;
-+        } else if (fx > 0xFFFF) {
-+            sk_memset32(dstC, cache[Gradient_Shader::kCache32Count * 2], count);
-+            return;
-+        }
-+    }
-+
-     // We're a vertical gradient, so no change in a span.
-     // If colors change sharply across the gradient, dithering is
-     // insufficient (it subsamples the color space) and we need to lerp.
-@@ -875,6 +906,18 @@ void shadeSpan_linear_vertical_lerp(TileProc proc, SkFixed dx, SkFixed fx,
-                                     SkPMColor* SK_RESTRICT dstC,
-                                     const SkPMColor* SK_RESTRICT cache,
-                                     int toggle, int count) {
-+    if (proc == clamp_tileproc) {
-+        // Read out clamp values from beginning/end of the cache. No need to lerp
-+        // or dither
-+        if (fx < 0) {
-+            sk_memset32(dstC, cache[-1], count);
-+            return;
-+        } else if (fx > 0xFFFF) {
-+            sk_memset32(dstC, cache[Gradient_Shader::kCache32Count * 2], count);
-+            return;
-+        }
-+    }
-+
-     // We're a vertical gradient, so no change in a span.
-     // If colors change sharply across the gradient, dithering is
-     // insufficient (it subsamples the color space) and we need to lerp.
-@@ -900,10 +943,8 @@ void shadeSpan_linear_clamp(TileProc proc, SkFixed dx, SkFixed fx,
-     range.init(fx, dx, count, 0, Gradient_Shader::kGradient32Length);
- 
-     if ((count = range.fCount0) > 0) {
--        sk_memset32_dither(dstC,
--            cache[toggle + range.fV0],
--            cache[(toggle ^ Gradient_Shader::kDitherStride32) + range.fV0],
--            count);
-+        // Shouldn't be any need to dither for clamping?
-+        sk_memset32(dstC, cache[-1], count);
-         dstC += count;
-     }
-     if ((count = range.fCount1) > 0) {
-@@ -922,10 +963,8 @@ void shadeSpan_linear_clamp(TileProc proc, SkFixed dx, SkFixed fx,
-         }
-     }
-     if ((count = range.fCount2) > 0) {
--        sk_memset32_dither(dstC,
--            cache[toggle + range.fV1],
--            cache[(toggle ^ Gradient_Shader::kDitherStride32) + range.fV1],
--            count);
-+        // Shouldn't be any need to dither for clamping?
-+        sk_memset32(dstC, cache[Gradient_Shader::kCache32Count * 2], count);
-     }
- }
- 
-@@ -1796,9 +1835,16 @@ void shadeSpan_twopoint_clamp(SkScalar fx, SkScalar dx,
-     for (; count > 0; --count) {
-         SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
-                                      fOneOverTwoA, posRoot);
--        SkFixed index = SkClampMax(t, 0xFFFF);
--        SkASSERT(index <= 0xFFFF);
--        *dstC++ = cache[index >> Gradient_Shader::kCache32Shift];
-+
-+        if (t < 0) {
-+            *dstC++ = cache[-1];
-+        } else if (t > 0xFFFF) {
-+            *dstC++ = cache[Gradient_Shader::kCache32Count * 2];
-+        } else {
-+            SkASSERT(t <= 0xFFFF);
-+            *dstC++ = cache[t >> Gradient_Shader::kCache32Shift];
-+        }
-+
-         fx += dx;
-         fy += dy;
-         b += db;
--- 
-1.7.5.4
-
deleted file mode 100644
--- a/gfx/skia/patches/0009-Bug-755869-FreeBSD-Hurd.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From df3be24040f7cb2f9c7ed86ad3e47206630e885f Mon Sep 17 00:00:00 2001
-From: George Wright <gwright@mozilla.com>
-Date: Wed, 23 May 2012 14:49:57 -0400
-Subject: [PATCH 09/10]     Bug 755869 - [12] Re-apply bug 749533 - Add
- support for GNU/kFreeBSD and Hurd in Skia.
- r=mattwoodrow
-
----
- gfx/skia/include/core/SkPreConfig.h |    3 ++-
- 1 files changed, 2 insertions(+), 1 deletions(-)
-
-diff --git a/gfx/skia/include/core/SkPreConfig.h b/gfx/skia/include/core/SkPreConfig.h
-index 46c6929..16c4d6c 100644
---- a/gfx/skia/include/core/SkPreConfig.h
-+++ b/gfx/skia/include/core/SkPreConfig.h
-@@ -35,7 +35,8 @@
-     #elif defined(ANDROID)
-         #define SK_BUILD_FOR_ANDROID
-     #elif defined(linux) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
--          defined(__sun) || defined(__NetBSD__) || defined(__DragonFly__)
-+          defined(__sun) || defined(__NetBSD__) || defined(__DragonFly__) || \
-+          defined(__GLIBC__) || defined(__GNU__)
-         #define SK_BUILD_FOR_UNIX
-     #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
-         #define SK_BUILD_FOR_IOS
--- 
-1.7.5.4
-
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/0009-Bug-777614-Re-apply-759683-Handle-compilers-that-don.patch
@@ -0,0 +1,40 @@
+From 2c5a8cebc806ed287ce7c3723ea64a233266cd9e Mon Sep 17 00:00:00 2001
+From: George Wright <gw@gwright.org.uk>
+Date: Thu, 13 Sep 2012 14:55:33 -0400
+Subject: [PATCH 9/9] Bug 777614 - Re-apply 759683 - Handle compilers that
+ don't support SSSE3 intrinsics r=nrc
+
+---
+ gfx/skia/src/opts/opts_check_SSE2.cpp | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/gfx/skia/src/opts/opts_check_SSE2.cpp b/gfx/skia/src/opts/opts_check_SSE2.cpp
+index 96d0dea..add6d5f 100644
+--- a/gfx/skia/src/opts/opts_check_SSE2.cpp
++++ b/gfx/skia/src/opts/opts_check_SSE2.cpp
+@@ -86,9 +86,13 @@ static inline bool hasSSSE3() {
+ #else
+ 
+ static inline bool hasSSSE3() {
++#if defined(SK_BUILD_SSSE3)
+     int cpu_info[4] = { 0 };
+     getcpuid(1, cpu_info);
+     return (cpu_info[2] & 0x200) != 0;
++#else
++    return false;
++#endif
+ }
+ #endif
+ 
+@@ -104,7 +108,7 @@ static bool cachedHasSSSE3() {
+ 
+ void SkBitmapProcState::platformProcs() {
+     if (cachedHasSSSE3()) {
+-#if !defined(SK_BUILD_FOR_ANDROID)
++#if !defined(SK_BUILD_FOR_ANDROID) && defined(SK_BUILD_SSSE3)
+         // Disable SSSE3 optimization for Android x86
+         if (fSampleProc32 == S32_opaque_D32_filter_DX) {
+             fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3;
+-- 
+1.7.11.4
+
deleted file mode 100644
--- a/gfx/skia/patches/0010-Bug-689069-ARM-Opts.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From dc1292fc8c2b9da900ebcac953120eaffd0d329e Mon Sep 17 00:00:00 2001
-From: George Wright <gwright@mozilla.com>
-Date: Wed, 23 May 2012 14:52:36 -0400
-Subject: [PATCH 10/10]     Bug 755869 - [13] Re-apply bug 750733 - Use
- handles in API object hooks where possible
- r=mattwoodrow
-
----
- gfx/skia/src/xml/SkJS.cpp |    4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/gfx/skia/src/xml/SkJS.cpp b/gfx/skia/src/xml/SkJS.cpp
-index f2e7a83..b2717d7 100644
---- a/gfx/skia/src/xml/SkJS.cpp
-+++ b/gfx/skia/src/xml/SkJS.cpp
-@@ -74,7 +74,7 @@ extern "C" {
- #endif
- 
- static JSBool
--global_enumerate(JSContext *cx, JSObject *obj)
-+global_enumerate(JSContext *cx, JSHandleObject *obj)
- {
- #ifdef LAZY_STANDARD_CLASSES
-     return JS_EnumerateStandardClasses(cx, obj);
-@@ -84,7 +84,7 @@ global_enumerate(JSContext *cx, JSObject *obj)
- }
- 
- static JSBool
--global_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp)
-+global_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, JSObject **objp)
- {
- #ifdef LAZY_STANDARD_CLASSES
-     if ((flags & JSRESOLVE_ASSIGNING) == 0) {
--- 
-1.7.5.4
-
deleted file mode 100644
--- a/gfx/skia/patches/0011-Bug-719575-Fix-clang-build.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From cf855f31194ff071f2c787a7413d70a43f15f204 Mon Sep 17 00:00:00 2001
-From: Ehsan Akhgari <ehsan@mozilla.com>
-Date: Tue, 29 May 2012 15:39:55 -0400
-Subject: [PATCH] Bug 755869 - Re-apply patch from bug 719575 to fix clang
- builds for the new Skia r=gw280
-
----
- gfx/skia/src/ports/SkFontHost_mac_coretext.cpp |    4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp b/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
-index c43d1a6..ce5f409 100644
---- a/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
-+++ b/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
-@@ -807,8 +807,8 @@ CGRGBPixel* Offscreen::getCG(const SkScalerContext_Mac& context, const SkGlyph&
- void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkIPoint* offset) const {
-     CGSize vertOffset;
-     CTFontGetVerticalTranslationsForGlyphs(fCTVerticalFont, &glyphID, &vertOffset, 1);
--    const SkPoint trans = {SkFloatToScalar(vertOffset.width),
--                           SkFloatToScalar(vertOffset.height)};
-+    const SkPoint trans = {SkScalar(SkFloatToScalar(vertOffset.width)),
-+                           SkScalar(SkFloatToScalar(vertOffset.height))};
-     SkPoint floatOffset;
-     fVerticalMatrix.mapPoints(&floatOffset, &trans, 1);
-     if (!isSnowLeopard()) {
--- 
-1.7.5.4
-
deleted file mode 100644
--- a/gfx/skia/patches/0012-Bug-759683-make-ssse3-conditional.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/gfx/skia/src/opts/opts_check_SSE2.cpp b/gfx/skia/src/opts/opts_check_SSE2.cpp
---- a/gfx/skia/src/opts/opts_check_SSE2.cpp
-+++ b/gfx/skia/src/opts/opts_check_SSE2.cpp
-@@ -91,17 +91,17 @@ static bool cachedHasSSE2() {
- 
- static bool cachedHasSSSE3() {
-     static bool gHasSSSE3 = hasSSSE3();
-     return gHasSSSE3;
- }
- 
- void SkBitmapProcState::platformProcs() {
-     if (cachedHasSSSE3()) {
--#if !defined(SK_BUILD_FOR_ANDROID)
-+#if defined(SK_BUILD_SSSE3)
-         // Disable SSSE3 optimization for Android x86
-         if (fSampleProc32 == S32_opaque_D32_filter_DX) {
-             fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3;
-         } else if (fSampleProc32 == S32_alpha_D32_filter_DX) {
-             fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3;
-         }
- 
-         if (fSampleProc32 == S32_opaque_D32_filter_DXDY) {
deleted file mode 100644
--- a/gfx/skia/patches/0013-Bug-761890-fonts.patch
+++ /dev/null
@@ -1,162 +0,0 @@
-# HG changeset patch
-# User Nicholas Cameron <ncameron@mozilla.com>
-# Date 1337146927 -43200
-# Node ID 310209abef2c2667e5de41dd2a1f071e8cd42821
-# Parent 93f3ca4d5707b2aae9c6ae52d5d29c2c802e7ef8
-Bug 746883; changes to the Skia library. r=gw280
-
-diff --git a/gfx/skia/include/core/SkDraw.h b/gfx/skia/include/core/SkDraw.h
---- a/gfx/skia/include/core/SkDraw.h
-+++ b/gfx/skia/include/core/SkDraw.h
-@@ -125,23 +125,24 @@ public:
- #endif
- };
- 
- class SkGlyphCache;
- 
- class SkTextToPathIter {
- public:
-     SkTextToPathIter(const char text[], size_t length, const SkPaint& paint,
--                     bool applyStrokeAndPathEffects);
-+                     bool applyStrokeAndPathEffects, bool useCanonicalTextSize = true);
-     ~SkTextToPathIter();
- 
-     const SkPaint&  getPaint() const { return fPaint; }
-     SkScalar        getPathScale() const { return fScale; }
- 
-     const SkPath*   next(SkScalar* xpos);   //!< returns nil when there are no more paths
-+    bool            nextWithWhitespace(const SkPath** path, SkScalar* xpos);   //!< returns false when there are no more paths
- 
- private:
-     SkGlyphCache*   fCache;
-     SkPaint         fPaint;
-     SkScalar        fScale;
-     SkFixed         fPrevAdvance;
-     const char*     fText;
-     const char*     fStop;
-diff --git a/gfx/skia/src/core/SkPaint.cpp b/gfx/skia/src/core/SkPaint.cpp
---- a/gfx/skia/src/core/SkPaint.cpp
-+++ b/gfx/skia/src/core/SkPaint.cpp
-@@ -1359,30 +1359,32 @@ void SkPaint::getPosTextPath(const void*
-                              const SkPoint pos[], SkPath* path) const {
-     SkASSERT(length == 0 || textData != NULL);
- 
-     const char* text = (const char*)textData;
-     if (text == NULL || length == 0 || path == NULL) {
-         return;
-     }
- 
--    SkTextToPathIter    iter(text, length, *this, false);
-+    SkTextToPathIter    iter(text, length, *this, false, false);
-     SkMatrix            matrix;
-     SkPoint             prevPos;
-     prevPos.set(0, 0);
- 
-     matrix.setScale(iter.getPathScale(), iter.getPathScale());
-     path->reset();
- 
-     unsigned int    i = 0;
-     const SkPath*   iterPath;
--    while ((iterPath = iter.next(NULL)) != NULL) {
--        matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY);
--        path->addPath(*iterPath, matrix);
--        prevPos = pos[i];
-+    while (iter.nextWithWhitespace(&iterPath, NULL)) {
-+        if (iterPath) {
-+            matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY);
-+            path->addPath(*iterPath, matrix);
-+            prevPos = pos[i];
-+        }
-         i++;
-     }
- }
- 
- static void add_flattenable(SkDescriptor* desc, uint32_t tag,
-                             SkFlattenableWriteBuffer* buffer) {
-     buffer->flatten(desc->addEntry(tag, buffer->size(), NULL));
- }
-@@ -2118,30 +2120,31 @@ const SkRect& SkPaint::doComputeFastBoun
- 
- static bool has_thick_frame(const SkPaint& paint) {
-     return  paint.getStrokeWidth() > 0 &&
-             paint.getStyle() != SkPaint::kFill_Style;
- }
- 
- SkTextToPathIter::SkTextToPathIter( const char text[], size_t length,
-                                     const SkPaint& paint,
--                                    bool applyStrokeAndPathEffects)
-+                                    bool applyStrokeAndPathEffects,
-+                                    bool useCanonicalTextSize)
-                                     : fPaint(paint) {
-     fGlyphCacheProc = paint.getMeasureCacheProc(SkPaint::kForward_TextBufferDirection,
-                                                 true);
- 
-     fPaint.setLinearText(true);
-     fPaint.setMaskFilter(NULL);   // don't want this affecting our path-cache lookup
- 
-     if (fPaint.getPathEffect() == NULL && !has_thick_frame(fPaint)) {
-         applyStrokeAndPathEffects = false;
-     }
- 
-     // can't use our canonical size if we need to apply patheffects
--    if (fPaint.getPathEffect() == NULL) {
-+    if (useCanonicalTextSize && fPaint.getPathEffect() == NULL) {
-         fPaint.setTextSize(SkIntToScalar(SkPaint::kCanonicalTextSizeForPaths));
-         fScale = paint.getTextSize() / SkPaint::kCanonicalTextSizeForPaths;
-         if (has_thick_frame(fPaint)) {
-             fPaint.setStrokeWidth(SkScalarDiv(fPaint.getStrokeWidth(), fScale));
-         }
-     } else {
-         fScale = SK_Scalar1;
-     }
-@@ -2185,30 +2188,47 @@ SkTextToPathIter::SkTextToPathIter( cons
-     fXYIndex = paint.isVerticalText() ? 1 : 0;
- }
- 
- SkTextToPathIter::~SkTextToPathIter() {
-     SkGlyphCache::AttachCache(fCache);
- }
- 
- const SkPath* SkTextToPathIter::next(SkScalar* xpos) {
--    while (fText < fStop) {
-+    const SkPath* result;
-+    while (nextWithWhitespace(&result, xpos)) {
-+        if (result) {
-+            if (xpos) {
-+                *xpos = fXPos;
-+            }
-+            return result;
-+        }
-+    }
-+    return NULL;
-+}
-+
-+bool SkTextToPathIter::nextWithWhitespace(const SkPath** path, SkScalar* xpos) {
-+    if (fText < fStop) {
-         const SkGlyph& glyph = fGlyphCacheProc(fCache, &fText);
- 
-         fXPos += SkScalarMul(SkFixedToScalar(fPrevAdvance + fAutoKern.adjust(glyph)), fScale);
-         fPrevAdvance = advance(glyph, fXYIndex);   // + fPaint.getTextTracking();
- 
-         if (glyph.fWidth) {
-             if (xpos) {
-                 *xpos = fXPos;
-             }
--            return fCache->findPath(glyph);
-+            *path = fCache->findPath(glyph);
-+            return true;
-+        } else {
-+            *path = NULL;
-+            return true;
-         }
-     }
--    return NULL;
-+    return false;
- }
- 
- ///////////////////////////////////////////////////////////////////////////////
- 
- bool SkPaint::nothingToDraw() const {
-     if (fLooper) {
-         return false;
-     }
deleted file mode 100644
--- a/gfx/skia/patches/0014-Bug-765038-Fix-clang-build.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-# HG changeset patch
-# Parent 9ded7a9f94a863dfa1f3227d3013367f51b8b522
-# User Nicholas Cameron <ncameron@mozilla.com>
-Bug 765038; fix a Clang compilation bug in Skia; r=jwatt
-
-diff --git a/gfx/skia/src/sfnt/SkOTTable_head.h b/gfx/skia/src/sfnt/SkOTTable_head.h
---- a/gfx/skia/src/sfnt/SkOTTable_head.h
-+++ b/gfx/skia/src/sfnt/SkOTTable_head.h
-@@ -109,18 +109,18 @@ struct SkOTTableHead {
-         } raw;
-     } macStyle;
-     SK_OT_USHORT lowestRecPPEM;
-     struct FontDirectionHint {
-         SK_TYPED_ENUM(Value, SK_OT_SHORT,
-             ((FullyMixedDirectionalGlyphs, SkTEndian_SwapBE16(0)))
-             ((OnlyStronglyLTR, SkTEndian_SwapBE16(1)))
-             ((StronglyLTR, SkTEndian_SwapBE16(2)))
--            ((OnlyStronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(-1))))
--            ((StronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(-2))))
-+            ((OnlyStronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(static_cast<SK_OT_USHORT>(-1)))))
-+            ((StronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(static_cast<SK_OT_USHORT>(-2)))))
-             SK_SEQ_END,
-         (value)SK_SEQ_END)
-     } fontDirectionHint;
-     struct IndexToLocFormat {
-         SK_TYPED_ENUM(Value, SK_OT_SHORT,
-             ((ShortOffsets, SkTEndian_SwapBE16(0)))
-             ((LongOffsets, SkTEndian_SwapBE16(1)))
-             SK_SEQ_END,
deleted file mode 100644
--- a/gfx/skia/patches/0015-Bug-766017-warnings.patch
+++ /dev/null
@@ -1,865 +0,0 @@
-From: David Zbarsky <dzbarsky@gmail.com>
-Bug 766017 - Fix some skia warnings r=gw280
-
-diff --git a/gfx/skia/include/utils/mac/SkCGUtils.h b/gfx/skia/include/utils/mac/SkCGUtils.h
---- a/gfx/skia/include/utils/mac/SkCGUtils.h
-+++ b/gfx/skia/include/utils/mac/SkCGUtils.h
-@@ -39,18 +39,16 @@ static inline CGImageRef SkCreateCGImage
- /**
-  *  Draw the bitmap into the specified CG context. The bitmap will be converted
-  *  to a CGImage using the generic RGB colorspace. (x,y) specifies the position
-  *  of the top-left corner of the bitmap. The bitmap is converted using the
-  *  colorspace returned by CGColorSpaceCreateDeviceRGB()
-  */
- void SkCGDrawBitmap(CGContextRef, const SkBitmap&, float x, float y);
- 
--bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output);
--
- /**
-  *  Return a provider that wraps the specified stream. It will become an
-  *  owner of the stream, so the caller must still manage its ownership.
-  *
-  *  To hand-off ownership of the stream to the provider, the caller must do
-  *  something like the following:
-  *
-  *  SkStream* stream = new ...;
-diff --git a/gfx/skia/src/core/SkAAClip.cpp b/gfx/skia/src/core/SkAAClip.cpp
---- a/gfx/skia/src/core/SkAAClip.cpp
-+++ b/gfx/skia/src/core/SkAAClip.cpp
-@@ -246,17 +246,17 @@ static void count_left_right_zeros(const
-             zeros = 0;
-         }
-         row += 2;
-         width -= n;
-     }
-     *riteZ = zeros;
- }
- 
--#ifdef SK_DEBUG
-+#if 0
- static void test_count_left_right_zeros() {
-     static bool gOnce;
-     if (gOnce) {
-         return;
-     }
-     gOnce = true;
- 
-     const uint8_t data0[] = {  0, 0,     10, 0xFF };
-@@ -1319,22 +1319,16 @@ bool SkAAClip::setPath(const SkPath& pat
- }
- 
- ///////////////////////////////////////////////////////////////////////////////
- 
- typedef void (*RowProc)(SkAAClip::Builder&, int bottom,
-                         const uint8_t* rowA, const SkIRect& rectA,
-                         const uint8_t* rowB, const SkIRect& rectB);
- 
--static void sectRowProc(SkAAClip::Builder& builder, int bottom,
--                        const uint8_t* rowA, const SkIRect& rectA,
--                        const uint8_t* rowB, const SkIRect& rectB) {
--    
--}
--
- typedef U8CPU (*AlphaProc)(U8CPU alphaA, U8CPU alphaB);
- 
- static U8CPU sectAlphaProc(U8CPU alphaA, U8CPU alphaB) {
-     // Multiply
-     return SkMulDiv255Round(alphaA, alphaB);
- }
- 
- static U8CPU unionAlphaProc(U8CPU alphaA, U8CPU alphaB) {
-@@ -1429,31 +1423,16 @@ private:
- static void adjust_row(RowIter& iter, int& leftA, int& riteA, int rite) {
-     if (rite == riteA) {
-         iter.next();
-         leftA = iter.left();
-         riteA = iter.right();
-     }
- }
- 
--static bool intersect(int& min, int& max, int boundsMin, int boundsMax) {
--    SkASSERT(min < max);
--    SkASSERT(boundsMin < boundsMax);
--    if (min >= boundsMax || max <= boundsMin) {
--        return false;
--    }
--    if (min < boundsMin) {
--        min = boundsMin;
--    }
--    if (max > boundsMax) {
--        max = boundsMax;
--    }
--    return true;
--}
--
- static void operatorX(SkAAClip::Builder& builder, int lastY,
-                       RowIter& iterA, RowIter& iterB,
-                       AlphaProc proc, const SkIRect& bounds) {
-     int leftA = iterA.left();
-     int riteA = iterA.right();
-     int leftB = iterB.left();
-     int riteB = iterB.right();
- 
-@@ -1970,34 +1949,33 @@ static void small_bzero(void* dst, size_
- static inline uint8_t mergeOne(uint8_t value, unsigned alpha) {
-     return SkMulDiv255Round(value, alpha);
- }
- static inline uint16_t mergeOne(uint16_t value, unsigned alpha) {
-     unsigned r = SkGetPackedR16(value);
-     unsigned g = SkGetPackedG16(value);
-     unsigned b = SkGetPackedB16(value);
-     return SkPackRGB16(SkMulDiv255Round(r, alpha),
--                       SkMulDiv255Round(r, alpha),
--                       SkMulDiv255Round(r, alpha));
-+                       SkMulDiv255Round(g, alpha),
-+                       SkMulDiv255Round(b, alpha));
- }
- static inline SkPMColor mergeOne(SkPMColor value, unsigned alpha) {
-     unsigned a = SkGetPackedA32(value);
-     unsigned r = SkGetPackedR32(value);
-     unsigned g = SkGetPackedG32(value);
-     unsigned b = SkGetPackedB32(value);
-     return SkPackARGB32(SkMulDiv255Round(a, alpha),
-                         SkMulDiv255Round(r, alpha),
-                         SkMulDiv255Round(g, alpha),
-                         SkMulDiv255Round(b, alpha));
- }
- 
- template <typename T> void mergeT(const T* SK_RESTRICT src, int srcN,
-                                  const uint8_t* SK_RESTRICT row, int rowN,
-                                  T* SK_RESTRICT dst) {
--    SkDEBUGCODE(int accumulated = 0;)
-     for (;;) {
-         SkASSERT(rowN > 0);
-         SkASSERT(srcN > 0);
-         
-         int n = SkMin32(rowN, srcN);
-         unsigned rowA = row[1];
-         if (0xFF == rowA) {
-             small_memcpy(dst, src, n * sizeof(T));
-diff --git a/gfx/skia/src/core/SkBlitMask_D32.cpp b/gfx/skia/src/core/SkBlitMask_D32.cpp
---- a/gfx/skia/src/core/SkBlitMask_D32.cpp
-+++ b/gfx/skia/src/core/SkBlitMask_D32.cpp
-@@ -268,107 +268,49 @@ bool SkBlitMask::BlitColor(const SkBitma
-         return true;
-     }
-     return false;
- }
- 
- ///////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////
- 
--static void BW_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
--                             const uint8_t* SK_RESTRICT mask,
--                             const SkPMColor* SK_RESTRICT src, int count) {
--    int i, octuple = (count + 7) >> 3;
--    for (i = 0; i < octuple; ++i) {
--        int m = *mask++;
--        if (m & 0x80) { dst[0] = SkPMSrcOver(src[0], dst[0]); }
--        if (m & 0x40) { dst[1] = SkPMSrcOver(src[1], dst[1]); }
--        if (m & 0x20) { dst[2] = SkPMSrcOver(src[2], dst[2]); }
--        if (m & 0x10) { dst[3] = SkPMSrcOver(src[3], dst[3]); }
--        if (m & 0x08) { dst[4] = SkPMSrcOver(src[4], dst[4]); }
--        if (m & 0x04) { dst[5] = SkPMSrcOver(src[5], dst[5]); }
--        if (m & 0x02) { dst[6] = SkPMSrcOver(src[6], dst[6]); }
--        if (m & 0x01) { dst[7] = SkPMSrcOver(src[7], dst[7]); }
--        src += 8;
--        dst += 8;
--    }
--    count &= 7;
--    if (count > 0) {
--        int m = *mask;
--        do {
--            if (m & 0x80) { dst[0] = SkPMSrcOver(src[0], dst[0]); }
--            m <<= 1;
--            src += 1;
--            dst += 1;
--        } while (--count > 0);
--    }
--}
--
--static void BW_RowProc_Opaque(SkPMColor* SK_RESTRICT dst,
--                              const uint8_t* SK_RESTRICT mask,
--                              const SkPMColor* SK_RESTRICT src, int count) {
--    int i, octuple = (count + 7) >> 3;
--    for (i = 0; i < octuple; ++i) {
--        int m = *mask++;
--        if (m & 0x80) { dst[0] = src[0]; }
--        if (m & 0x40) { dst[1] = src[1]; }
--        if (m & 0x20) { dst[2] = src[2]; }
--        if (m & 0x10) { dst[3] = src[3]; }
--        if (m & 0x08) { dst[4] = src[4]; }
--        if (m & 0x04) { dst[5] = src[5]; }
--        if (m & 0x02) { dst[6] = src[6]; }
--        if (m & 0x01) { dst[7] = src[7]; }
--        src += 8;
--        dst += 8;
--    }
--    count &= 7;
--    if (count > 0) {
--        int m = *mask;
--        do {
--            if (m & 0x80) { dst[0] = SkPMSrcOver(src[0], dst[0]); }
--            m <<= 1;
--            src += 1;
--            dst += 1;
--        } while (--count > 0);
--    }
--}
--
- static void A8_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
-                              const uint8_t* SK_RESTRICT mask,
-                              const SkPMColor* SK_RESTRICT src, int count) {
-     for (int i = 0; i < count; ++i) {
-         if (mask[i]) {
-             dst[i] = SkBlendARGB32(src[i], dst[i], mask[i]);
-         }
-     }
- }
- 
- // expand the steps that SkAlphaMulQ performs, but this way we can
--//  exand.. add.. combine
-+//  expand.. add.. combine
- // instead of
- // expand..combine add expand..combine
- //
- #define EXPAND0(v, m, s)    ((v) & (m)) * (s)
- #define EXPAND1(v, m, s)    (((v) >> 8) & (m)) * (s)
- #define COMBINE(e0, e1, m)  ((((e0) >> 8) & (m)) | ((e1) & ~(m)))
- 
- static void A8_RowProc_Opaque(SkPMColor* SK_RESTRICT dst,
-                               const uint8_t* SK_RESTRICT mask,
-                               const SkPMColor* SK_RESTRICT src, int count) {
--    const uint32_t rbmask = gMask_00FF00FF;
-     for (int i = 0; i < count; ++i) {
-         int m = mask[i];
-         if (m) {
-             m += (m >> 7);
- #if 1
-             // this is slightly slower than the expand/combine version, but it
-             // is much closer to the old results, so we use it for now to reduce
-             // rebaselining.
-             dst[i] = SkAlphaMulQ(src[i], m) + SkAlphaMulQ(dst[i], 256 - m);
- #else
-+            const uint32_t rbmask = gMask_00FF00FF;
-             uint32_t v = src[i];
-             uint32_t s0 = EXPAND0(v, rbmask, m);
-             uint32_t s1 = EXPAND1(v, rbmask, m);
-             v = dst[i];
-             uint32_t d0 = EXPAND0(v, rbmask, m);
-             uint32_t d1 = EXPAND1(v, rbmask, m);
-             dst[i] = COMBINE(s0 + d0, s1 + d1, rbmask);
- #endif
-@@ -559,17 +501,17 @@ SkBlitMask::RowProc SkBlitMask::RowFacto
- // make this opt-in until chrome can rebaseline
-     RowProc proc = PlatformRowProcs(config, format, flags);
-     if (proc) {
-         return proc;
-     }
- 
-     static const RowProc gProcs[] = {
-         // need X coordinate to handle BW
--        NULL, NULL, //(RowProc)BW_RowProc_Blend,      (RowProc)BW_RowProc_Opaque,
-+        NULL, NULL,
-         (RowProc)A8_RowProc_Blend,      (RowProc)A8_RowProc_Opaque,
-         (RowProc)LCD16_RowProc_Blend,   (RowProc)LCD16_RowProc_Opaque,
-         (RowProc)LCD32_RowProc_Blend,   (RowProc)LCD32_RowProc_Opaque,
-     };
- 
-     int index;
-     switch (config) {
-         case SkBitmap::kARGB_8888_Config:
-diff --git a/gfx/skia/src/core/SkConcaveToTriangles.cpp b/gfx/skia/src/core/SkConcaveToTriangles.cpp
---- a/gfx/skia/src/core/SkConcaveToTriangles.cpp
-+++ b/gfx/skia/src/core/SkConcaveToTriangles.cpp
-@@ -37,17 +37,16 @@
- #include "SkTDArray.h"
- #include "SkGeometry.h"
- #include "SkTSort.h"
- 
- // This is used to prevent runaway code bugs, and can probably be removed after
- // the code has been proven robust.
- #define kMaxCount 1000
- 
--#define DEBUG
- #ifdef DEBUG
- //------------------------------------------------------------------------------
- // Debugging support
- //------------------------------------------------------------------------------
- 
- #include <cstdio>
- #include <stdarg.h>
- 
-diff --git a/gfx/skia/src/core/SkPath.cpp b/gfx/skia/src/core/SkPath.cpp
---- a/gfx/skia/src/core/SkPath.cpp
-+++ b/gfx/skia/src/core/SkPath.cpp
-@@ -469,17 +469,16 @@ void SkPath::incReserve(U16CPU inc) {
-     fPts.setReserve(fPts.count() + inc);
- 
-     SkDEBUGCODE(this->validate();)
- }
- 
- void SkPath::moveTo(SkScalar x, SkScalar y) {
-     SkDEBUGCODE(this->validate();)
- 
--    int      vc = fVerbs.count();
-     SkPoint* pt;
- 
-     // remember our index
-     fLastMoveToIndex = fPts.count();
- 
-     pt = fPts.append();
-     *fVerbs.append() = kMove_Verb;
-     pt->set(x, y);
-@@ -1163,17 +1162,16 @@ void SkPath::reversePathTo(const SkPath&
-         }
-         pts -= gPtsInVerb[verbs[i]];
-     }
- }
- 
- void SkPath::reverseAddPath(const SkPath& src) {
-     this->incReserve(src.fPts.count());
- 
--    const SkPoint* startPts = src.fPts.begin();
-     const SkPoint* pts = src.fPts.end();
-     const uint8_t* startVerbs = src.fVerbs.begin();
-     const uint8_t* verbs = src.fVerbs.end();
- 
-     fIsOval = false;
- 
-     bool needMove = true;
-     bool needClose = false;
-diff --git a/gfx/skia/src/core/SkRegion.cpp b/gfx/skia/src/core/SkRegion.cpp
---- a/gfx/skia/src/core/SkRegion.cpp
-+++ b/gfx/skia/src/core/SkRegion.cpp
-@@ -920,20 +920,16 @@ static int operate(const SkRegion::RunTy
- /*  Given count RunTypes in a complex region, return the worst case number of
-     logical intervals that represents (i.e. number of rects that would be
-     returned from the iterator).
-  
-     We could just return count/2, since there must be at least 2 values per
-     interval, but we can first trim off the const overhead of the initial TOP
-     value, plus the final BOTTOM + 2 sentinels.
-  */
--static int count_to_intervals(int count) {
--    SkASSERT(count >= 6);   // a single rect is 6 values
--    return (count - 4) >> 1;
--}
- 
- /*  Given a number of intervals, what is the worst case representation of that
-     many intervals?
-  
-     Worst case (from a storage perspective), is a vertical stack of single
-     intervals:  TOP + N * (BOTTOM INTERVALCOUNT LEFT RIGHT SENTINEL) + SENTINEL
-  */
- static int intervals_to_count(int intervals) {
-diff --git a/gfx/skia/src/core/SkScalerContext.cpp b/gfx/skia/src/core/SkScalerContext.cpp
---- a/gfx/skia/src/core/SkScalerContext.cpp
-+++ b/gfx/skia/src/core/SkScalerContext.cpp
-@@ -336,44 +336,16 @@ SK_ERROR:
-     glyph->fTop     = 0;
-     glyph->fWidth   = 0;
-     glyph->fHeight  = 0;
-     // put a valid value here, in case it was earlier set to
-     // MASK_FORMAT_JUST_ADVANCE
-     glyph->fMaskFormat = fRec.fMaskFormat;
- }
- 
--static bool isLCD(const SkScalerContext::Rec& rec) {
--    return SkMask::kLCD16_Format == rec.fMaskFormat ||
--           SkMask::kLCD32_Format == rec.fMaskFormat;
--}
--
--static uint16_t a8_to_rgb565(unsigned a8) {
--    return SkPackRGB16(a8 >> 3, a8 >> 2, a8 >> 3);
--}
--
--static void copyToLCD16(const SkBitmap& src, const SkMask& dst) {
--    SkASSERT(SkBitmap::kA8_Config == src.config());
--    SkASSERT(SkMask::kLCD16_Format == dst.fFormat);
--
--    const int width = dst.fBounds.width();
--    const int height = dst.fBounds.height();
--    const uint8_t* srcP = src.getAddr8(0, 0);
--    size_t srcRB = src.rowBytes();
--    uint16_t* dstP = (uint16_t*)dst.fImage;
--    size_t dstRB = dst.fRowBytes;
--    for (int y = 0; y < height; ++y) {
--        for (int x = 0; x < width; ++x) {
--            dstP[x] = a8_to_rgb565(srcP[x]);
--        }
--        srcP += srcRB;
--        dstP = (uint16_t*)((char*)dstP + dstRB);
--    }
--}
--
- #define SK_FREETYPE_LCD_LERP    160
- 
- static int lerp(int start, int end) {
-     SkASSERT((unsigned)SK_FREETYPE_LCD_LERP <= 256);
-     return start + ((end - start) * (SK_FREETYPE_LCD_LERP) >> 8);
- }
- 
- static uint16_t packLCD16(unsigned r, unsigned g, unsigned b) {
-diff --git a/gfx/skia/src/core/SkScan_AntiPath.cpp b/gfx/skia/src/core/SkScan_AntiPath.cpp
---- a/gfx/skia/src/core/SkScan_AntiPath.cpp
-+++ b/gfx/skia/src/core/SkScan_AntiPath.cpp
-@@ -230,52 +230,16 @@ void SuperBlitter::blitH(int x, int y, i
-                          fOffsetX);
- 
- #ifdef SK_DEBUG
-     fRuns.assertValid(y & MASK, (1 << (8 - SHIFT)));
-     fCurrX = x + width;
- #endif
- }
- 
--static void set_left_rite_runs(SkAlphaRuns& runs, int ileft, U8CPU leftA,
--                               int n, U8CPU riteA) {
--    SkASSERT(leftA <= 0xFF);
--    SkASSERT(riteA <= 0xFF);
--
--    int16_t* run = runs.fRuns;
--    uint8_t* aa = runs.fAlpha;
--
--    if (ileft > 0) {
--        run[0] = ileft;
--        aa[0] = 0;
--        run += ileft;
--        aa += ileft;
--    }
--
--    SkASSERT(leftA < 0xFF);
--    if (leftA > 0) {
--        *run++ = 1;
--        *aa++ = leftA;
--    }
--
--    if (n > 0) {
--        run[0] = n;
--        aa[0] = 0xFF;
--        run += n;
--        aa += n;
--    }
--
--    SkASSERT(riteA < 0xFF);
--    if (riteA > 0) {
--        *run++ = 1;
--        *aa++ = riteA;
--    }
--    run[0] = 0;
--}
--
- void SuperBlitter::blitRect(int x, int y, int width, int height) {
-     SkASSERT(width > 0);
-     SkASSERT(height > 0);
- 
-     // blit leading rows
-     while ((y & MASK)) {
-         this->blitH(x, y++, width);
-         if (--height <= 0) {
-diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp
---- a/gfx/skia/src/effects/SkGradientShader.cpp
-+++ b/gfx/skia/src/effects/SkGradientShader.cpp
-@@ -865,45 +865,16 @@ bool Linear_Gradient::setContext(const S
-     } while (0)
- 
- namespace {
- 
- typedef void (*LinearShadeProc)(TileProc proc, SkFixed dx, SkFixed fx,
-                                 SkPMColor* dstC, const SkPMColor* cache,
-                                 int toggle, int count);
- 
--// This function is deprecated, and will be replaced by 
--// shadeSpan_linear_vertical_lerp() once Chrome has been weaned off of it.
--void shadeSpan_linear_vertical(TileProc proc, SkFixed dx, SkFixed fx,
--                               SkPMColor* SK_RESTRICT dstC,
--                               const SkPMColor* SK_RESTRICT cache,
--                               int toggle, int count) {
--    if (proc == clamp_tileproc) {
--        // Read out clamp values from beginning/end of the cache. No need to lerp
--        // or dither
--        if (fx < 0) {
--            sk_memset32(dstC, cache[-1], count);
--            return;
--        } else if (fx > 0xFFFF) {
--            sk_memset32(dstC, cache[Gradient_Shader::kCache32Count * 2], count);
--            return;
--        }
--    }
--
--    // We're a vertical gradient, so no change in a span.
--    // If colors change sharply across the gradient, dithering is
--    // insufficient (it subsamples the color space) and we need to lerp.
--    unsigned fullIndex = proc(fx);
--    unsigned fi = fullIndex >> (16 - Gradient_Shader::kCache32Bits);
--    sk_memset32_dither(dstC,
--            cache[toggle + fi],
--            cache[(toggle ^ Gradient_Shader::kDitherStride32) + fi],
--            count);
--}
--
- // Linear interpolation (lerp) is unnecessary if there are no sharp
- // discontinuities in the gradient - which must be true if there are
- // only 2 colors - but it's cheap.
- void shadeSpan_linear_vertical_lerp(TileProc proc, SkFixed dx, SkFixed fx,
-                                     SkPMColor* SK_RESTRICT dstC,
-                                     const SkPMColor* SK_RESTRICT cache,
-                                     int toggle, int count) {
-     if (proc == clamp_tileproc) {
-@@ -2131,16 +2102,18 @@ protected:
-         buffer.writePoint(fCenter);
-     }
- 
- private:
-     typedef Gradient_Shader INHERITED;
-     const SkPoint fCenter;
- };
- 
-+#ifndef SK_SCALAR_IS_FLOAT 
-+
- #ifdef COMPUTE_SWEEP_TABLE
- #define PI  3.14159265
- static bool gSweepTableReady;
- static uint8_t gSweepTable[65];
- 
- /*  Our table stores precomputed values for atan: [0...1] -> [0..PI/4]
-     We scale the results to [0..32]
- */
-@@ -2168,20 +2141,23 @@ static const uint8_t gSweepTable[] = {
-     10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18,
-     19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26,
-     26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32,
-     32
- };
- static const uint8_t* build_sweep_table() { return gSweepTable; }
- #endif
- 
-+#endif
-+
- // divide numer/denom, with a bias of 6bits. Assumes numer <= denom
- // and denom != 0. Since our table is 6bits big (+1), this is a nice fit.
- // Same as (but faster than) SkFixedDiv(numer, denom) >> 10
- 
-+#ifndef SK_SCALAR_IS_FLOAT
- //unsigned div_64(int numer, int denom);
- static unsigned div_64(int numer, int denom) {
-     SkASSERT(numer <= denom);
-     SkASSERT(numer > 0);
-     SkASSERT(denom > 0);
- 
-     int nbits = SkCLZ(numer);
-     int dbits = SkCLZ(denom);
-@@ -2294,16 +2270,17 @@ static unsigned atan_0_90(SkFixed y, SkF
-         result = 64 - result;
-         // pin to 63
-         result -= result >> 6;
-     }
- 
-     SkASSERT(result <= 63);
-     return result;
- }
-+#endif
- 
- //  returns angle in a circle [0..2PI) -> [0..255]
- #ifdef SK_SCALAR_IS_FLOAT
- static unsigned SkATan2_255(float y, float x) {
-     //    static const float g255Over2PI = 255 / (2 * SK_ScalarPI);
-     static const float g255Over2PI = 40.584510488433314f;
-     
-     float result = sk_float_atan2(y, x);
-diff --git a/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp b/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp
---- a/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp
-+++ b/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp
-@@ -112,17 +112,17 @@ void BlitRect32_OpaqueWide_SSE2(SkPMColo
- }
- 
- void ColorRect32_SSE2(SkPMColor* destination,
-                       int width, int height,
-                       size_t rowBytes, uint32_t color) {
-     if (0 == height || 0 == width || 0 == color) {
-         return;
-     }
--    unsigned colorA = SkGetPackedA32(color);
-+    //unsigned colorA = SkGetPackedA32(color);
-     //if (255 == colorA) {
-         //if (width < 31) {
-             //BlitRect32_OpaqueNarrow_SSE2(destination, width, height,
-                                          //rowBytes, color);
-         //} else {
-             //BlitRect32_OpaqueWide_SSE2(destination, width, height,
-                                        //rowBytes, color);
-         //}
-diff --git a/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp b/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
---- a/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
-+++ b/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
-@@ -75,20 +75,16 @@ static CGFloat CGRectGetMinY_inline(cons
- static CGFloat CGRectGetMaxY_inline(const CGRect& rect) {
-     return rect.origin.y + rect.size.height;
- }
- 
- static CGFloat CGRectGetWidth_inline(const CGRect& rect) {
-     return rect.size.width;
- }
- 
--static CGFloat CGRectGetHeight(const CGRect& rect) {
--    return rect.size.height;
--}
--
- ///////////////////////////////////////////////////////////////////////////////
- 
- static void sk_memset_rect32(uint32_t* ptr, uint32_t value, size_t width,
-                              size_t height, size_t rowBytes) {
-     SkASSERT(width);
-     SkASSERT(width * sizeof(uint32_t) <= rowBytes);
- 
-     if (width >= 32) {
-@@ -125,28 +121,30 @@ static void sk_memset_rect32(uint32_t* p
-                 *ptr++ = value;
-             } while (--w > 0);
-             ptr = (uint32_t*)((char*)ptr + rowBytes);
-             height -= 1;
-         }
-     }
- }
- 
-+#if 0
- // Potentially this should be made (1) public (2) optimized when width is small.
- // Also might want 16 and 32 bit version
- //
- static void sk_memset_rect(void* ptr, U8CPU byte, size_t width, size_t height,
-                            size_t rowBytes) {
-     uint8_t* dst = (uint8_t*)ptr;
-     while (height) {
-         memset(dst, byte, width);
-         dst += rowBytes;
-         height -= 1;
-     }
- }
-+#endif
- 
- #include <sys/utsname.h>
- 
- typedef uint32_t CGRGBPixel;
- 
- static unsigned CGRGBPixel_getAlpha(CGRGBPixel pixel) {
-     return pixel & 0xFF;
- }
-@@ -250,23 +248,16 @@ static CGAffineTransform MatrixToCGAffin
-     return CGAffineTransformMake(ScalarToCG(matrix[SkMatrix::kMScaleX]) * sx,
-                                  -ScalarToCG(matrix[SkMatrix::kMSkewY]) * sy,
-                                  -ScalarToCG(matrix[SkMatrix::kMSkewX]) * sx,
-                                  ScalarToCG(matrix[SkMatrix::kMScaleY]) * sy,
-                                  ScalarToCG(matrix[SkMatrix::kMTransX]) * sx,
-                                  ScalarToCG(matrix[SkMatrix::kMTransY]) * sy);
- }
- 
--static void CGAffineTransformToMatrix(const CGAffineTransform& xform, SkMatrix* matrix) {
--    matrix->setAll(
--                   CGToScalar(xform.a), CGToScalar(xform.c), CGToScalar(xform.tx),
--                   CGToScalar(xform.b), CGToScalar(xform.d), CGToScalar(xform.ty),
--                   0, 0, SK_Scalar1);
--}
--
- static SkScalar getFontScale(CGFontRef cgFont) {
-     int unitsPerEm = CGFontGetUnitsPerEm(cgFont);
-     return SkScalarInvert(SkIntToScalar(unitsPerEm));
- }
- 
- ///////////////////////////////////////////////////////////////////////////////
- 
- #define BITMAP_INFO_RGB     (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host)
-@@ -1075,16 +1066,17 @@ static const uint8_t* getInverseTable(bo
-     if (!gInited) {
-         build_power_table(gWhiteTable, 1.5f);
-         build_power_table(gTable, 2.2f);
-         gInited = true;
-     }
-     return isWhite ? gWhiteTable : gTable;
- }
- 
-+#ifdef SK_USE_COLOR_LUMINANCE
- static const uint8_t* getGammaTable(U8CPU luminance) {
-     static uint8_t gGammaTables[4][256];
-     static bool gInited;
-     if (!gInited) {
- #if 1
-         float start = 1.1;
-         float stop = 2.1;
-         for (int i = 0; i < 4; ++i) {
-@@ -1097,45 +1089,49 @@ static const uint8_t* getGammaTable(U8CP
-         build_power_table(gGammaTables[2], 1);
-         build_power_table(gGammaTables[3], 1);
- #endif
-         gInited = true;
-     }
-     SkASSERT(0 == (luminance >> 8));
-     return gGammaTables[luminance >> 6];
- }
-+#endif
- 
-+#ifndef SK_USE_COLOR_LUMINANCE
- static void invertGammaMask(bool isWhite, CGRGBPixel rgb[], int width,
-                             int height, size_t rb) {
-     const uint8_t* table = getInverseTable(isWhite);
-     for (int y = 0; y < height; ++y) {
-         for (int x = 0; x < width; ++x) {
-             uint32_t c = rgb[x];
-             int r = (c >> 16) & 0xFF;
-             int g = (c >>  8) & 0xFF;
-             int b = (c >>  0) & 0xFF;
-             rgb[x] = (table[r] << 16) | (table[g] << 8) | table[b];
-         }
-         rgb = (CGRGBPixel*)((char*)rgb + rb);
-     }
- }
-+#endif
- 
- static void cgpixels_to_bits(uint8_t dst[], const CGRGBPixel src[], int count) {
-     while (count > 0) {
-         uint8_t mask = 0;
-         for (int i = 7; i >= 0; --i) {
-             mask |= (CGRGBPixel_getAlpha(*src++) >> 7) << i;
-             if (0 == --count) {
-                 break;
-             }
-         }
-         *dst++ = mask;
-     }
- }
- 
-+#ifdef SK_USE_COLOR_LUMINANCE
- static int lerpScale(int dst, int src, int scale) {
-     return dst + (scale * (src - dst) >> 23);
- }
- 
- static CGRGBPixel lerpPixel(CGRGBPixel dst, CGRGBPixel src,
-                             int scaleR, int scaleG, int scaleB) {
-     int sr = (src >> 16) & 0xFF;
-     int sg = (src >>  8) & 0xFF;
-@@ -1147,37 +1143,31 @@ static CGRGBPixel lerpPixel(CGRGBPixel d
-     int rr = lerpScale(dr, sr, scaleR);
-     int rg = lerpScale(dg, sg, scaleG);
-     int rb = lerpScale(db, sb, scaleB);
-     return (rr << 16) | (rg << 8) | rb;
- }
- 
- static void lerpPixels(CGRGBPixel dst[], const CGRGBPixel src[], int width,
-                        int height, int rowBytes, int lumBits) {
--#ifdef SK_USE_COLOR_LUMINANCE
-     int scaleR = (1 << 23) * SkColorGetR(lumBits) / 0xFF;
-     int scaleG = (1 << 23) * SkColorGetG(lumBits) / 0xFF;
-     int scaleB = (1 << 23) * SkColorGetB(lumBits) / 0xFF;
--#else
--    int scale = (1 << 23) * lumBits / SkScalerContext::kLuminance_Max;
--    int scaleR = scale;
--    int scaleG = scale;
--    int scaleB = scale;
--#endif
- 
-     for (int y = 0; y < height; ++y) {
-         for (int x = 0; x < width; ++x) {
-             // bit-not the src, since it was drawn from black, so we need the
-             // compliment of those bits
-             dst[x] = lerpPixel(dst[x], ~src[x], scaleR, scaleG, scaleB);
-         }
-         src = (CGRGBPixel*)((char*)src + rowBytes);
-         dst = (CGRGBPixel*)((char*)dst + rowBytes);
-     }
- }
-+#endif
- 
- #if 1
- static inline int r32_to_16(int x) { return SkR32ToR16(x); }
- static inline int g32_to_16(int x) { return SkG32ToG16(x); }
- static inline int b32_to_16(int x) { return SkB32ToB16(x); }
- #else
- static inline int round8to5(int x) {
-     return (x + 3 - (x >> 5) + (x >> 7)) >> 3;
-@@ -1212,22 +1202,21 @@ static inline uint32_t rgb_to_lcd32(CGRG
-     return SkPackARGB32(0xFF, r, g, b);
- }
- 
- #define BLACK_LUMINANCE_LIMIT   0x40
- #define WHITE_LUMINANCE_LIMIT   0xA0
- 
- void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) {
-     CGGlyph cgGlyph = (CGGlyph) glyph.getGlyphID(fBaseGlyphCount);
--
-     const bool isLCD = isLCDFormat(glyph.fMaskFormat);
-+#ifdef SK_USE_COLOR_LUMINANCE
-     const bool isBW = SkMask::kBW_Format == glyph.fMaskFormat;
-     const bool isA8 = !isLCD && !isBW;
--    
--#ifdef SK_USE_COLOR_LUMINANCE
-+
-     unsigned lumBits = fRec.getLuminanceColor();
-     uint32_t xorMask = 0;
- 
-     if (isA8) {
-         // for A8, we just want a component (they're all the same)
-         lumBits = SkColorGetR(lumBits);
-     }
- #else
-diff --git a/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp b/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp
---- a/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp
-+++ b/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp
-@@ -163,59 +163,8 @@ private:
-     CGPDFDocumentRef fDoc;
- };
- 
- static void CGDataProviderReleaseData_FromMalloc(void*, const void* data,
-                                                  size_t size) {
-     sk_free((void*)data);
- }
- 
--bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) {
--    size_t size = stream->getLength();
--    void* ptr = sk_malloc_throw(size);
--    stream->read(ptr, size);
--    CGDataProviderRef data = CGDataProviderCreateWithData(NULL, ptr, size,
--                                          CGDataProviderReleaseData_FromMalloc);
--    if (NULL == data) {
--        return false;
--    }
--    
--    CGPDFDocumentRef pdf = CGPDFDocumentCreateWithProvider(data);
--    CGDataProviderRelease(data);
--    if (NULL == pdf) {
--        return false;
--    }
--    SkAutoPDFRelease releaseMe(pdf);
--
--    CGPDFPageRef page = CGPDFDocumentGetPage(pdf, 1);
--    if (NULL == page) {
--        return false;
--    }
--    
--    CGRect bounds = CGPDFPageGetBoxRect(page, kCGPDFMediaBox);
--    
--    int w = (int)CGRectGetWidth(bounds);
--    int h = (int)CGRectGetHeight(bounds);
--        
--    SkBitmap bitmap;
--    bitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h);
--    bitmap.allocPixels();
--    bitmap.eraseColor(SK_ColorWHITE);
--
--    size_t bitsPerComponent;
--    CGBitmapInfo info;
--    getBitmapInfo(bitmap, &bitsPerComponent, &info, NULL); 
--
--    CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
--    CGContextRef ctx = CGBitmapContextCreate(bitmap.getPixels(), w, h,
--                                             bitsPerComponent, bitmap.rowBytes(),
--                                             cs, info);
--    CGColorSpaceRelease(cs);
--
--    if (ctx) {
--        CGContextDrawPDFPage(ctx, page);
--        CGContextRelease(ctx);
--    }
--
--    output->swap(bitmap);
--    return true;
--}
--
deleted file mode 100644
--- a/gfx/skia/patches/0016-Bug-718849-Radial-gradients.patch
+++ /dev/null
@@ -1,400 +0,0 @@
-# HG changeset patch
-# User Matt Woodrow <mwoodrow@mozilla.com>
-# Date 1339988782 -43200
-# Node ID 1e9dae659ee6c992f719fd4136efbcc5410ded37
-# Parent 946750f6d95febd199fb7b748e9d2c48fd01c8a6
-[mq]: skia-windows-gradients
-
-diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp
---- a/gfx/skia/src/effects/SkGradientShader.cpp
-+++ b/gfx/skia/src/effects/SkGradientShader.cpp
-@@ -847,16 +847,19 @@ bool Linear_Gradient::setContext(const S
-         fFlags |= SkShader::kConstInY32_Flag;
-         if ((fFlags & SkShader::kHasSpan16_Flag) && !paint.isDither()) {
-             // only claim this if we do have a 16bit mode (i.e. none of our
-             // colors have alpha), and if we are not dithering (which obviously
-             // is not const in Y).
-             fFlags |= SkShader::kConstInY16_Flag;
-         }
-     }
-+    if (fStart == fEnd) {
-+        fFlags &= ~kOpaqueAlpha_Flag;
-+    }
-     return true;
- }
- 
- #define NO_CHECK_ITER               \
-     do {                            \
-     unsigned fi = fx >> Gradient_Shader::kCache32Shift; \
-     SkASSERT(fi <= 0xFF);           \
-     fx += dx;                       \
-@@ -976,16 +979,21 @@ void Linear_Gradient::shadeSpan(int x, i
-     TileProc            proc = fTileProc;
-     const SkPMColor* SK_RESTRICT cache = this->getCache32();
- #ifdef USE_DITHER_32BIT_GRADIENT
-     int                 toggle = ((x ^ y) & 1) * kDitherStride32;
- #else
-     int toggle = 0;
- #endif
- 
-+    if (fStart == fEnd) {
-+        sk_bzero(dstC, count * sizeof(*dstC));
-+        return;
-+    }
-+
-     if (fDstToIndexClass != kPerspective_MatrixClass) {
-         dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf,
-                              SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
-         SkFixed dx, fx = SkScalarToFixed(srcPt.fX);
- 
-         if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
-             SkFixed dxStorage[1];
-             (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), dxStorage, NULL);
-@@ -1169,16 +1177,21 @@ void Linear_Gradient::shadeSpan16(int x,
-     SkASSERT(count > 0);
- 
-     SkPoint             srcPt;
-     SkMatrix::MapXYProc dstProc = fDstToIndexProc;
-     TileProc            proc = fTileProc;
-     const uint16_t* SK_RESTRICT cache = this->getCache16();
-     int                 toggle = ((x ^ y) & 1) * kDitherStride16;
- 
-+    if (fStart == fEnd) {
-+        sk_bzero(dstC, count * sizeof(*dstC));
-+        return;
-+    }
-+
-     if (fDstToIndexClass != kPerspective_MatrixClass) {
-         dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf,
-                              SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
-         SkFixed dx, fx = SkScalarToFixed(srcPt.fX);
- 
-         if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
-             SkFixed dxStorage[1];
-             (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), dxStorage, NULL);
-@@ -1739,21 +1752,25 @@ void Radial_Gradient::shadeSpan(int x, i
-    possible circles on which the point may fall.  Solving for t yields
-    the gradient value to use.
- 
-    If a<0, the start circle is entirely contained in the
-    end circle, and one of the roots will be <0 or >1 (off the line
-    segment).  If a>0, the start circle falls at least partially
-    outside the end circle (or vice versa), and the gradient
-    defines a "tube" where a point may be on one circle (on the
--   inside of the tube) or the other (outside of the tube).  We choose
--   one arbitrarily.
-+   inside of the tube) or the other (outside of the tube). We choose
-+   the one with the highest t value, as long as the radius that it 
-+   corresponds to is >=0. In the case where neither root has a positive
-+   radius, we don't draw anything.
- 
-+   XXXmattwoodrow: I've removed this for now since it breaks
-+   down when Dr == 0. Is there something else we can do instead?
-    In order to keep the math to within the limits of fixed point,
--   we divide the entire quadratic by Dr^2, and replace
-+   we divide the entire quadratic by Dr, and replace
-    (x - Sx)/Dr with x' and (y - Sy)/Dr with y', giving
- 
-    [Dx^2 / Dr^2 + Dy^2 / Dr^2 - 1)] * t^2
-    + 2 * [x' * Dx / Dr + y' * Dy / Dr - Sr / Dr] * t
-    + [x'^2 + y'^2 - Sr^2/Dr^2] = 0
- 
-    (x' and y' are computed by appending the subtract and scale to the
-    fDstToIndex matrix in the constructor).
-@@ -1763,99 +1780,122 @@ void Radial_Gradient::shadeSpan(int x, i
-    x' and y', if x and y are linear in the span, 'B' can be computed
-    incrementally with a simple delta (db below).  If it is not (e.g.,
-    a perspective projection), it must be computed in the loop.
- 
- */
- 
- namespace {
- 
--inline SkFixed two_point_radial(SkScalar b, SkScalar fx, SkScalar fy,
--                                SkScalar sr2d2, SkScalar foura,
--                                SkScalar oneOverTwoA, bool posRoot) {
-+inline bool two_point_radial(SkScalar b, SkScalar fx, SkScalar fy,
-+                             SkScalar sr2d2, SkScalar foura,
-+                             SkScalar oneOverTwoA, SkScalar diffRadius, 
-+                             SkScalar startRadius, SkFixed& t) {
-     SkScalar c = SkScalarSquare(fx) + SkScalarSquare(fy) - sr2d2;
-     if (0 == foura) {
--        return SkScalarToFixed(SkScalarDiv(-c, b));
-+        SkScalar result = SkScalarDiv(-c, b);
-+        if (result * diffRadius + startRadius >= 0) {
-+            t = SkScalarToFixed(result);
-+            return true;
-+        }
-+        return false;
-     }
- 
-     SkScalar discrim = SkScalarSquare(b) - SkScalarMul(foura, c);
-     if (discrim < 0) {
--        discrim = -discrim;
-+        return false;
-     }
-     SkScalar rootDiscrim = SkScalarSqrt(discrim);
--    SkScalar result;
--    if (posRoot) {
--        result = SkScalarMul(-b + rootDiscrim, oneOverTwoA);
--    } else {
--        result = SkScalarMul(-b - rootDiscrim, oneOverTwoA);
-+
-+    // Make sure the results corresponds to a positive radius.
-+    SkScalar result = SkScalarMul(-b + rootDiscrim, oneOverTwoA);
-+    if (result * diffRadius + startRadius >= 0) {
-+        t = SkScalarToFixed(result);
-+        return true;
-     }
--    return SkScalarToFixed(result);
-+    result = SkScalarMul(-b - rootDiscrim, oneOverTwoA);
-+    if (result * diffRadius + startRadius >= 0) {
-+        t = SkScalarToFixed(result);
-+        return true;
-+    }
-+
-+    return false;
- }
- 
- typedef void (* TwoPointRadialShadeProc)(SkScalar fx, SkScalar dx,
-         SkScalar fy, SkScalar dy,
-         SkScalar b, SkScalar db,
--        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA, bool posRoot,
-+        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA,
-+        SkScalar fDiffRadius, SkScalar fRadius1,
-         SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RESTRICT cache,
-         int count);
- 
- void shadeSpan_twopoint_clamp(SkScalar fx, SkScalar dx,
-         SkScalar fy, SkScalar dy,
-         SkScalar b, SkScalar db,
--        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA, bool posRoot,
-+        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA,
-+        SkScalar fDiffRadius, SkScalar fRadius1,
-         SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RESTRICT cache,
-         int count) {
-     for (; count > 0; --count) {
--        SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
--                                     fOneOverTwoA, posRoot);
--
--        if (t < 0) {
-+        SkFixed t;
-+        if (!two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, fDiffRadius, fRadius1, t)) {
-+          *(dstC++) = 0;
-+        } else if (t < 0) {
-             *dstC++ = cache[-1];
-         } else if (t > 0xFFFF) {
-             *dstC++ = cache[Gradient_Shader::kCache32Count * 2];
-         } else {
-             SkASSERT(t <= 0xFFFF);
-             *dstC++ = cache[t >> Gradient_Shader::kCache32Shift];
-         }
- 
-         fx += dx;
-         fy += dy;
-         b += db;
-     }
- }
- void shadeSpan_twopoint_mirror(SkScalar fx, SkScalar dx,
-         SkScalar fy, SkScalar dy,
-         SkScalar b, SkScalar db,
--        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA, bool posRoot,
-+        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA,
-+        SkScalar fDiffRadius, SkScalar fRadius1,
-         SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RESTRICT cache,
-         int count) {
-     for (; count > 0; --count) {
--        SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
--                                     fOneOverTwoA, posRoot);
--        SkFixed index = mirror_tileproc(t);
--        SkASSERT(index <= 0xFFFF);
--        *dstC++ = cache[index >> Gradient_Shader::kCache32Shift];
-+        SkFixed t;
-+        if (!two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, fDiffRadius, fRadius1, t)) {
-+          *(dstC++) = 0;
-+        } else {
-+          SkFixed index = mirror_tileproc(t);
-+          SkASSERT(index <= 0xFFFF);
-+          *dstC++ = cache[index >> (16 - Gradient_Shader::kCache32Shift)];
-+        }
-         fx += dx;
-         fy += dy;
-         b += db;
-     }
- }
- 
- void shadeSpan_twopoint_repeat(SkScalar fx, SkScalar dx,
-         SkScalar fy, SkScalar dy,
-         SkScalar b, SkScalar db,
--        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA, bool posRoot,
-+        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA, 
-+        SkScalar fDiffRadius, SkScalar fRadius1,
-         SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RESTRICT cache,
-         int count) {
-     for (; count > 0; --count) {
--        SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
--                                     fOneOverTwoA, posRoot);
--        SkFixed index = repeat_tileproc(t);
--        SkASSERT(index <= 0xFFFF);
--        *dstC++ = cache[index >> Gradient_Shader::kCache32Shift];
-+        SkFixed t;
-+        if (!two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, fDiffRadius, fRadius1, t)) {
-+          *(dstC++) = 0;
-+        } else {
-+          SkFixed index = repeat_tileproc(t);
-+          SkASSERT(index <= 0xFFFF);
-+          *dstC++ = cache[index >> (16 - Gradient_Shader::kCache32Shift)];
-+        }
-         fx += dx;
-         fy += dy;
-         b += db;
-     }
- }
- 
- 
- 
-@@ -1935,17 +1975,16 @@ public:
-           sk_bzero(dstC, count * sizeof(*dstC));
-           return;
-         }
-         SkMatrix::MapXYProc dstProc = fDstToIndexProc;
-         TileProc            proc = fTileProc;
-         const SkPMColor* SK_RESTRICT cache = this->getCache32();
- 
-         SkScalar foura = fA * 4;
--        bool posRoot = fDiffRadius < 0;
-         if (fDstToIndexClass != kPerspective_MatrixClass) {
-             SkPoint srcPt;
-             dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf,
-                                  SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
-             SkScalar dx, fx = srcPt.fX;
-             SkScalar dy, fy = srcPt.fY;
- 
-             if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
-@@ -1954,60 +1993,69 @@ public:
-                 dx = SkFixedToScalar(fixedX);
-                 dy = SkFixedToScalar(fixedY);
-             } else {
-                 SkASSERT(fDstToIndexClass == kLinear_MatrixClass);
-                 dx = fDstToIndex.getScaleX();
-                 dy = fDstToIndex.getSkewY();
-             }
-             SkScalar b = (SkScalarMul(fDiff.fX, fx) +
--                         SkScalarMul(fDiff.fY, fy) - fStartRadius) * 2;
-+                          SkScalarMul(fDiff.fY, fy) - fStartRadius * fDiffRadius) * 2;
-             SkScalar db = (SkScalarMul(fDiff.fX, dx) +
-                           SkScalarMul(fDiff.fY, dy)) * 2;
- 
-             TwoPointRadialShadeProc shadeProc = shadeSpan_twopoint_repeat;
-             if (proc == clamp_tileproc) {
-                 shadeProc = shadeSpan_twopoint_clamp;
-             } else if (proc == mirror_tileproc) {
-                 shadeProc = shadeSpan_twopoint_mirror;
-             } else {
-                 SkASSERT(proc == repeat_tileproc);
-             }
-             (*shadeProc)(fx, dx, fy, dy, b, db,
--                         fSr2D2, foura, fOneOverTwoA, posRoot,
-+                         fSr2D2, foura, fOneOverTwoA, fDiffRadius, fRadius1,
-                          dstC, cache, count);
-         } else {    // perspective case
-             SkScalar dstX = SkIntToScalar(x);
-             SkScalar dstY = SkIntToScalar(y);
-             for (; count > 0; --count) {
-                 SkPoint             srcPt;
-                 dstProc(fDstToIndex, dstX, dstY, &srcPt);
-                 SkScalar fx = srcPt.fX;
-                 SkScalar fy = srcPt.fY;
-                 SkScalar b = (SkScalarMul(fDiff.fX, fx) +
-                              SkScalarMul(fDiff.fY, fy) - fStartRadius) * 2;
--                SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
--                                             fOneOverTwoA, posRoot);
--                SkFixed index = proc(t);
--                SkASSERT(index <= 0xFFFF);
--                *dstC++ = cache[index >> Gradient_Shader::kCache32Shift];
-+                SkFixed t;
-+                if (!two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, fDiffRadius, fRadius1, t)) {
-+                  *(dstC++) = 0;
-+                } else {
-+                  SkFixed index = proc(t);
-+                  SkASSERT(index <= 0xFFFF);
-+                  *dstC++ = cache[index >> (16 - kCache32Bits)];
-+                }
-                 dstX += SK_Scalar1;
-             }
-         }
-     }
- 
-     virtual bool setContext(const SkBitmap& device,
-                             const SkPaint& paint,
-                             const SkMatrix& matrix) SK_OVERRIDE {
-         if (!this->INHERITED::setContext(device, paint, matrix)) {
-             return false;
-         }
- 
-         // we don't have a span16 proc
-         fFlags &= ~kHasSpan16_Flag;
-+
-+        // If we might end up wanting to draw nothing as part of the gradient
-+        // then we should mark ourselves as not being opaque.
-+        if (fA >= 0 || (fDiffRadius == 0 && fCenter1 == fCenter2)) {
-+            fFlags &= ~kOpaqueAlpha_Flag;
-+        }
-         return true;
-     }
- 
-     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Two_Point_Radial_Gradient)
- 
- protected:
-     Two_Point_Radial_Gradient(SkFlattenableReadBuffer& buffer)
-             : INHERITED(buffer),
-@@ -2033,26 +2081,22 @@ private:
-     const SkScalar fRadius1;
-     const SkScalar fRadius2;
-     SkPoint fDiff;
-     SkScalar fStartRadius, fDiffRadius, fSr2D2, fA, fOneOverTwoA;
- 
-     void init() {
-         fDiff = fCenter1 - fCenter2;
-         fDiffRadius = fRadius2 - fRadius1;
--        SkScalar inv = SkScalarInvert(fDiffRadius);
--        fDiff.fX = SkScalarMul(fDiff.fX, inv);
--        fDiff.fY = SkScalarMul(fDiff.fY, inv);
--        fStartRadius = SkScalarMul(fRadius1, inv);
-+        fStartRadius = fRadius1;
-         fSr2D2 = SkScalarSquare(fStartRadius);
--        fA = SkScalarSquare(fDiff.fX) + SkScalarSquare(fDiff.fY) - SK_Scalar1;
-+        fA = SkScalarSquare(fDiff.fX) + SkScalarSquare(fDiff.fY) - SkScalarSquare(fDiffRadius);
-         fOneOverTwoA = fA ? SkScalarInvert(fA * 2) : 0;
- 
-         fPtsToUnit.setTranslate(-fCenter1.fX, -fCenter1.fY);
--        fPtsToUnit.postScale(inv, inv);
-     }
- };
- 
- ///////////////////////////////////////////////////////////////////////////////
- 
- class Sweep_Gradient : public Gradient_Shader {
- public:
-     Sweep_Gradient(SkScalar cx, SkScalar cy, const SkColor colors[],
-@@ -2488,16 +2532,20 @@ SkShader* SkGradientShader::CreateTwoPoi
-                                                  int colorCount,
-                                                  SkShader::TileMode mode,
-                                                  SkUnitMapper* mapper) {
-     if (startRadius < 0 || endRadius < 0 || NULL == colors || colorCount < 1) {
-         return NULL;
-     }
-     EXPAND_1_COLOR(colorCount);
- 
-+    if (start == end && startRadius == 0) {
-+        return CreateRadial(start, endRadius, colors, pos, colorCount, mode, mapper);
-+    }
-+
-     return SkNEW_ARGS(Two_Point_Radial_Gradient,
-                       (start, startRadius, end, endRadius, colors, pos,
-                        colorCount, mode, mapper));
- }
- 
- SkShader* SkGradientShader::CreateSweep(SkScalar cx, SkScalar cy,
-                                         const SkColor colors[],
-                                         const SkScalar pos[],
deleted file mode 100644
--- a/gfx/skia/patches/0017-Bug-740194-SkMemory-mozalloc.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-commit 5786f516119bcb677510f3c9256b870c3b5616c8
-Author: George Wright <gwright@mozilla.com>
-Date:   Wed Aug 15 23:51:34 2012 -0400
-
-    Bug 740194 - [Skia] Implement a version of SkMemory for Mozilla that uses the infallible mozalloc allocators r=cjones
-
-diff --git a/gfx/skia/include/config/SkUserConfig.h b/gfx/skia/include/config/SkUserConfig.h
-index f98ba85..17be191 100644
---- a/gfx/skia/include/config/SkUserConfig.h
-+++ b/gfx/skia/include/config/SkUserConfig.h
-@@ -35,6 +35,16 @@
-     commented out, so including it will have no effect.
- */
- 
-+/*
-+    Override new/delete with Mozilla's allocator, mozalloc
-+
-+    Ideally we shouldn't need to do this here, but until
-+    http://code.google.com/p/skia/issues/detail?id=598 is fixed
-+    we need to include this here to override operator new and delete
-+*/
-+
-+#include "mozilla/mozalloc.h"
-+
- ///////////////////////////////////////////////////////////////////////////////
- 
- /*  Scalars (the fractional value type in skia) can be implemented either as
-diff --git a/gfx/skia/src/ports/SkMemory_mozalloc.cpp b/gfx/skia/src/ports/SkMemory_mozalloc.cpp
-new file mode 100644
-index 0000000..1f16ee5
---- /dev/null
-+++ b/gfx/skia/src/ports/SkMemory_mozalloc.cpp
-@@ -0,0 +1,40 @@
-+/*
-+ * Copyright 2011 Google Inc.
-+ * Copyright 2012 Mozilla Foundation
-+ *
-+ * Use of this source code is governed by a BSD-style license that can be
-+ * found in the LICENSE file.
-+ */
-+
-+#include "SkTypes.h"
-+
-+#include "mozilla/mozalloc.h"
-+#include "mozilla/mozalloc_abort.h"
-+#include "mozilla/mozalloc_oom.h"
-+
-+void sk_throw() {
-+    SkDEBUGFAIL("sk_throw");
-+    mozalloc_abort("Abort from sk_throw");
-+}
-+
-+void sk_out_of_memory(void) {
-+    SkDEBUGFAIL("sk_out_of_memory");
-+    mozalloc_handle_oom(0);
-+}
-+
-+void* sk_malloc_throw(size_t size) {
-+    return sk_malloc_flags(size, SK_MALLOC_THROW);
-+}
-+
-+void* sk_realloc_throw(void* addr, size_t size) {
-+    return moz_xrealloc(addr, size);
-+}
-+
-+void sk_free(void* p) {
-+    moz_free(p);
-+}
-+
-+void* sk_malloc_flags(size_t size, unsigned flags) {
-+    return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : moz_malloc(size);
-+}
-+
--- a/gfx/skia/patches/README
+++ b/gfx/skia/patches/README
@@ -1,21 +1,9 @@
 This directory contains the patches currently applied against upstream Skia.
 The original patches are archived in archive/
 
 See the relevant bugs in bugzilla for information on these patches:
 
-0001-Bug-687189-Implement-SkPaint-getPosTextPath.patch
-0002-Bug-688366-Dont-invalidate-all-radial-gradients.patch
-0003-SkUserConfig-for-Mozilla.patch
-0004-Bug-722011-Fix-trailing-commas-in-enums.patch
-0005-Bug-731384-Fix-clang-SK_OVERRIDE.patch
-0006-Bug-751814-ARM-EDSP-ARMv6-Skia-fixes.patch
-0007-Bug-719872-Old-Android-FontHost.patch
-0008-Bug-687188-Skia-radial-gradients.patch
-0009-Bug-755869-FreeBSD-Hurd.patch
-0010-Bug-689069-ARM-Opts.patch
-0011-Bug-719575-Fix-clang-build.patch
-0012-Bug-759683-make-ssse3-conditional.patch
-0013-Bug-761890-fonts.patch
-0014-Bug-765038-Fix-clang-build.patch
-0015-Bug-766017-warnings.patch
-0016-Bug-718849-Radial-Gradients.patch
+0001-Bug-777614-Re-add-our-SkUserConfig.h-r-nrc.patch
+0004-Bug-777614-Re-apply-bug-719872-Fix-crash-on-Android-.patch
+0005-Bug-777614-Re-apply-bug-687188-Expand-the-gradient-c.patch
+0009-Bug-777614-Re-apply-759683-Handle-compilers-that-don.patch
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0001-Bug-687189-Implement-SkPaint-getPosTextPath.patch
@@ -0,0 +1,66 @@
+From 27a914815e757ed12523edf968c9da134dabeaf8 Mon Sep 17 00:00:00 2001
+From: George Wright <gwright@mozilla.com>
+Date: Fri, 18 May 2012 14:10:44 -0400
+Subject: [PATCH 01/10]     Bug 755869 - [4] Re-apply bug 687189 - Implement
+ SkPaint::getPosTextPath r=mattwoodrow
+
+---
+ gfx/skia/include/core/SkPaint.h |    3 +++
+ gfx/skia/src/core/SkPaint.cpp   |   27 +++++++++++++++++++++++++++
+ 2 files changed, 30 insertions(+), 0 deletions(-)
+
+diff --git a/gfx/skia/include/core/SkPaint.h b/gfx/skia/include/core/SkPaint.h
+index 1930db1..ff37d77 100644
+--- a/gfx/skia/include/core/SkPaint.h
++++ b/gfx/skia/include/core/SkPaint.h
+@@ -813,6 +813,9 @@ public:
+     void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
+                      SkPath* path) const;
+ 
++    void getPosTextPath(const void* text, size_t length, 
++                        const SkPoint pos[], SkPath* path) const;
++
+ #ifdef SK_BUILD_FOR_ANDROID
+     const SkGlyph& getUnicharMetrics(SkUnichar);
+     const SkGlyph& getGlyphMetrics(uint16_t);
+diff --git a/gfx/skia/src/core/SkPaint.cpp b/gfx/skia/src/core/SkPaint.cpp
+index 1b74fa1..4c119aa 100644
+--- a/gfx/skia/src/core/SkPaint.cpp
++++ b/gfx/skia/src/core/SkPaint.cpp
+@@ -1355,6 +1355,33 @@ void SkPaint::getTextPath(const void* textData, size_t length,
+     }
+ }
+ 
++void SkPaint::getPosTextPath(const void* textData, size_t length,
++                             const SkPoint pos[], SkPath* path) const {
++    SkASSERT(length == 0 || textData != NULL);
++
++    const char* text = (const char*)textData;
++    if (text == NULL || length == 0 || path == NULL) {
++        return;
++    }
++
++    SkTextToPathIter    iter(text, length, *this, false);
++    SkMatrix            matrix;
++    SkPoint             prevPos;
++    prevPos.set(0, 0);
++
++    matrix.setScale(iter.getPathScale(), iter.getPathScale());
++    path->reset();
++
++    unsigned int    i = 0;
++    const SkPath*   iterPath;
++    while ((iterPath = iter.next(NULL)) != NULL) {
++        matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY);
++        path->addPath(*iterPath, matrix);
++        prevPos = pos[i];
++        i++;
++    }
++}
++
+ static void add_flattenable(SkDescriptor* desc, uint32_t tag,
+                             SkFlattenableWriteBuffer* buffer) {
+     buffer->flatten(desc->addEntry(tag, buffer->size(), NULL));
+-- 
+1.7.5.4
+
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0002-Bug-688366-Dont-invalidate-all-radial-gradients.patch
@@ -0,0 +1,30 @@
+From f310d7e8b8d9cf6870c739650324bb585b591c0c Mon Sep 17 00:00:00 2001
+From: George Wright <gwright@mozilla.com>
+Date: Fri, 18 May 2012 14:11:32 -0400
+Subject: [PATCH 02/10]     Bug 755869 - [5] Re-apply bug 688366 - Fix Skia
+ marking radial gradients with the same radius as
+ invalid. r=mattwoodrow
+
+---
+ gfx/skia/src/effects/SkGradientShader.cpp |    5 ++++-
+ 1 files changed, 4 insertions(+), 1 deletions(-)
+
+diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp
+index 6de820b..59ba48c 100644
+--- a/gfx/skia/src/effects/SkGradientShader.cpp
++++ b/gfx/skia/src/effects/SkGradientShader.cpp
+@@ -1911,7 +1911,10 @@ public:
+         SkPMColor* SK_RESTRICT dstC = dstCParam;
+ 
+         // Zero difference between radii:  fill with transparent black.
+-        if (fDiffRadius == 0) {
++        // TODO: Is removing this actually correct? Two circles with the 
++        // same radius, but different centers doesn't sound like it
++        // should be cleared
++        if (fDiffRadius == 0 && fCenter1 == fCenter2) {
+           sk_bzero(dstC, count * sizeof(*dstC));
+           return;
+         }
+-- 
+1.7.5.4
+
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0003-SkUserConfig-for-Mozilla.patch
@@ -0,0 +1,39 @@
+From ef53776c06cffc7607c3777702f93e04c0852981 Mon Sep 17 00:00:00 2001
+From: George Wright <gwright@mozilla.com>
+Date: Fri, 18 May 2012 14:13:49 -0400
+Subject: [PATCH 03/10]     Bug 755869 - [6] Re-apply SkUserConfig (no
+ original bug) r=mattwoodrow
+
+---
+ gfx/skia/include/config/SkUserConfig.h |   10 ++++++++++
+ 1 files changed, 10 insertions(+), 0 deletions(-)
+
+diff --git a/gfx/skia/include/config/SkUserConfig.h b/gfx/skia/include/config/SkUserConfig.h
+index 9fdbd0a..f98ba85 100644
+--- a/gfx/skia/include/config/SkUserConfig.h
++++ b/gfx/skia/include/config/SkUserConfig.h
+@@ -156,6 +156,10 @@
+ //#define SK_SUPPORT_UNITTEST
+ #endif
+ 
++/*  Don't dither 32bit gradients, to match what the canvas test suite expects.
++ */
++#define SK_DISABLE_DITHER_32BIT_GRADIENT
++
+ /* If your system embeds skia and has complex event logging, define this
+    symbol to name a file that maps the following macros to your system's
+    equivalents:
+@@ -177,4 +181,10 @@
+         #define SK_A32_SHIFT    24
+ #endif
+ 
++/*  Don't include stdint.h on windows as it conflicts with our build system.
++ */
++#ifdef SK_BUILD_FOR_WIN32 
++    #define SK_IGNORE_STDINT_DOT_H 
++#endif 
++
+ #endif
+-- 
+1.7.5.4
+
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0004-Bug-722011-Fix-trailing-commas-in-enums.patch
@@ -0,0 +1,280 @@
+From 81d61682a94d47be5b47fb7882ea7e7c7e6c3351 Mon Sep 17 00:00:00 2001
+From: George Wright <gwright@mozilla.com>
+Date: Fri, 18 May 2012 14:15:28 -0400
+Subject: [PATCH 04/10]     Bug 755869 - [7] Re-apply bug 722011 - Fix
+ trailing commas at end of enum lists r=mattwoodrow
+
+---
+ gfx/skia/include/core/SkAdvancedTypefaceMetrics.h |    8 ++++----
+ gfx/skia/include/core/SkBlitRow.h                 |    2 +-
+ gfx/skia/include/core/SkCanvas.h                  |    2 +-
+ gfx/skia/include/core/SkDevice.h                  |    2 +-
+ gfx/skia/include/core/SkDeviceProfile.h           |    4 ++--
+ gfx/skia/include/core/SkFlattenable.h             |    2 +-
+ gfx/skia/include/core/SkFontHost.h                |    4 ++--
+ gfx/skia/include/core/SkMaskFilter.h              |    2 +-
+ gfx/skia/include/core/SkPaint.h                   |    4 ++--
+ gfx/skia/include/core/SkScalerContext.h           |    9 +++++----
+ gfx/skia/include/core/SkTypes.h                   |    2 +-
+ gfx/skia/include/effects/SkLayerDrawLooper.h      |    2 +-
+ gfx/skia/src/core/SkBitmap.cpp                    |    2 +-
+ gfx/skia/src/core/SkGlyphCache.cpp                |    2 +-
+ 14 files changed, 24 insertions(+), 23 deletions(-)
+
+diff --git a/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h b/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h
+index 09fc9a9..5ffdb45 100644
+--- a/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h
++++ b/gfx/skia/include/core/SkAdvancedTypefaceMetrics.h
+@@ -34,7 +34,7 @@ public:
+         kCFF_Font,
+         kTrueType_Font,
+         kOther_Font,
+-        kNotEmbeddable_Font,
++        kNotEmbeddable_Font
+     };
+     // The type of the underlying font program.  This field determines which
+     // of the following fields are valid.  If it is kOther_Font or
+@@ -56,7 +56,7 @@ public:
+         kItalic_Style      = 0x00040,
+         kAllCaps_Style     = 0x10000,
+         kSmallCaps_Style   = 0x20000,
+-        kForceBold_Style   = 0x40000,
++        kForceBold_Style   = 0x40000
+     };
+     uint16_t fStyle;        // Font style characteristics.
+     int16_t fItalicAngle;   // Counterclockwise degrees from vertical of the
+@@ -75,7 +75,7 @@ public:
+       kHAdvance_PerGlyphInfo   = 0x1, // Populate horizontal advance data.
+       kVAdvance_PerGlyphInfo   = 0x2, // Populate vertical advance data.
+       kGlyphNames_PerGlyphInfo = 0x4, // Populate glyph names (Type 1 only).
+-      kToUnicode_PerGlyphInfo  = 0x8, // Populate ToUnicode table, ignored
++      kToUnicode_PerGlyphInfo  = 0x8  // Populate ToUnicode table, ignored
+                                       // for Type 1 fonts
+     };
+ 
+@@ -84,7 +84,7 @@ public:
+         enum MetricType {
+             kDefault,  // Default advance: fAdvance.count = 1
+             kRange,    // Advances for a range: fAdvance.count = fEndID-fStartID
+-            kRun,      // fStartID-fEndID have same advance: fAdvance.count = 1
++            kRun       // fStartID-fEndID have same advance: fAdvance.count = 1
+         };
+         MetricType fType;
+         uint16_t fStartId;
+diff --git a/gfx/skia/include/core/SkBlitRow.h b/gfx/skia/include/core/SkBlitRow.h
+index 973ab4c..febc405 100644
+--- a/gfx/skia/include/core/SkBlitRow.h
++++ b/gfx/skia/include/core/SkBlitRow.h
+@@ -42,7 +42,7 @@ public:
+ 
+     enum Flags32 {
+         kGlobalAlpha_Flag32     = 1 << 0,
+-        kSrcPixelAlpha_Flag32   = 1 << 1,
++        kSrcPixelAlpha_Flag32   = 1 << 1
+     };
+ 
+     /** Function pointer that blends 32bit colors onto a 32bit destination.
+diff --git a/gfx/skia/include/core/SkCanvas.h b/gfx/skia/include/core/SkCanvas.h
+index 25cc94a..d942783 100644
+--- a/gfx/skia/include/core/SkCanvas.h
++++ b/gfx/skia/include/core/SkCanvas.h
+@@ -148,7 +148,7 @@ public:
+          * low byte to high byte: R, G, B, A.
+          */
+         kRGBA_Premul_Config8888,
+-        kRGBA_Unpremul_Config8888,
++        kRGBA_Unpremul_Config8888
+     };
+ 
+     /**
+diff --git a/gfx/skia/include/core/SkDevice.h b/gfx/skia/include/core/SkDevice.h
+index 1e4e0a3..b4d44bf 100644
+--- a/gfx/skia/include/core/SkDevice.h
++++ b/gfx/skia/include/core/SkDevice.h
+@@ -139,7 +139,7 @@ public:
+ protected:
+     enum Usage {
+        kGeneral_Usage,
+-       kSaveLayer_Usage, // <! internal use only
++       kSaveLayer_Usage  // <! internal use only
+     };
+ 
+     struct TextFlags {
+diff --git a/gfx/skia/include/core/SkDeviceProfile.h b/gfx/skia/include/core/SkDeviceProfile.h
+index 46b9781..f6a0bca 100644
+--- a/gfx/skia/include/core/SkDeviceProfile.h
++++ b/gfx/skia/include/core/SkDeviceProfile.h
+@@ -17,7 +17,7 @@ public:
+         kRGB_Horizontal_LCDConfig,
+         kBGR_Horizontal_LCDConfig,
+         kRGB_Vertical_LCDConfig,
+-        kBGR_Vertical_LCDConfig,
++        kBGR_Vertical_LCDConfig
+     };
+ 
+     enum FontHintLevel {
+@@ -25,7 +25,7 @@ public:
+         kSlight_FontHintLevel,
+         kNormal_FontHintLevel,
+         kFull_FontHintLevel,
+-        kAuto_FontHintLevel,
++        kAuto_FontHintLevel
+     };
+ 
+     /**
+diff --git a/gfx/skia/include/core/SkFlattenable.h b/gfx/skia/include/core/SkFlattenable.h
+index 5714f9d..dc115fc 100644
+--- a/gfx/skia/include/core/SkFlattenable.h
++++ b/gfx/skia/include/core/SkFlattenable.h
+@@ -272,7 +272,7 @@ public:
+          *  Instructs the writer to inline Factory names as there are seen the
+          *  first time (after that we store an index). The pipe code uses this.
+          */
+-        kInlineFactoryNames_Flag = 0x02,
++        kInlineFactoryNames_Flag = 0x02
+     };
+     Flags getFlags() const { return (Flags)fFlags; }
+     void setFlags(Flags flags) { fFlags = flags; }
+diff --git a/gfx/skia/include/core/SkFontHost.h b/gfx/skia/include/core/SkFontHost.h
+index 732de5c..10f9bdf 100644
+--- a/gfx/skia/include/core/SkFontHost.h
++++ b/gfx/skia/include/core/SkFontHost.h
+@@ -240,7 +240,7 @@ public:
+     */
+     enum LCDOrientation {
+         kHorizontal_LCDOrientation = 0,    //!< this is the default
+-        kVertical_LCDOrientation   = 1,
++        kVertical_LCDOrientation   = 1
+     };
+ 
+     static void SetSubpixelOrientation(LCDOrientation orientation);
+@@ -259,7 +259,7 @@ public:
+     enum LCDOrder {
+         kRGB_LCDOrder = 0,    //!< this is the default
+         kBGR_LCDOrder = 1,
+-        kNONE_LCDOrder = 2,
++        kNONE_LCDOrder = 2
+     };
+ 
+     static void SetSubpixelOrder(LCDOrder order);
+diff --git a/gfx/skia/include/core/SkMaskFilter.h b/gfx/skia/include/core/SkMaskFilter.h
+index 9a470a4..3422e27 100644
+--- a/gfx/skia/include/core/SkMaskFilter.h
++++ b/gfx/skia/include/core/SkMaskFilter.h
+@@ -61,7 +61,7 @@ public:
+         kNormal_BlurType,  //!< fuzzy inside and outside
+         kSolid_BlurType,   //!< solid inside, fuzzy outside
+         kOuter_BlurType,   //!< nothing inside, fuzzy outside
+-        kInner_BlurType,   //!< fuzzy inside, nothing outside
++        kInner_BlurType    //!< fuzzy inside, nothing outside
+     };
+ 
+     struct BlurInfo {
+diff --git a/gfx/skia/include/core/SkPaint.h b/gfx/skia/include/core/SkPaint.h
+index ff37d77..7c96e193 100644
+--- a/gfx/skia/include/core/SkPaint.h
++++ b/gfx/skia/include/core/SkPaint.h
+@@ -76,7 +76,7 @@ public:
+         kNo_Hinting            = 0,
+         kSlight_Hinting        = 1,
+         kNormal_Hinting        = 2,     //!< this is the default
+-        kFull_Hinting          = 3,
++        kFull_Hinting          = 3
+     };
+ 
+     Hinting getHinting() const {
+@@ -289,7 +289,7 @@ public:
+         kStroke_Style,          //!< stroke the geometry
+         kStrokeAndFill_Style,   //!< fill and stroke the geometry
+ 
+-        kStyleCount,
++        kStyleCount
+     };
+ 
+     /** Return the paint's style, used for controlling how primitives'
+diff --git a/gfx/skia/include/core/SkScalerContext.h b/gfx/skia/include/core/SkScalerContext.h
+index 2cb171b..3dbce27 100644
+--- a/gfx/skia/include/core/SkScalerContext.h
++++ b/gfx/skia/include/core/SkScalerContext.h
+@@ -182,21 +182,22 @@ public:
+         kGenA8FromLCD_Flag        = 0x0800,
+ 
+ #ifdef SK_USE_COLOR_LUMINANCE
+-        kLuminance_Bits           = 3,
++        kLuminance_Bits           = 3
+ #else
+         // luminance : 0 for black text, kLuminance_Max for white text
+         kLuminance_Shift          = 13, // shift to land in the high 3-bits of Flags
+-        kLuminance_Bits           = 3,  // ensure Flags doesn't exceed 16bits
++        kLuminance_Bits           = 3   // ensure Flags doesn't exceed 16bits
+ #endif
+     };
+     
+     // computed values
+     enum {
+-        kHinting_Mask   = kHintingBit1_Flag | kHintingBit2_Flag,
+ #ifdef SK_USE_COLOR_LUMINANCE
++        kHinting_Mask   = kHintingBit1_Flag | kHintingBit2_Flag
+ #else
++        kHinting_Mask   = kHintingBit1_Flag | kHintingBit2_Flag,
+         kLuminance_Max  = (1 << kLuminance_Bits) - 1,
+-        kLuminance_Mask = kLuminance_Max << kLuminance_Shift,
++        kLuminance_Mask = kLuminance_Max << kLuminance_Shift
+ #endif
+     };
+ 
+diff --git a/gfx/skia/include/core/SkTypes.h b/gfx/skia/include/core/SkTypes.h
+index 7963a7d..0c5c2d7 100644
+--- a/gfx/skia/include/core/SkTypes.h
++++ b/gfx/skia/include/core/SkTypes.h
+@@ -438,7 +438,7 @@ public:
+          *  current block is dynamically allocated, just return the old
+          *  block.
+          */
+-        kReuse_OnShrink,
++        kReuse_OnShrink
+     };
+ 
+     /**
+diff --git a/gfx/skia/include/effects/SkLayerDrawLooper.h b/gfx/skia/include/effects/SkLayerDrawLooper.h
+index 0bc4af2..6cb8ef6 100644
+--- a/gfx/skia/include/effects/SkLayerDrawLooper.h
++++ b/gfx/skia/include/effects/SkLayerDrawLooper.h
+@@ -41,7 +41,7 @@ public:
+          *  - Flags and Color are always computed using the LayerInfo's
+          *    fFlagsMask and fColorMode.
+          */
+-        kEntirePaint_Bits = -1,
++        kEntirePaint_Bits = -1
+         
+     };
+     typedef int32_t BitFlags;
+diff --git a/gfx/skia/src/core/SkBitmap.cpp b/gfx/skia/src/core/SkBitmap.cpp
+index 6b99145..aff52fd 100644
+--- a/gfx/skia/src/core/SkBitmap.cpp
++++ b/gfx/skia/src/core/SkBitmap.cpp
+@@ -1376,7 +1376,7 @@ enum {
+     SERIALIZE_PIXELTYPE_RAW_WITH_CTABLE,
+     SERIALIZE_PIXELTYPE_RAW_NO_CTABLE,
+     SERIALIZE_PIXELTYPE_REF_DATA,
+-    SERIALIZE_PIXELTYPE_REF_PTR,
++    SERIALIZE_PIXELTYPE_REF_PTR
+ };
+ 
+ /*
+diff --git a/gfx/skia/src/core/SkGlyphCache.cpp b/gfx/skia/src/core/SkGlyphCache.cpp
+index f3363cd..1fddc9d 100644
+--- a/gfx/skia/src/core/SkGlyphCache.cpp
++++ b/gfx/skia/src/core/SkGlyphCache.cpp
+@@ -417,7 +417,7 @@ class SkGlyphCache_Globals {
+ public:
+     enum UseMutex {
+         kNo_UseMutex,  // thread-local cache
+-        kYes_UseMutex, // shared cache
++        kYes_UseMutex  // shared cache
+     };
+ 
+     SkGlyphCache_Globals(UseMutex um) {
+-- 
+1.7.5.4
+
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0005-Bug-731384-Fix-clang-SK_OVERRIDE.patch
@@ -0,0 +1,36 @@
+From 80350275c72921ed5ac405c029ae33727467d7c5 Mon Sep 17 00:00:00 2001
+From: George Wright <gwright@mozilla.com>
+Date: Fri, 18 May 2012 14:15:50 -0400
+Subject: [PATCH 05/10]     Bug 755869 - [8] Re-apply bug 731384 - Fix compile
+ errors on older versions of clang r=mattwoodrow
+
+---
+ gfx/skia/include/core/SkPostConfig.h |    9 +++++++++
+ 1 files changed, 9 insertions(+), 0 deletions(-)
+
+diff --git a/gfx/skia/include/core/SkPostConfig.h b/gfx/skia/include/core/SkPostConfig.h
+index 8316f7a..041fe2a 100644
+--- a/gfx/skia/include/core/SkPostConfig.h
++++ b/gfx/skia/include/core/SkPostConfig.h
+@@ -288,9 +288,18 @@
+ #if defined(_MSC_VER)
+ #define SK_OVERRIDE override
+ #elif defined(__clang__)
++#if __has_feature(cxx_override_control)
+ // Some documentation suggests we should be using __attribute__((override)),
+ // but it doesn't work.
+ #define SK_OVERRIDE override
++#elif defined(__has_extension)
++#if __has_extension(cxx_override_control)
++#define SK_OVERRIDE override
++#endif
++#endif
++#ifndef SK_OVERRIDE
++#define SK_OVERRIDE
++#endif
+ #else
+ // Linux GCC ignores "__attribute__((override))" and rejects "override".
+ #define SK_OVERRIDE
+-- 
+1.7.5.4
+
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0006-Bug-751814-ARM-EDSP-ARMv6-Skia-fixes.patch
@@ -0,0 +1,147 @@
+From 94916fbbc7865c6fe23a57d6edc48c6daf93dda8 Mon Sep 17 00:00:00 2001
+From: George Wright <gwright@mozilla.com>
+Date: Fri, 18 May 2012 14:16:08 -0400
+Subject: [PATCH 06/10]     Bug 755869 - [9] Re-apply bug 751814 - Various
+ Skia fixes for ARM without EDSP and ARMv6+
+ r=mattwoodrow
+
+---
+ gfx/skia/include/core/SkMath.h                   |    5 +--
+ gfx/skia/include/core/SkPostConfig.h             |   45 ++++++++++++++++++++++
+ gfx/skia/src/opts/SkBitmapProcState_opts_arm.cpp |    6 +-
+ gfx/skia/src/opts/SkBlitRow_opts_arm.cpp         |    9 ++++
+ 4 files changed, 58 insertions(+), 7 deletions(-)
+
+diff --git a/gfx/skia/include/core/SkMath.h b/gfx/skia/include/core/SkMath.h
+index 5889103..7a4b707 100644
+--- a/gfx/skia/include/core/SkMath.h
++++ b/gfx/skia/include/core/SkMath.h
+@@ -153,10 +153,7 @@ static inline bool SkIsPow2(int value) {
+     With this requirement, we can generate faster instructions on some
+     architectures.
+ */
+-#if defined(__arm__) \
+-  && !defined(__thumb__) \
+-  && !defined(__ARM_ARCH_4T__) \
+-  && !defined(__ARM_ARCH_5T__)
++#ifdef SK_ARM_HAS_EDSP
+     static inline int32_t SkMulS16(S16CPU x, S16CPU y) {
+         SkASSERT((int16_t)x == x);
+         SkASSERT((int16_t)y == y);
+diff --git a/gfx/skia/include/core/SkPostConfig.h b/gfx/skia/include/core/SkPostConfig.h
+index 041fe2a..03105e4 100644
+--- a/gfx/skia/include/core/SkPostConfig.h
++++ b/gfx/skia/include/core/SkPostConfig.h
+@@ -311,3 +311,48 @@
+ #ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
+ #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 1
+ #endif
++
++//////////////////////////////////////////////////////////////////////
++// ARM defines
++
++#if defined(__GNUC__) && defined(__arm__)
++
++#  define SK_ARM_ARCH 3
++
++#  if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) \
++   || defined(_ARM_ARCH_4)
++#    undef SK_ARM_ARCH
++#    define SK_ARM_ARCH 4
++#  endif
++
++#  if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
++   || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
++   || defined(__ARM_ARCH_5TEJ__) || defined(_ARM_ARCH_5)
++#    undef SK_ARM_ARCH
++#    define SK_ARM_ARCH 5
++#  endif
++ 
++#  if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
++   || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
++   || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
++   || defined(__ARM_ARCH_6M__) || defined(_ARM_ARCH_6)
++#    undef SK_ARM_ARCH
++#    define SK_ARM_ARCH 6
++#  endif
++
++#  if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
++   || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
++   || defined(__ARM_ARCH_7EM__) || defined(_ARM_ARCH_7)
++#    undef SK_ARM_ARCH
++#    define SK_ARM_ARCH 7
++#  endif
++
++#  undef SK_ARM_HAS_EDSP
++#  if defined(__thumb2__) && (SK_ARM_ARCH >= 6) \
++   || !defined(__thumb__) \
++   && ((SK_ARM_ARCH > 5) || defined(__ARM_ARCH_5E__) \
++       || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__))
++#    define SK_ARM_HAS_EDSP 1
++#  endif
++
++#endif
+diff --git a/gfx/skia/src/opts/SkBitmapProcState_opts_arm.cpp b/gfx/skia/src/opts/SkBitmapProcState_opts_arm.cpp
+index 20d62e1..deb1bfe 100644
+--- a/gfx/skia/src/opts/SkBitmapProcState_opts_arm.cpp
++++ b/gfx/skia/src/opts/SkBitmapProcState_opts_arm.cpp
+@@ -11,7 +11,7 @@
+ #include "SkColorPriv.h"
+ #include "SkUtils.h"
+ 
+-#if __ARM_ARCH__ >= 6 && !defined(SK_CPU_BENDIAN)
++#if SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
+ void SI8_D16_nofilter_DX_arm(
+     const SkBitmapProcState& s,
+     const uint32_t* SK_RESTRICT xy,
+@@ -182,7 +182,7 @@ void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s,
+ 
+     s.fBitmap->getColorTable()->unlockColors(false);
+ }
+-#endif //__ARM_ARCH__ >= 6 && !defined(SK_CPU_BENDIAN)
++#endif // SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+@@ -200,7 +200,7 @@ void SkBitmapProcState::platformProcs() {
+ 
+     switch (fBitmap->config()) {
+         case SkBitmap::kIndex8_Config:
+-#if __ARM_ARCH__ >= 6 && !defined(SK_CPU_BENDIAN)
++#if SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
+             if (justDx && !doFilter) {
+ #if 0   /* crashing on android device */
+                 fSampleProc16 = SI8_D16_nofilter_DX_arm;
+diff --git a/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp b/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
+index 2490371..c928888 100644
+--- a/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
++++ b/gfx/skia/src/opts/SkBlitRow_opts_arm.cpp
+@@ -675,8 +675,13 @@ static void __attribute((noinline,optimize("-fomit-frame-pointer"))) S32A_Blend_
+                   /* dst1_scale and dst2_scale*/
+                   "lsr    r9, r5, #24                \n\t" /* src >> 24 */
+                   "lsr    r10, r6, #24               \n\t" /* src >> 24 */
++#ifdef SK_ARM_HAS_EDSP
+                   "smulbb r9, r9, %[alpha]           \n\t" /* r9 = SkMulS16 r9 with src_scale */
+                   "smulbb r10, r10, %[alpha]         \n\t" /* r10 = SkMulS16 r10 with src_scale */
++#else
++                  "mul    r9, r9, %[alpha]           \n\t" /* r9 = SkMulS16 r9 with src_scale */
++                  "mul    r10, r10, %[alpha]         \n\t" /* r10 = SkMulS16 r10 with src_scale */
++#endif
+                   "lsr    r9, r9, #8                 \n\t" /* r9 >> 8 */
+                   "lsr    r10, r10, #8               \n\t" /* r10 >> 8 */
+                   "rsb    r9, r9, #256               \n\t" /* dst1_scale = r9 = 255 - r9 + 1 */
+@@ -745,7 +750,11 @@ static void __attribute((noinline,optimize("-fomit-frame-pointer"))) S32A_Blend_
+ 
+                   "lsr    r6, r5, #24                \n\t" /* src >> 24 */
+                   "and    r8, r12, r5, lsr #8        \n\t" /* ag = r8 = r5 masked by r12 lsr by #8 */
++#ifdef SK_ARM_HAS_EDSP
+                   "smulbb r6, r6, %[alpha]           \n\t" /* r6 = SkMulS16 with src_scale */
++#else
++                  "mul    r6, r6, %[alpha]           \n\t" /* r6 = SkMulS16 with src_scale */
++#endif
+                   "and    r9, r12, r5                \n\t" /* rb = r9 = r5 masked by r12 */
+                   "lsr    r6, r6, #8                 \n\t" /* r6 >> 8 */
+                   "mul    r8, r8, %[alpha]           \n\t" /* ag = r8 times scale */
+-- 
+1.7.5.4
+
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0007-Bug-719872-Old-Android-FontHost.patch
@@ -0,0 +1,702 @@
+From 6982ad469adcdfa2b7bdbf8bbd843bc22d3832fc Mon Sep 17 00:00:00 2001
+From: George Wright <gwright@mozilla.com>
+Date: Fri, 18 May 2012 14:52:40 -0400
+Subject: [PATCH 07/10]     Bug 755869 - [10] Re-apply bug 719872 - Fix crash
+ on Android by reverting to older FontHost impl
+ r=mattwoodrow
+
+---
+ gfx/skia/Makefile.in                          |    5 +-
+ gfx/skia/src/ports/SkFontHost_android_old.cpp |  664 +++++++++++++++++++++++++
+ 2 files changed, 668 insertions(+), 1 deletions(-)
+ create mode 100644 gfx/skia/src/ports/SkFontHost_android_old.cpp
+
+diff --git a/gfx/skia/Makefile.in b/gfx/skia/Makefile.in
+index 9da098a..8184f1c 100644
+--- a/gfx/skia/Makefile.in
++++ b/gfx/skia/Makefile.in
+@@ -327,7 +327,10 @@ endif
+ ifeq (android,$(MOZ_WIDGET_TOOLKIT))
+ CPPSRCS += \
+ 	SkDebug_android.cpp \
+-	SkFontHost_none.cpp \
++	SkFontHost_android_old.cpp \
++	SkFontHost_gamma.cpp \
++	SkFontHost_FreeType.cpp \
++	SkFontHost_tables.cpp \
+ 	SkMMapStream.cpp \
+ 	SkTime_Unix.cpp \
+ 	SkThread_pthread.cpp \
+diff --git a/gfx/skia/src/ports/SkFontHost_android_old.cpp b/gfx/skia/src/ports/SkFontHost_android_old.cpp
+new file mode 100644
+index 0000000..b5c4f3c
+--- /dev/null
++++ b/gfx/skia/src/ports/SkFontHost_android_old.cpp
+@@ -0,0 +1,664 @@
++
++/*
++ * Copyright 2006 The Android Open Source Project
++ *
++ * Use of this source code is governed by a BSD-style license that can be
++ * found in the LICENSE file.
++ */
++
++
++#include "SkFontHost.h"
++#include "SkDescriptor.h"
++#include "SkMMapStream.h"
++#include "SkPaint.h"
++#include "SkString.h"
++#include "SkStream.h"
++#include "SkThread.h"
++#include "SkTSearch.h"
++#include <stdio.h>
++
++#define FONT_CACHE_MEMORY_BUDGET    (768 * 1024)
++
++#ifndef SK_FONT_FILE_PREFIX
++    #define SK_FONT_FILE_PREFIX          "/fonts/"
++#endif
++
++bool find_name_and_attributes(SkStream* stream, SkString* name, SkTypeface::Style* style,
++                                           bool* isFixedWidth);
++
++static void GetFullPathForSysFonts(SkString* full, const char name[]) {
++    full->set(getenv("ANDROID_ROOT"));
++    full->append(SK_FONT_FILE_PREFIX);
++    full->append(name);
++}
++
++///////////////////////////////////////////////////////////////////////////////
++
++struct FamilyRec;
++
++/*  This guy holds a mapping of a name -> family, used for looking up fonts.
++    Since it is stored in a stretchy array that doesn't preserve object
++    semantics, we don't use constructor/destructors, but just have explicit
++    helpers to manage our internal bookkeeping.
++*/
++struct NameFamilyPair {
++    const char* fName;      // we own this
++    FamilyRec*  fFamily;    // we don't own this, we just reference it
++
++    void construct(const char name[], FamilyRec* family) {
++        fName = strdup(name);
++        fFamily = family;   // we don't own this, so just record the referene
++    }
++
++    void destruct() {
++        free((char*)fName);
++        // we don't own family, so just ignore our reference
++    }
++};
++
++// we use atomic_inc to grow this for each typeface we create
++static int32_t gUniqueFontID;
++
++// this is the mutex that protects these globals
++static SkMutex gFamilyMutex;
++static FamilyRec* gFamilyHead;
++static SkTDArray<NameFamilyPair> gNameList;
++
++struct FamilyRec {
++    FamilyRec*  fNext;
++    SkTypeface* fFaces[4];
++
++    FamilyRec()
++    {
++        fNext = gFamilyHead;
++        memset(fFaces, 0, sizeof(fFaces));
++        gFamilyHead = this;
++    }
++};
++
++static SkTypeface* find_best_face(const FamilyRec* family,
++                                  SkTypeface::Style style) {
++    SkTypeface* const* faces = family->fFaces;
++
++    if (faces[style] != NULL) { // exact match
++        return faces[style];
++    }
++    // look for a matching bold
++    style = (SkTypeface::Style)(style ^ SkTypeface::kItalic);
++    if (faces[style] != NULL) {
++        return faces[style];
++    }
++    // look for the plain
++    if (faces[SkTypeface::kNormal] != NULL) {
++        return faces[SkTypeface::kNormal];
++    }
++    // look for anything
++    for (int i = 0; i < 4; i++) {
++        if (faces[i] != NULL) {
++            return faces[i];
++        }
++    }
++    // should never get here, since the faces list should not be empty
++    SkASSERT(!"faces list is empty");
++    return NULL;
++}
++
++static FamilyRec* find_family(const SkTypeface* member) {
++    FamilyRec* curr = gFamilyHead;
++    while (curr != NULL) {
++        for (int i = 0; i < 4; i++) {
++            if (curr->fFaces[i] == member) {
++                return curr;
++            }
++        }
++        curr = curr->fNext;
++    }
++    return NULL;
++}
++
++/*  Returns the matching typeface, or NULL. If a typeface is found, its refcnt
++    is not modified.
++ */
++static SkTypeface* find_from_uniqueID(uint32_t uniqueID) {
++    FamilyRec* curr = gFamilyHead;
++    while (curr != NULL) {
++        for (int i = 0; i < 4; i++) {
++            SkTypeface* face = curr->fFaces[i];
++            if (face != NULL && face->uniqueID() == uniqueID) {
++                return face;
++            }
++        }
++        curr = curr->fNext;
++    }
++    return NULL;
++}
++
++/*  Remove reference to this face from its family. If the resulting family
++    is empty (has no faces), return that family, otherwise return NULL
++*/
++static FamilyRec* remove_from_family(const SkTypeface* face) {
++    FamilyRec* family = find_family(face);
++    SkASSERT(family->fFaces[face->style()] == face);
++    family->fFaces[face->style()] = NULL;
++
++    for (int i = 0; i < 4; i++) {
++        if (family->fFaces[i] != NULL) {    // family is non-empty
++            return NULL;
++        }
++    }
++    return family;  // return the empty family
++}
++
++// maybe we should make FamilyRec be doubly-linked
++static void detach_and_delete_family(FamilyRec* family) {
++    FamilyRec* curr = gFamilyHead;
++    FamilyRec* prev = NULL;
++
++    while (curr != NULL) {
++        FamilyRec* next = curr->fNext;
++        if (curr == family) {
++            if (prev == NULL) {
++                gFamilyHead = next;
++            } else {
++                prev->fNext = next;
++            }
++            SkDELETE(family);
++            return;
++        }
++        prev = curr;
++        curr = next;
++    }
++    SkASSERT(!"Yikes, couldn't find family in our list to remove/delete");
++}
++
++static SkTypeface* find_typeface(const char name[], SkTypeface::Style style) {
++    NameFamilyPair* list = gNameList.begin();
++    int             count = gNameList.count();
++
++    int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0]));
++
++    if (index >= 0) {
++        return find_best_face(list[index].fFamily, style);
++    }
++    return NULL;
++}
++
++static SkTypeface* find_typeface(const SkTypeface* familyMember,
++                                 SkTypeface::Style style) {
++    const FamilyRec* family = find_family(familyMember);
++    return family ? find_best_face(family, style) : NULL;
++}
++
++static void add_name(const char name[], FamilyRec* family) {
++    SkAutoAsciiToLC tolc(name);
++    name = tolc.lc();
++
++    NameFamilyPair* list = gNameList.begin();
++    int             count = gNameList.count();
++
++    int index = SkStrLCSearch(&list[0].fName, count, name, sizeof(list[0]));
++
++    if (index < 0) {
++        list = gNameList.insert(~index);
++        list->construct(name, family);
++    }
++}
++
++static void remove_from_names(FamilyRec* emptyFamily)
++{
++#ifdef SK_DEBUG
++    for (int i = 0; i < 4; i++) {
++        SkASSERT(emptyFamily->fFaces[i] == NULL);
++    }
++#endif
++
++    SkTDArray<NameFamilyPair>& list = gNameList;
++
++    // must go backwards when removing
++    for (int i = list.count() - 1; i >= 0; --i) {
++        NameFamilyPair* pair = &list[i];
++        if (pair->fFamily == emptyFamily) {
++            pair->destruct();
++            list.remove(i);
++        }
++    }
++}
++
++///////////////////////////////////////////////////////////////////////////////
++
++class FamilyTypeface : public SkTypeface {
++public:
++    FamilyTypeface(Style style, bool sysFont, SkTypeface* familyMember,
++                   bool isFixedWidth)
++    : SkTypeface(style, sk_atomic_inc(&gUniqueFontID) + 1, isFixedWidth) {
++        fIsSysFont = sysFont;
++
++        SkAutoMutexAcquire  ac(gFamilyMutex);
++
++        FamilyRec* rec = NULL;
++        if (familyMember) {
++            rec = find_family(familyMember);
++            SkASSERT(rec);
++        } else {
++            rec = SkNEW(FamilyRec);
++        }
++        rec->fFaces[style] = this;
++    }
++
++    virtual ~FamilyTypeface() {
++        SkAutoMutexAcquire  ac(gFamilyMutex);
++
++        // remove us from our family. If the family is now empty, we return
++        // that and then remove that family from the name list
++        FamilyRec* family = remove_from_family(this);
++        if (NULL != family) {
++            remove_from_names(family);
++            detach_and_delete_family(family);
++        }
++    }
++
++    bool isSysFont() const { return fIsSysFont; }
++
++    virtual SkStream* openStream() = 0;
++    virtual const char* getUniqueString() const = 0;
++    virtual const char* getFilePath() const = 0;
++
++private:
++    bool    fIsSysFont;
++
++    typedef SkTypeface INHERITED;
++};
++
++///////////////////////////////////////////////////////////////////////////////
++
++class StreamTypeface : public FamilyTypeface {
++public:
++    StreamTypeface(Style style, bool sysFont, SkTypeface* familyMember,
++                   SkStream* stream, bool isFixedWidth)
++    : INHERITED(style, sysFont, familyMember, isFixedWidth) {
++        SkASSERT(stream);
++        stream->ref();
++        fStream = stream;
++    }
++    virtual ~StreamTypeface() {
++        fStream->unref();
++    }
++
++    // overrides
++    virtual SkStream* openStream() {
++        // we just ref our existing stream, since the caller will call unref()
++        // when they are through
++        fStream->ref();
++        // must rewind each time, since the caller assumes a "new" stream
++        fStream->rewind();
++        return fStream;
++    }
++    virtual const char* getUniqueString() const { return NULL; }
++    virtual const char* getFilePath() const { return NULL; }
++
++private:
++    SkStream* fStream;
++
++    typedef FamilyTypeface INHERITED;
++};
++
++class FileTypeface : public FamilyTypeface {
++public:
++    FileTypeface(Style style, bool sysFont, SkTypeface* familyMember,
++                 const char path[], bool isFixedWidth)
++    : INHERITED(style, sysFont, familyMember, isFixedWidth) {
++        SkString fullpath;
++
++        if (sysFont) {
++            GetFullPathForSysFonts(&fullpath, path);
++            path = fullpath.c_str();
++        }
++        fPath.set(path);
++    }
++
++    // overrides
++    virtual SkStream* openStream() {
++        SkStream* stream = SkNEW_ARGS(SkMMAPStream, (fPath.c_str()));
++
++        // check for failure
++        if (stream->getLength() <= 0) {
++            SkDELETE(stream);
++            // maybe MMAP isn't supported. try FILE
++            stream = SkNEW_ARGS(SkFILEStream, (fPath.c_str()));
++            if (stream->getLength() <= 0) {
++                SkDELETE(stream);
++                stream = NULL;
++            }
++        }
++        return stream;
++    }
++    virtual const char* getUniqueString() const {
++        const char* str = strrchr(fPath.c_str(), '/');
++        if (str) {
++            str += 1;   // skip the '/'
++        }
++        return str;
++    }
++    virtual const char* getFilePath() const {
++        return fPath.c_str();
++    }
++
++private:
++    SkString fPath;
++
++    typedef FamilyTypeface INHERITED;
++};
++
++///////////////////////////////////////////////////////////////////////////////
++///////////////////////////////////////////////////////////////////////////////
++
++static bool get_name_and_style(const char path[], SkString* name,
++                               SkTypeface::Style* style,
++                               bool* isFixedWidth, bool isExpected) {
++    SkString        fullpath;
++    GetFullPathForSysFonts(&fullpath, path);
++
++    SkMMAPStream stream(fullpath.c_str());
++    if (stream.getLength() > 0) {
++        find_name_and_attributes(&stream, name, style, isFixedWidth);
++        return true;
++    }
++    else {
++        SkFILEStream stream(fullpath.c_str());
++        if (stream.getLength() > 0) {
++            find_name_and_attributes(&stream, name, style, isFixedWidth);
++            return true;
++        }
++    }
++
++    if (isExpected) {
++        SkDebugf("---- failed to open <%s> as a font\n", fullpath.c_str());
++    }
++    return false;
++}
++
++// used to record our notion of the pre-existing fonts
++struct FontInitRec {
++    const char*         fFileName;
++    const char* const*  fNames;     // null-terminated list
++};
++
++static const char* gSansNames[] = {
++    "sans-serif", "arial", "helvetica", "tahoma", "verdana", NULL
++};
++
++static const char* gSerifNames[] = {
++    "serif", "times", "times new roman", "palatino", "georgia", "baskerville",
++    "goudy", "fantasy", "cursive", "ITC Stone Serif", NULL
++};
++
++static const char* gMonoNames[] = {
++    "monospace", "courier", "courier new", "monaco", NULL
++};
++
++// deliberately empty, but we use the address to identify fallback fonts
++static const char* gFBNames[] = { NULL };
++
++/*  Fonts must be grouped by family, with the first font in a family having the
++    list of names (even if that list is empty), and the following members having
++    null for the list. The names list must be NULL-terminated
++*/
++static const FontInitRec gSystemFonts[] = {
++    { "DroidSans.ttf",              gSansNames  },
++    { "DroidSans-Bold.ttf",         NULL        },
++    { "DroidSerif-Regular.ttf",     gSerifNames },
++    { "DroidSerif-Bold.ttf",        NULL        },
++    { "DroidSerif-Italic.ttf",      NULL        },
++    { "DroidSerif-BoldItalic.ttf",  NULL        },
++    { "DroidSansMono.ttf",          gMonoNames  },
++    /*  These are optional, and can be ignored if not found in the file system.
++        These are appended to gFallbackFonts[] as they are seen, so we list
++        them in the order we want them to be accessed by NextLogicalFont().
++     */
++    { "DroidSansArabic.ttf",        gFBNames    },
++    { "DroidSansHebrew.ttf",        gFBNames    },
++    { "DroidSansThai.ttf",          gFBNames    },
++    { "MTLmr3m.ttf",                gFBNames    }, // Motoya Japanese Font
++    { "MTLc3m.ttf",                 gFBNames    }, // Motoya Japanese Font
++    { "DroidSansJapanese.ttf",      gFBNames    },
++    { "DroidSansFallback.ttf",      gFBNames    }
++};
++
++#define DEFAULT_NAMES   gSansNames
++
++// these globals are assigned (once) by load_system_fonts()
++static FamilyRec* gDefaultFamily;
++static SkTypeface* gDefaultNormal;
++
++/*  This is sized conservatively, assuming that it will never be a size issue.
++    It will be initialized in load_system_fonts(), and will be filled with the
++    fontIDs that can be used for fallback consideration, in sorted order (sorted
++    meaning element[0] should be used first, then element[1], etc. When we hit
++    a fontID==0 in the array, the list is done, hence our allocation size is
++    +1 the total number of possible system fonts. Also see NextLogicalFont().
++ */
++static uint32_t gFallbackFonts[SK_ARRAY_COUNT(gSystemFonts)+1];
++
++/*  Called once (ensured by the sentinel check at the beginning of our body).
++    Initializes all the globals, and register the system fonts.
++ */
++static void load_system_fonts() {
++    // check if we've already be called
++    if (NULL != gDefaultNormal) {
++        return;
++    }
++
++    const FontInitRec* rec = gSystemFonts;
++    SkTypeface* firstInFamily = NULL;
++    int fallbackCount = 0;
++
++    for (size_t i = 0; i < SK_ARRAY_COUNT(gSystemFonts); i++) {
++        // if we're the first in a new family, clear firstInFamily
++        if (rec[i].fNames != NULL) {
++            firstInFamily = NULL;
++        }
++
++        bool isFixedWidth;
++        SkString name;
++        SkTypeface::Style style;
++
++        // we expect all the fonts, except the "fallback" fonts
++        bool isExpected = (rec[i].fNames != gFBNames);
++        if (!get_name_and_style(rec[i].fFileName, &name, &style,
++                                &isFixedWidth, isExpected)) {
++            continue;
++        }
++
++        SkTypeface* tf = SkNEW_ARGS(FileTypeface,
++                                    (style,
++                                     true,  // system-font (cannot delete)
++                                     firstInFamily, // what family to join
++                                     rec[i].fFileName,
++                                     isFixedWidth) // filename
++                                    );
++
++        if (rec[i].fNames != NULL) {
++            // see if this is one of our fallback fonts
++            if (rec[i].fNames == gFBNames) {
++            //    SkDebugf("---- adding %s as fallback[%d] fontID %d\n",
++            //             rec[i].fFileName, fallbackCount, tf->uniqueID());
++                gFallbackFonts[fallbackCount++] = tf->uniqueID();
++            }
++
++            firstInFamily = tf;
++            FamilyRec* family = find_family(tf);
++            const char* const* names = rec[i].fNames;
++
++            // record the default family if this is it
++            if (names == DEFAULT_NAMES) {
++                gDefaultFamily = family;
++            }
++            // add the names to map to this family
++            while (*names) {
++                add_name(*names, family);
++                names += 1;
++            }
++        }
++    }
++
++    // do this after all fonts are loaded. This is our default font, and it
++    // acts as a sentinel so we only execute load_system_fonts() once
++    gDefaultNormal = find_best_face(gDefaultFamily, SkTypeface::kNormal);
++    // now terminate our fallback list with the sentinel value
++    gFallbackFonts[fallbackCount] = 0;
++}
++
++///////////////////////////////////////////////////////////////////////////////
++
++void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) {
++    const char* name = ((FamilyTypeface*)face)->getUniqueString();
++
++    stream->write8((uint8_t)face->style());
++
++    if (NULL == name || 0 == *name) {
++        stream->writePackedUInt(0);
++//        SkDebugf("--- fonthost serialize null\n");
++    } else {
++        uint32_t len = strlen(name);
++        stream->writePackedUInt(len);
++        stream->write(name, len);
++//      SkDebugf("--- fonthost serialize <%s> %d\n", name, face->style());
++    }
++}
++
++SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
++    load_system_fonts();
++
++    int style = stream->readU8();
++
++    int len = stream->readPackedUInt();
++    if (len > 0) {
++        SkString str;
++        str.resize(len);
++        stream->read(str.writable_str(), len);
++
++        const FontInitRec* rec = gSystemFonts;
++        for (size_t i = 0; i < SK_ARRAY_COUNT(gSystemFonts); i++) {
++            if (strcmp(rec[i].fFileName, str.c_str()) == 0) {
++                // backup until we hit the fNames
++                for (int j = i; j >= 0; --j) {
++                    if (rec[j].fNames != NULL) {
++                        return SkFontHost::CreateTypeface(NULL,
++                                    rec[j].fNames[0], (SkTypeface::Style)style);
++                    }
++                }
++            }
++        }
++    }
++    return NULL;
++}
++
++///////////////////////////////////////////////////////////////////////////////
++
++SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
++                                       const char familyName[],
++                                       SkTypeface::Style style) {
++    load_system_fonts();
++
++    SkAutoMutexAcquire  ac(gFamilyMutex);
++
++    // clip to legal style bits
++    style = (SkTypeface::Style)(style & SkTypeface::kBoldItalic);
++
++    SkTypeface* tf = NULL;
++
++    if (NULL != familyFace) {
++        tf = find_typeface(familyFace, style);
++    } else if (NULL != familyName) {
++//        SkDebugf("======= familyName <%s>\n", familyName);
++        tf = find_typeface(familyName, style);
++    }
++
++    if (NULL == tf) {
++        tf = find_best_face(gDefaultFamily, style);
++    }
++
++    // we ref(), since the symantic is to return a new instance
++    tf->ref();
++    return tf;
++}
++
++SkStream* SkFontHost::OpenStream(uint32_t fontID) {
++    SkAutoMutexAcquire  ac(gFamilyMutex);
++
++    FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID);
++    SkStream* stream = tf ? tf->openStream() : NULL;
++
++    if (stream && stream->getLength() == 0) {
++        stream->unref();
++        stream = NULL;
++    }
++    return stream;
++}
++
++size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length,
++                               int32_t* index) {
++    SkAutoMutexAcquire  ac(gFamilyMutex);
++
++    FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID);
++    const char* src = tf ? tf->getFilePath() : NULL;
++
++    if (src) {
++        size_t size = strlen(src);
++        if (path) {
++            memcpy(path, src, SkMin32(size, length));
++        }
++        if (index) {
++            *index = 0; // we don't have collections (yet)
++        }
++        return size;
++    } else {
++        return 0;
++    }
++}
++
++SkFontID SkFontHost::NextLogicalFont(SkFontID currFontID, SkFontID origFontID) {
++    load_system_fonts();
++
++    /*  First see if fontID is already one of our fallbacks. If so, return
++        its successor. If fontID is not in our list, then return the first one
++        in our list. Note: list is zero-terminated, and returning zero means
++        we have no more fonts to use for fallbacks.
++     */
++    const uint32_t* list = gFallbackFonts;
++    for (int i = 0; list[i] != 0; i++) {
++        if (list[i] == currFontID) {
++            return list[i+1];
++        }
++    }
++    return list[0];
++}
++
++///////////////////////////////////////////////////////////////////////////////
++
++SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
++    if (NULL == stream || stream->getLength() <= 0) {
++        return NULL;
++    }
++
++    bool isFixedWidth;
++    SkString name;
++    SkTypeface::Style style;
++    find_name_and_attributes(stream, &name, &style, &isFixedWidth);
++
++    if (!name.isEmpty()) {
++        return SkNEW_ARGS(StreamTypeface, (style, false, NULL, stream, isFixedWidth));
++    } else {
++        return NULL;
++    }
++}
++
++SkTypeface* SkFontHost::CreateTypefaceFromFile(const char path[]) {
++    SkStream* stream = SkNEW_ARGS(SkMMAPStream, (path));
++    SkTypeface* face = SkFontHost::CreateTypefaceFromStream(stream);
++    // since we created the stream, we let go of our ref() here
++    stream->unref();
++    return face;
++}
++
++///////////////////////////////////////////////////////////////////////////////
+-- 
+1.7.5.4
+
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0008-Bug-687188-Skia-radial-gradients.patch
@@ -0,0 +1,173 @@
+From f941ea32e44a2436d235e83ef1a434289a9d9c1e Mon Sep 17 00:00:00 2001
+From: George Wright <gwright@mozilla.com>
+Date: Wed, 23 May 2012 11:40:25 -0400
+Subject: [PATCH 08/10]     Bug 755869 - [11] Re-apply bug 687188 - Skia
+ radial gradients should use the 0/1 color stop values
+ for clamping. r=mattwoodrow
+
+---
+ gfx/skia/src/effects/SkGradientShader.cpp |   76 +++++++++++++++++++++++------
+ 1 files changed, 61 insertions(+), 15 deletions(-)
+
+diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp
+index 59ba48c..ea05a39 100644
+--- a/gfx/skia/src/effects/SkGradientShader.cpp
++++ b/gfx/skia/src/effects/SkGradientShader.cpp
+@@ -204,6 +204,7 @@ private:
+     mutable SkMallocPixelRef* fCache32PixelRef;
+     mutable unsigned    fCacheAlpha;        // the alpha value we used when we computed the cache. larger than 8bits so we can store uninitialized value
+ 
++    static SkPMColor PremultiplyColor(SkColor c0, U8CPU alpha);
+     static void Build16bitCache(uint16_t[], SkColor c0, SkColor c1, int count);
+     static void Build32bitCache(SkPMColor[], SkColor c0, SkColor c1, int count,
+                                 U8CPU alpha);
+@@ -507,6 +508,21 @@ static inline U8CPU dither_ceil_fixed_to_8(SkFixed n) {
+     return ((n << 1) - (n | (n >> 8))) >> 8;
+ }
+ 
++SkPMColor Gradient_Shader::PremultiplyColor(SkColor c0, U8CPU paintAlpha)
++{
++    SkFixed a = SkMulDiv255Round(SkColorGetA(c0), paintAlpha);
++    SkFixed r = SkColorGetR(c0);
++    SkFixed g = SkColorGetG(c0);
++    SkFixed b = SkColorGetB(c0);
++
++    a = SkIntToFixed(a) + 0x8000;
++    r = SkIntToFixed(r) + 0x8000;
++    g = SkIntToFixed(g) + 0x8000;
++    b = SkIntToFixed(b) + 0x8000;
++
++    return SkPremultiplyARGBInline(a >> 16, r >> 16, g >> 16, b >> 16);
++}
++
+ void Gradient_Shader::Build32bitCache(SkPMColor cache[], SkColor c0, SkColor c1,
+                                       int count, U8CPU paintAlpha) {
+     SkASSERT(count > 1);
+@@ -628,14 +644,14 @@ static void complete_32bit_cache(SkPMColor* cache, int stride) {
+ const SkPMColor* Gradient_Shader::getCache32() const {
+     if (fCache32 == NULL) {
+         // double the count for dither entries
+-        const int entryCount = kCache32Count * 2;
++        const int entryCount = kCache32Count * 2 + 2;
+         const size_t allocSize = sizeof(SkPMColor) * entryCount;
+ 
+         if (NULL == fCache32PixelRef) {
+             fCache32PixelRef = SkNEW_ARGS(SkMallocPixelRef,
+                                           (NULL, allocSize, NULL));
+         }
+-        fCache32 = (SkPMColor*)fCache32PixelRef->getAddr();
++        fCache32 = (SkPMColor*)fCache32PixelRef->getAddr() + 1;
+         if (fColorCount == 2) {
+             Build32bitCache(fCache32, fOrigColors[0], fOrigColors[1],
+                             kGradient32Length, fCacheAlpha);
+@@ -659,7 +675,7 @@ const SkPMColor* Gradient_Shader::getCache32() const {
+             SkMallocPixelRef* newPR = SkNEW_ARGS(SkMallocPixelRef,
+                                                  (NULL, allocSize, NULL));
+             SkPMColor* linear = fCache32;           // just computed linear data
+-            SkPMColor* mapped = (SkPMColor*)newPR->getAddr();    // storage for mapped data
++            SkPMColor* mapped = (SkPMColor*)newPR->getAddr() + 1;    // storage for mapped data
+             SkUnitMapper* map = fMapper;
+             for (int i = 0; i < kGradient32Length; i++) {
+                 int index = map->mapUnit16((i << 8) | i) >> 8;
+@@ -668,10 +684,13 @@ const SkPMColor* Gradient_Shader::getCache32() const {
+             }
+             fCache32PixelRef->unref();
+             fCache32PixelRef = newPR;
+-            fCache32 = (SkPMColor*)newPR->getAddr();
++            fCache32 = (SkPMColor*)newPR->getAddr() + 1;
+         }
+         complete_32bit_cache(fCache32, kCache32Count);
+     }
++    //Write the clamp colours into the first and last entries of fCache32
++    fCache32[-1] = PremultiplyColor(fOrigColors[0], fCacheAlpha);
++    fCache32[kCache32Count * 2] = PremultiplyColor(fOrigColors[fColorCount - 1], fCacheAlpha);
+     return fCache32;
+ }
+ 
+@@ -857,6 +876,18 @@ void shadeSpan_linear_vertical(TileProc proc, SkFixed dx, SkFixed fx,
+                                SkPMColor* SK_RESTRICT dstC,
+                                const SkPMColor* SK_RESTRICT cache,
+                                int toggle, int count) {
++    if (proc == clamp_tileproc) {
++        // Read out clamp values from beginning/end of the cache. No need to lerp
++        // or dither
++        if (fx < 0) {
++            sk_memset32(dstC, cache[-1], count);
++            return;
++        } else if (fx > 0xFFFF) {
++            sk_memset32(dstC, cache[Gradient_Shader::kCache32Count * 2], count);
++            return;
++        }
++    }
++
+     // We're a vertical gradient, so no change in a span.
+     // If colors change sharply across the gradient, dithering is
+     // insufficient (it subsamples the color space) and we need to lerp.
+@@ -875,6 +906,18 @@ void shadeSpan_linear_vertical_lerp(TileProc proc, SkFixed dx, SkFixed fx,
+                                     SkPMColor* SK_RESTRICT dstC,
+                                     const SkPMColor* SK_RESTRICT cache,
+                                     int toggle, int count) {
++    if (proc == clamp_tileproc) {
++        // Read out clamp values from beginning/end of the cache. No need to lerp
++        // or dither
++        if (fx < 0) {
++            sk_memset32(dstC, cache[-1], count);
++            return;
++        } else if (fx > 0xFFFF) {
++            sk_memset32(dstC, cache[Gradient_Shader::kCache32Count * 2], count);
++            return;
++        }
++    }
++
+     // We're a vertical gradient, so no change in a span.
+     // If colors change sharply across the gradient, dithering is
+     // insufficient (it subsamples the color space) and we need to lerp.
+@@ -900,10 +943,8 @@ void shadeSpan_linear_clamp(TileProc proc, SkFixed dx, SkFixed fx,
+     range.init(fx, dx, count, 0, Gradient_Shader::kGradient32Length);
+ 
+     if ((count = range.fCount0) > 0) {
+-        sk_memset32_dither(dstC,
+-            cache[toggle + range.fV0],
+-            cache[(toggle ^ Gradient_Shader::kDitherStride32) + range.fV0],
+-            count);
++        // Shouldn't be any need to dither for clamping?
++        sk_memset32(dstC, cache[-1], count);
+         dstC += count;
+     }
+     if ((count = range.fCount1) > 0) {
+@@ -922,10 +963,8 @@ void shadeSpan_linear_clamp(TileProc proc, SkFixed dx, SkFixed fx,
+         }
+     }
+     if ((count = range.fCount2) > 0) {
+-        sk_memset32_dither(dstC,
+-            cache[toggle + range.fV1],
+-            cache[(toggle ^ Gradient_Shader::kDitherStride32) + range.fV1],
+-            count);
++        // Shouldn't be any need to dither for clamping?
++        sk_memset32(dstC, cache[Gradient_Shader::kCache32Count * 2], count);
+     }
+ }
+ 
+@@ -1796,9 +1835,16 @@ void shadeSpan_twopoint_clamp(SkScalar fx, SkScalar dx,
+     for (; count > 0; --count) {
+         SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
+                                      fOneOverTwoA, posRoot);
+-        SkFixed index = SkClampMax(t, 0xFFFF);
+-        SkASSERT(index <= 0xFFFF);
+-        *dstC++ = cache[index >> Gradient_Shader::kCache32Shift];
++
++        if (t < 0) {
++            *dstC++ = cache[-1];
++        } else if (t > 0xFFFF) {
++            *dstC++ = cache[Gradient_Shader::kCache32Count * 2];
++        } else {
++            SkASSERT(t <= 0xFFFF);
++            *dstC++ = cache[t >> Gradient_Shader::kCache32Shift];
++        }
++
+         fx += dx;
+         fy += dy;
+         b += db;
+-- 
+1.7.5.4
+
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0009-Bug-755869-FreeBSD-Hurd.patch
@@ -0,0 +1,28 @@
+From df3be24040f7cb2f9c7ed86ad3e47206630e885f Mon Sep 17 00:00:00 2001
+From: George Wright <gwright@mozilla.com>
+Date: Wed, 23 May 2012 14:49:57 -0400
+Subject: [PATCH 09/10]     Bug 755869 - [12] Re-apply bug 749533 - Add
+ support for GNU/kFreeBSD and Hurd in Skia.
+ r=mattwoodrow
+
+---
+ gfx/skia/include/core/SkPreConfig.h |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+diff --git a/gfx/skia/include/core/SkPreConfig.h b/gfx/skia/include/core/SkPreConfig.h
+index 46c6929..16c4d6c 100644
+--- a/gfx/skia/include/core/SkPreConfig.h
++++ b/gfx/skia/include/core/SkPreConfig.h
+@@ -35,7 +35,8 @@
+     #elif defined(ANDROID)
+         #define SK_BUILD_FOR_ANDROID
+     #elif defined(linux) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
+-          defined(__sun) || defined(__NetBSD__) || defined(__DragonFly__)
++          defined(__sun) || defined(__NetBSD__) || defined(__DragonFly__) || \
++          defined(__GLIBC__) || defined(__GNU__)
+         #define SK_BUILD_FOR_UNIX
+     #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
+         #define SK_BUILD_FOR_IOS
+-- 
+1.7.5.4
+
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0010-Bug-689069-ARM-Opts.patch
@@ -0,0 +1,36 @@
+From dc1292fc8c2b9da900ebcac953120eaffd0d329e Mon Sep 17 00:00:00 2001
+From: George Wright <gwright@mozilla.com>
+Date: Wed, 23 May 2012 14:52:36 -0400
+Subject: [PATCH 10/10]     Bug 755869 - [13] Re-apply bug 750733 - Use
+ handles in API object hooks where possible
+ r=mattwoodrow
+
+---
+ gfx/skia/src/xml/SkJS.cpp |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gfx/skia/src/xml/SkJS.cpp b/gfx/skia/src/xml/SkJS.cpp
+index f2e7a83..b2717d7 100644
+--- a/gfx/skia/src/xml/SkJS.cpp
++++ b/gfx/skia/src/xml/SkJS.cpp
+@@ -74,7 +74,7 @@ extern "C" {
+ #endif
+ 
+ static JSBool
+-global_enumerate(JSContext *cx, JSObject *obj)
++global_enumerate(JSContext *cx, JSHandleObject *obj)
+ {
+ #ifdef LAZY_STANDARD_CLASSES
+     return JS_EnumerateStandardClasses(cx, obj);
+@@ -84,7 +84,7 @@ global_enumerate(JSContext *cx, JSObject *obj)
+ }
+ 
+ static JSBool
+-global_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp)
++global_resolve(JSContext *cx, JSHandleObject obj, JSHandleId id, unsigned flags, JSObject **objp)
+ {
+ #ifdef LAZY_STANDARD_CLASSES
+     if ((flags & JSRESOLVE_ASSIGNING) == 0) {
+-- 
+1.7.5.4
+
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0011-Bug-719575-Fix-clang-build.patch
@@ -0,0 +1,28 @@
+From cf855f31194ff071f2c787a7413d70a43f15f204 Mon Sep 17 00:00:00 2001
+From: Ehsan Akhgari <ehsan@mozilla.com>
+Date: Tue, 29 May 2012 15:39:55 -0400
+Subject: [PATCH] Bug 755869 - Re-apply patch from bug 719575 to fix clang
+ builds for the new Skia r=gw280
+
+---
+ gfx/skia/src/ports/SkFontHost_mac_coretext.cpp |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp b/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
+index c43d1a6..ce5f409 100644
+--- a/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
++++ b/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
+@@ -807,8 +807,8 @@ CGRGBPixel* Offscreen::getCG(const SkScalerContext_Mac& context, const SkGlyph&
+ void SkScalerContext_Mac::getVerticalOffset(CGGlyph glyphID, SkIPoint* offset) const {
+     CGSize vertOffset;
+     CTFontGetVerticalTranslationsForGlyphs(fCTVerticalFont, &glyphID, &vertOffset, 1);
+-    const SkPoint trans = {SkFloatToScalar(vertOffset.width),
+-                           SkFloatToScalar(vertOffset.height)};
++    const SkPoint trans = {SkScalar(SkFloatToScalar(vertOffset.width)),
++                           SkScalar(SkFloatToScalar(vertOffset.height))};
+     SkPoint floatOffset;
+     fVerticalMatrix.mapPoints(&floatOffset, &trans, 1);
+     if (!isSnowLeopard()) {
+-- 
+1.7.5.4
+
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0012-Bug-759683-make-ssse3-conditional.patch
@@ -0,0 +1,22 @@
+diff --git a/gfx/skia/src/opts/opts_check_SSE2.cpp b/gfx/skia/src/opts/opts_check_SSE2.cpp
+--- a/gfx/skia/src/opts/opts_check_SSE2.cpp
++++ b/gfx/skia/src/opts/opts_check_SSE2.cpp
+@@ -91,17 +91,17 @@ static bool cachedHasSSE2() {
+ 
+ static bool cachedHasSSSE3() {
+     static bool gHasSSSE3 = hasSSSE3();
+     return gHasSSSE3;
+ }
+ 
+ void SkBitmapProcState::platformProcs() {
+     if (cachedHasSSSE3()) {
+-#if !defined(SK_BUILD_FOR_ANDROID)
++#if defined(SK_BUILD_SSSE3)
+         // Disable SSSE3 optimization for Android x86
+         if (fSampleProc32 == S32_opaque_D32_filter_DX) {
+             fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3;
+         } else if (fSampleProc32 == S32_alpha_D32_filter_DX) {
+             fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3;
+         }
+ 
+         if (fSampleProc32 == S32_opaque_D32_filter_DXDY) {
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0013-Bug-761890-fonts.patch
@@ -0,0 +1,162 @@
+# HG changeset patch
+# User Nicholas Cameron <ncameron@mozilla.com>
+# Date 1337146927 -43200
+# Node ID 310209abef2c2667e5de41dd2a1f071e8cd42821
+# Parent 93f3ca4d5707b2aae9c6ae52d5d29c2c802e7ef8
+Bug 746883; changes to the Skia library. r=gw280
+
+diff --git a/gfx/skia/include/core/SkDraw.h b/gfx/skia/include/core/SkDraw.h
+--- a/gfx/skia/include/core/SkDraw.h
++++ b/gfx/skia/include/core/SkDraw.h
+@@ -125,23 +125,24 @@ public:
+ #endif
+ };
+ 
+ class SkGlyphCache;
+ 
+ class SkTextToPathIter {
+ public:
+     SkTextToPathIter(const char text[], size_t length, const SkPaint& paint,
+-                     bool applyStrokeAndPathEffects);
++                     bool applyStrokeAndPathEffects, bool useCanonicalTextSize = true);
+     ~SkTextToPathIter();
+ 
+     const SkPaint&  getPaint() const { return fPaint; }
+     SkScalar        getPathScale() const { return fScale; }
+ 
+     const SkPath*   next(SkScalar* xpos);   //!< returns nil when there are no more paths
++    bool            nextWithWhitespace(const SkPath** path, SkScalar* xpos);   //!< returns false when there are no more paths
+ 
+ private:
+     SkGlyphCache*   fCache;
+     SkPaint         fPaint;
+     SkScalar        fScale;
+     SkFixed         fPrevAdvance;
+     const char*     fText;
+     const char*     fStop;
+diff --git a/gfx/skia/src/core/SkPaint.cpp b/gfx/skia/src/core/SkPaint.cpp
+--- a/gfx/skia/src/core/SkPaint.cpp
++++ b/gfx/skia/src/core/SkPaint.cpp
+@@ -1359,30 +1359,32 @@ void SkPaint::getPosTextPath(const void*
+                              const SkPoint pos[], SkPath* path) const {
+     SkASSERT(length == 0 || textData != NULL);
+ 
+     const char* text = (const char*)textData;
+     if (text == NULL || length == 0 || path == NULL) {
+         return;
+     }
+ 
+-    SkTextToPathIter    iter(text, length, *this, false);
++    SkTextToPathIter    iter(text, length, *this, false, false);
+     SkMatrix            matrix;
+     SkPoint             prevPos;
+     prevPos.set(0, 0);
+ 
+     matrix.setScale(iter.getPathScale(), iter.getPathScale());
+     path->reset();
+ 
+     unsigned int    i = 0;
+     const SkPath*   iterPath;
+-    while ((iterPath = iter.next(NULL)) != NULL) {
+-        matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY);
+-        path->addPath(*iterPath, matrix);
+-        prevPos = pos[i];
++    while (iter.nextWithWhitespace(&iterPath, NULL)) {
++        if (iterPath) {
++            matrix.postTranslate(pos[i].fX - prevPos.fX, pos[i].fY - prevPos.fY);
++            path->addPath(*iterPath, matrix);
++            prevPos = pos[i];
++        }
+         i++;
+     }
+ }
+ 
+ static void add_flattenable(SkDescriptor* desc, uint32_t tag,
+                             SkFlattenableWriteBuffer* buffer) {
+     buffer->flatten(desc->addEntry(tag, buffer->size(), NULL));
+ }
+@@ -2118,30 +2120,31 @@ const SkRect& SkPaint::doComputeFastBoun
+ 
+ static bool has_thick_frame(const SkPaint& paint) {
+     return  paint.getStrokeWidth() > 0 &&
+             paint.getStyle() != SkPaint::kFill_Style;
+ }
+ 
+ SkTextToPathIter::SkTextToPathIter( const char text[], size_t length,
+                                     const SkPaint& paint,
+-                                    bool applyStrokeAndPathEffects)
++                                    bool applyStrokeAndPathEffects,
++                                    bool useCanonicalTextSize)
+                                     : fPaint(paint) {
+     fGlyphCacheProc = paint.getMeasureCacheProc(SkPaint::kForward_TextBufferDirection,
+                                                 true);
+ 
+     fPaint.setLinearText(true);
+     fPaint.setMaskFilter(NULL);   // don't want this affecting our path-cache lookup
+ 
+     if (fPaint.getPathEffect() == NULL && !has_thick_frame(fPaint)) {
+         applyStrokeAndPathEffects = false;
+     }
+ 
+     // can't use our canonical size if we need to apply patheffects
+-    if (fPaint.getPathEffect() == NULL) {
++    if (useCanonicalTextSize && fPaint.getPathEffect() == NULL) {
+         fPaint.setTextSize(SkIntToScalar(SkPaint::kCanonicalTextSizeForPaths));
+         fScale = paint.getTextSize() / SkPaint::kCanonicalTextSizeForPaths;
+         if (has_thick_frame(fPaint)) {
+             fPaint.setStrokeWidth(SkScalarDiv(fPaint.getStrokeWidth(), fScale));
+         }
+     } else {
+         fScale = SK_Scalar1;
+     }
+@@ -2185,30 +2188,47 @@ SkTextToPathIter::SkTextToPathIter( cons
+     fXYIndex = paint.isVerticalText() ? 1 : 0;
+ }
+ 
+ SkTextToPathIter::~SkTextToPathIter() {
+     SkGlyphCache::AttachCache(fCache);
+ }
+ 
+ const SkPath* SkTextToPathIter::next(SkScalar* xpos) {
+-    while (fText < fStop) {
++    const SkPath* result;
++    while (nextWithWhitespace(&result, xpos)) {
++        if (result) {
++            if (xpos) {
++                *xpos = fXPos;
++            }
++            return result;
++        }
++    }
++    return NULL;
++}
++
++bool SkTextToPathIter::nextWithWhitespace(const SkPath** path, SkScalar* xpos) {
++    if (fText < fStop) {
+         const SkGlyph& glyph = fGlyphCacheProc(fCache, &fText);
+ 
+         fXPos += SkScalarMul(SkFixedToScalar(fPrevAdvance + fAutoKern.adjust(glyph)), fScale);
+         fPrevAdvance = advance(glyph, fXYIndex);   // + fPaint.getTextTracking();
+ 
+         if (glyph.fWidth) {
+             if (xpos) {
+                 *xpos = fXPos;
+             }
+-            return fCache->findPath(glyph);
++            *path = fCache->findPath(glyph);
++            return true;
++        } else {
++            *path = NULL;
++            return true;
+         }
+     }
+-    return NULL;
++    return false;
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ bool SkPaint::nothingToDraw() const {
+     if (fLooper) {
+         return false;
+     }
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0014-Bug-765038-Fix-clang-build.patch
@@ -0,0 +1,29 @@
+# HG changeset patch
+# Parent 9ded7a9f94a863dfa1f3227d3013367f51b8b522
+# User Nicholas Cameron <ncameron@mozilla.com>
+Bug 765038; fix a Clang compilation bug in Skia; r=jwatt
+
+diff --git a/gfx/skia/src/sfnt/SkOTTable_head.h b/gfx/skia/src/sfnt/SkOTTable_head.h
+--- a/gfx/skia/src/sfnt/SkOTTable_head.h
++++ b/gfx/skia/src/sfnt/SkOTTable_head.h
+@@ -109,18 +109,18 @@ struct SkOTTableHead {
+         } raw;
+     } macStyle;
+     SK_OT_USHORT lowestRecPPEM;
+     struct FontDirectionHint {
+         SK_TYPED_ENUM(Value, SK_OT_SHORT,
+             ((FullyMixedDirectionalGlyphs, SkTEndian_SwapBE16(0)))
+             ((OnlyStronglyLTR, SkTEndian_SwapBE16(1)))
+             ((StronglyLTR, SkTEndian_SwapBE16(2)))
+-            ((OnlyStronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(-1))))
+-            ((StronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(-2))))
++            ((OnlyStronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(static_cast<SK_OT_USHORT>(-1)))))
++            ((StronglyRTL, static_cast<SK_OT_SHORT>(SkTEndian_SwapBE16(static_cast<SK_OT_USHORT>(-2)))))
+             SK_SEQ_END,
+         (value)SK_SEQ_END)
+     } fontDirectionHint;
+     struct IndexToLocFormat {
+         SK_TYPED_ENUM(Value, SK_OT_SHORT,
+             ((ShortOffsets, SkTEndian_SwapBE16(0)))
+             ((LongOffsets, SkTEndian_SwapBE16(1)))
+             SK_SEQ_END,
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0015-Bug-766017-warnings.patch
@@ -0,0 +1,865 @@
+From: David Zbarsky <dzbarsky@gmail.com>
+Bug 766017 - Fix some skia warnings r=gw280
+
+diff --git a/gfx/skia/include/utils/mac/SkCGUtils.h b/gfx/skia/include/utils/mac/SkCGUtils.h
+--- a/gfx/skia/include/utils/mac/SkCGUtils.h
++++ b/gfx/skia/include/utils/mac/SkCGUtils.h
+@@ -39,18 +39,16 @@ static inline CGImageRef SkCreateCGImage
+ /**
+  *  Draw the bitmap into the specified CG context. The bitmap will be converted
+  *  to a CGImage using the generic RGB colorspace. (x,y) specifies the position
+  *  of the top-left corner of the bitmap. The bitmap is converted using the
+  *  colorspace returned by CGColorSpaceCreateDeviceRGB()
+  */
+ void SkCGDrawBitmap(CGContextRef, const SkBitmap&, float x, float y);
+ 
+-bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output);
+-
+ /**
+  *  Return a provider that wraps the specified stream. It will become an
+  *  owner of the stream, so the caller must still manage its ownership.
+  *
+  *  To hand-off ownership of the stream to the provider, the caller must do
+  *  something like the following:
+  *
+  *  SkStream* stream = new ...;
+diff --git a/gfx/skia/src/core/SkAAClip.cpp b/gfx/skia/src/core/SkAAClip.cpp
+--- a/gfx/skia/src/core/SkAAClip.cpp
++++ b/gfx/skia/src/core/SkAAClip.cpp
+@@ -246,17 +246,17 @@ static void count_left_right_zeros(const
+             zeros = 0;
+         }
+         row += 2;
+         width -= n;
+     }
+     *riteZ = zeros;
+ }
+ 
+-#ifdef SK_DEBUG
++#if 0
+ static void test_count_left_right_zeros() {
+     static bool gOnce;
+     if (gOnce) {
+         return;
+     }
+     gOnce = true;
+ 
+     const uint8_t data0[] = {  0, 0,     10, 0xFF };
+@@ -1319,22 +1319,16 @@ bool SkAAClip::setPath(const SkPath& pat
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ typedef void (*RowProc)(SkAAClip::Builder&, int bottom,
+                         const uint8_t* rowA, const SkIRect& rectA,
+                         const uint8_t* rowB, const SkIRect& rectB);
+ 
+-static void sectRowProc(SkAAClip::Builder& builder, int bottom,
+-                        const uint8_t* rowA, const SkIRect& rectA,
+-                        const uint8_t* rowB, const SkIRect& rectB) {
+-    
+-}
+-
+ typedef U8CPU (*AlphaProc)(U8CPU alphaA, U8CPU alphaB);
+ 
+ static U8CPU sectAlphaProc(U8CPU alphaA, U8CPU alphaB) {
+     // Multiply
+     return SkMulDiv255Round(alphaA, alphaB);
+ }
+ 
+ static U8CPU unionAlphaProc(U8CPU alphaA, U8CPU alphaB) {
+@@ -1429,31 +1423,16 @@ private:
+ static void adjust_row(RowIter& iter, int& leftA, int& riteA, int rite) {
+     if (rite == riteA) {
+         iter.next();
+         leftA = iter.left();
+         riteA = iter.right();
+     }
+ }
+ 
+-static bool intersect(int& min, int& max, int boundsMin, int boundsMax) {
+-    SkASSERT(min < max);
+-    SkASSERT(boundsMin < boundsMax);
+-    if (min >= boundsMax || max <= boundsMin) {
+-        return false;
+-    }
+-    if (min < boundsMin) {
+-        min = boundsMin;
+-    }
+-    if (max > boundsMax) {
+-        max = boundsMax;
+-    }
+-    return true;
+-}
+-
+ static void operatorX(SkAAClip::Builder& builder, int lastY,
+                       RowIter& iterA, RowIter& iterB,
+                       AlphaProc proc, const SkIRect& bounds) {
+     int leftA = iterA.left();
+     int riteA = iterA.right();
+     int leftB = iterB.left();
+     int riteB = iterB.right();
+ 
+@@ -1970,34 +1949,33 @@ static void small_bzero(void* dst, size_
+ static inline uint8_t mergeOne(uint8_t value, unsigned alpha) {
+     return SkMulDiv255Round(value, alpha);
+ }
+ static inline uint16_t mergeOne(uint16_t value, unsigned alpha) {
+     unsigned r = SkGetPackedR16(value);
+     unsigned g = SkGetPackedG16(value);
+     unsigned b = SkGetPackedB16(value);
+     return SkPackRGB16(SkMulDiv255Round(r, alpha),
+-                       SkMulDiv255Round(r, alpha),
+-                       SkMulDiv255Round(r, alpha));
++                       SkMulDiv255Round(g, alpha),
++                       SkMulDiv255Round(b, alpha));
+ }
+ static inline SkPMColor mergeOne(SkPMColor value, unsigned alpha) {
+     unsigned a = SkGetPackedA32(value);
+     unsigned r = SkGetPackedR32(value);
+     unsigned g = SkGetPackedG32(value);
+     unsigned b = SkGetPackedB32(value);
+     return SkPackARGB32(SkMulDiv255Round(a, alpha),
+                         SkMulDiv255Round(r, alpha),
+                         SkMulDiv255Round(g, alpha),
+                         SkMulDiv255Round(b, alpha));
+ }
+ 
+ template <typename T> void mergeT(const T* SK_RESTRICT src, int srcN,
+                                  const uint8_t* SK_RESTRICT row, int rowN,
+                                  T* SK_RESTRICT dst) {
+-    SkDEBUGCODE(int accumulated = 0;)
+     for (;;) {
+         SkASSERT(rowN > 0);
+         SkASSERT(srcN > 0);
+         
+         int n = SkMin32(rowN, srcN);
+         unsigned rowA = row[1];
+         if (0xFF == rowA) {
+             small_memcpy(dst, src, n * sizeof(T));
+diff --git a/gfx/skia/src/core/SkBlitMask_D32.cpp b/gfx/skia/src/core/SkBlitMask_D32.cpp
+--- a/gfx/skia/src/core/SkBlitMask_D32.cpp
++++ b/gfx/skia/src/core/SkBlitMask_D32.cpp
+@@ -268,107 +268,49 @@ bool SkBlitMask::BlitColor(const SkBitma
+         return true;
+     }
+     return false;
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+-static void BW_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
+-                             const uint8_t* SK_RESTRICT mask,
+-                             const SkPMColor* SK_RESTRICT src, int count) {
+-    int i, octuple = (count + 7) >> 3;
+-    for (i = 0; i < octuple; ++i) {
+-        int m = *mask++;
+-        if (m & 0x80) { dst[0] = SkPMSrcOver(src[0], dst[0]); }
+-        if (m & 0x40) { dst[1] = SkPMSrcOver(src[1], dst[1]); }
+-        if (m & 0x20) { dst[2] = SkPMSrcOver(src[2], dst[2]); }
+-        if (m & 0x10) { dst[3] = SkPMSrcOver(src[3], dst[3]); }
+-        if (m & 0x08) { dst[4] = SkPMSrcOver(src[4], dst[4]); }
+-        if (m & 0x04) { dst[5] = SkPMSrcOver(src[5], dst[5]); }
+-        if (m & 0x02) { dst[6] = SkPMSrcOver(src[6], dst[6]); }
+-        if (m & 0x01) { dst[7] = SkPMSrcOver(src[7], dst[7]); }
+-        src += 8;
+-        dst += 8;
+-    }
+-    count &= 7;
+-    if (count > 0) {
+-        int m = *mask;
+-        do {
+-            if (m & 0x80) { dst[0] = SkPMSrcOver(src[0], dst[0]); }
+-            m <<= 1;
+-            src += 1;
+-            dst += 1;
+-        } while (--count > 0);
+-    }
+-}
+-
+-static void BW_RowProc_Opaque(SkPMColor* SK_RESTRICT dst,
+-                              const uint8_t* SK_RESTRICT mask,
+-                              const SkPMColor* SK_RESTRICT src, int count) {
+-    int i, octuple = (count + 7) >> 3;
+-    for (i = 0; i < octuple; ++i) {
+-        int m = *mask++;
+-        if (m & 0x80) { dst[0] = src[0]; }
+-        if (m & 0x40) { dst[1] = src[1]; }
+-        if (m & 0x20) { dst[2] = src[2]; }
+-        if (m & 0x10) { dst[3] = src[3]; }
+-        if (m & 0x08) { dst[4] = src[4]; }
+-        if (m & 0x04) { dst[5] = src[5]; }
+-        if (m & 0x02) { dst[6] = src[6]; }
+-        if (m & 0x01) { dst[7] = src[7]; }
+-        src += 8;
+-        dst += 8;
+-    }
+-    count &= 7;
+-    if (count > 0) {
+-        int m = *mask;
+-        do {
+-            if (m & 0x80) { dst[0] = SkPMSrcOver(src[0], dst[0]); }
+-            m <<= 1;
+-            src += 1;
+-            dst += 1;
+-        } while (--count > 0);
+-    }
+-}
+-
+ static void A8_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
+                              const uint8_t* SK_RESTRICT mask,
+                              const SkPMColor* SK_RESTRICT src, int count) {
+     for (int i = 0; i < count; ++i) {
+         if (mask[i]) {
+             dst[i] = SkBlendARGB32(src[i], dst[i], mask[i]);
+         }
+     }
+ }
+ 
+ // expand the steps that SkAlphaMulQ performs, but this way we can
+-//  exand.. add.. combine
++//  expand.. add.. combine
+ // instead of
+ // expand..combine add expand..combine
+ //
+ #define EXPAND0(v, m, s)    ((v) & (m)) * (s)
+ #define EXPAND1(v, m, s)    (((v) >> 8) & (m)) * (s)
+ #define COMBINE(e0, e1, m)  ((((e0) >> 8) & (m)) | ((e1) & ~(m)))
+ 
+ static void A8_RowProc_Opaque(SkPMColor* SK_RESTRICT dst,
+                               const uint8_t* SK_RESTRICT mask,
+                               const SkPMColor* SK_RESTRICT src, int count) {
+-    const uint32_t rbmask = gMask_00FF00FF;
+     for (int i = 0; i < count; ++i) {
+         int m = mask[i];
+         if (m) {
+             m += (m >> 7);
+ #if 1
+             // this is slightly slower than the expand/combine version, but it
+             // is much closer to the old results, so we use it for now to reduce
+             // rebaselining.
+             dst[i] = SkAlphaMulQ(src[i], m) + SkAlphaMulQ(dst[i], 256 - m);
+ #else
++            const uint32_t rbmask = gMask_00FF00FF;
+             uint32_t v = src[i];
+             uint32_t s0 = EXPAND0(v, rbmask, m);
+             uint32_t s1 = EXPAND1(v, rbmask, m);
+             v = dst[i];
+             uint32_t d0 = EXPAND0(v, rbmask, m);
+             uint32_t d1 = EXPAND1(v, rbmask, m);
+             dst[i] = COMBINE(s0 + d0, s1 + d1, rbmask);
+ #endif
+@@ -559,17 +501,17 @@ SkBlitMask::RowProc SkBlitMask::RowFacto
+ // make this opt-in until chrome can rebaseline
+     RowProc proc = PlatformRowProcs(config, format, flags);
+     if (proc) {
+         return proc;
+     }
+ 
+     static const RowProc gProcs[] = {
+         // need X coordinate to handle BW
+-        NULL, NULL, //(RowProc)BW_RowProc_Blend,      (RowProc)BW_RowProc_Opaque,
++        NULL, NULL,
+         (RowProc)A8_RowProc_Blend,      (RowProc)A8_RowProc_Opaque,
+         (RowProc)LCD16_RowProc_Blend,   (RowProc)LCD16_RowProc_Opaque,
+         (RowProc)LCD32_RowProc_Blend,   (RowProc)LCD32_RowProc_Opaque,
+     };
+ 
+     int index;
+     switch (config) {
+         case SkBitmap::kARGB_8888_Config:
+diff --git a/gfx/skia/src/core/SkConcaveToTriangles.cpp b/gfx/skia/src/core/SkConcaveToTriangles.cpp
+--- a/gfx/skia/src/core/SkConcaveToTriangles.cpp
++++ b/gfx/skia/src/core/SkConcaveToTriangles.cpp
+@@ -37,17 +37,16 @@
+ #include "SkTDArray.h"
+ #include "SkGeometry.h"
+ #include "SkTSort.h"
+ 
+ // This is used to prevent runaway code bugs, and can probably be removed after
+ // the code has been proven robust.
+ #define kMaxCount 1000
+ 
+-#define DEBUG
+ #ifdef DEBUG
+ //------------------------------------------------------------------------------
+ // Debugging support
+ //------------------------------------------------------------------------------
+ 
+ #include <cstdio>
+ #include <stdarg.h>
+ 
+diff --git a/gfx/skia/src/core/SkPath.cpp b/gfx/skia/src/core/SkPath.cpp
+--- a/gfx/skia/src/core/SkPath.cpp
++++ b/gfx/skia/src/core/SkPath.cpp
+@@ -469,17 +469,16 @@ void SkPath::incReserve(U16CPU inc) {
+     fPts.setReserve(fPts.count() + inc);
+ 
+     SkDEBUGCODE(this->validate();)
+ }
+ 
+ void SkPath::moveTo(SkScalar x, SkScalar y) {
+     SkDEBUGCODE(this->validate();)
+ 
+-    int      vc = fVerbs.count();
+     SkPoint* pt;
+ 
+     // remember our index
+     fLastMoveToIndex = fPts.count();
+ 
+     pt = fPts.append();
+     *fVerbs.append() = kMove_Verb;
+     pt->set(x, y);
+@@ -1163,17 +1162,16 @@ void SkPath::reversePathTo(const SkPath&
+         }
+         pts -= gPtsInVerb[verbs[i]];
+     }
+ }
+ 
+ void SkPath::reverseAddPath(const SkPath& src) {
+     this->incReserve(src.fPts.count());
+ 
+-    const SkPoint* startPts = src.fPts.begin();
+     const SkPoint* pts = src.fPts.end();
+     const uint8_t* startVerbs = src.fVerbs.begin();
+     const uint8_t* verbs = src.fVerbs.end();
+ 
+     fIsOval = false;
+ 
+     bool needMove = true;
+     bool needClose = false;
+diff --git a/gfx/skia/src/core/SkRegion.cpp b/gfx/skia/src/core/SkRegion.cpp
+--- a/gfx/skia/src/core/SkRegion.cpp
++++ b/gfx/skia/src/core/SkRegion.cpp
+@@ -920,20 +920,16 @@ static int operate(const SkRegion::RunTy
+ /*  Given count RunTypes in a complex region, return the worst case number of
+     logical intervals that represents (i.e. number of rects that would be
+     returned from the iterator).
+  
+     We could just return count/2, since there must be at least 2 values per
+     interval, but we can first trim off the const overhead of the initial TOP
+     value, plus the final BOTTOM + 2 sentinels.
+  */
+-static int count_to_intervals(int count) {
+-    SkASSERT(count >= 6);   // a single rect is 6 values
+-    return (count - 4) >> 1;
+-}
+ 
+ /*  Given a number of intervals, what is the worst case representation of that
+     many intervals?
+  
+     Worst case (from a storage perspective), is a vertical stack of single
+     intervals:  TOP + N * (BOTTOM INTERVALCOUNT LEFT RIGHT SENTINEL) + SENTINEL
+  */
+ static int intervals_to_count(int intervals) {
+diff --git a/gfx/skia/src/core/SkScalerContext.cpp b/gfx/skia/src/core/SkScalerContext.cpp
+--- a/gfx/skia/src/core/SkScalerContext.cpp
++++ b/gfx/skia/src/core/SkScalerContext.cpp
+@@ -336,44 +336,16 @@ SK_ERROR:
+     glyph->fTop     = 0;
+     glyph->fWidth   = 0;
+     glyph->fHeight  = 0;
+     // put a valid value here, in case it was earlier set to
+     // MASK_FORMAT_JUST_ADVANCE
+     glyph->fMaskFormat = fRec.fMaskFormat;
+ }
+ 
+-static bool isLCD(const SkScalerContext::Rec& rec) {
+-    return SkMask::kLCD16_Format == rec.fMaskFormat ||
+-           SkMask::kLCD32_Format == rec.fMaskFormat;
+-}
+-
+-static uint16_t a8_to_rgb565(unsigned a8) {
+-    return SkPackRGB16(a8 >> 3, a8 >> 2, a8 >> 3);
+-}
+-
+-static void copyToLCD16(const SkBitmap& src, const SkMask& dst) {
+-    SkASSERT(SkBitmap::kA8_Config == src.config());
+-    SkASSERT(SkMask::kLCD16_Format == dst.fFormat);
+-
+-    const int width = dst.fBounds.width();
+-    const int height = dst.fBounds.height();
+-    const uint8_t* srcP = src.getAddr8(0, 0);
+-    size_t srcRB = src.rowBytes();
+-    uint16_t* dstP = (uint16_t*)dst.fImage;
+-    size_t dstRB = dst.fRowBytes;
+-    for (int y = 0; y < height; ++y) {
+-        for (int x = 0; x < width; ++x) {
+-            dstP[x] = a8_to_rgb565(srcP[x]);
+-        }
+-        srcP += srcRB;
+-        dstP = (uint16_t*)((char*)dstP + dstRB);
+-    }
+-}
+-
+ #define SK_FREETYPE_LCD_LERP    160
+ 
+ static int lerp(int start, int end) {
+     SkASSERT((unsigned)SK_FREETYPE_LCD_LERP <= 256);
+     return start + ((end - start) * (SK_FREETYPE_LCD_LERP) >> 8);
+ }
+ 
+ static uint16_t packLCD16(unsigned r, unsigned g, unsigned b) {
+diff --git a/gfx/skia/src/core/SkScan_AntiPath.cpp b/gfx/skia/src/core/SkScan_AntiPath.cpp
+--- a/gfx/skia/src/core/SkScan_AntiPath.cpp
++++ b/gfx/skia/src/core/SkScan_AntiPath.cpp
+@@ -230,52 +230,16 @@ void SuperBlitter::blitH(int x, int y, i
+                          fOffsetX);
+ 
+ #ifdef SK_DEBUG
+     fRuns.assertValid(y & MASK, (1 << (8 - SHIFT)));
+     fCurrX = x + width;
+ #endif
+ }
+ 
+-static void set_left_rite_runs(SkAlphaRuns& runs, int ileft, U8CPU leftA,
+-                               int n, U8CPU riteA) {
+-    SkASSERT(leftA <= 0xFF);
+-    SkASSERT(riteA <= 0xFF);
+-
+-    int16_t* run = runs.fRuns;
+-    uint8_t* aa = runs.fAlpha;
+-
+-    if (ileft > 0) {
+-        run[0] = ileft;
+-        aa[0] = 0;
+-        run += ileft;
+-        aa += ileft;
+-    }
+-
+-    SkASSERT(leftA < 0xFF);
+-    if (leftA > 0) {
+-        *run++ = 1;
+-        *aa++ = leftA;
+-    }
+-
+-    if (n > 0) {
+-        run[0] = n;
+-        aa[0] = 0xFF;
+-        run += n;
+-        aa += n;
+-    }
+-
+-    SkASSERT(riteA < 0xFF);
+-    if (riteA > 0) {
+-        *run++ = 1;
+-        *aa++ = riteA;
+-    }
+-    run[0] = 0;
+-}
+-
+ void SuperBlitter::blitRect(int x, int y, int width, int height) {
+     SkASSERT(width > 0);
+     SkASSERT(height > 0);
+ 
+     // blit leading rows
+     while ((y & MASK)) {
+         this->blitH(x, y++, width);
+         if (--height <= 0) {
+diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp
+--- a/gfx/skia/src/effects/SkGradientShader.cpp
++++ b/gfx/skia/src/effects/SkGradientShader.cpp
+@@ -865,45 +865,16 @@ bool Linear_Gradient::setContext(const S
+     } while (0)
+ 
+ namespace {
+ 
+ typedef void (*LinearShadeProc)(TileProc proc, SkFixed dx, SkFixed fx,
+                                 SkPMColor* dstC, const SkPMColor* cache,
+                                 int toggle, int count);
+ 
+-// This function is deprecated, and will be replaced by 
+-// shadeSpan_linear_vertical_lerp() once Chrome has been weaned off of it.
+-void shadeSpan_linear_vertical(TileProc proc, SkFixed dx, SkFixed fx,
+-                               SkPMColor* SK_RESTRICT dstC,
+-                               const SkPMColor* SK_RESTRICT cache,
+-                               int toggle, int count) {
+-    if (proc == clamp_tileproc) {
+-        // Read out clamp values from beginning/end of the cache. No need to lerp
+-        // or dither
+-        if (fx < 0) {
+-            sk_memset32(dstC, cache[-1], count);
+-            return;
+-        } else if (fx > 0xFFFF) {
+-            sk_memset32(dstC, cache[Gradient_Shader::kCache32Count * 2], count);
+-            return;
+-        }
+-    }
+-
+-    // We're a vertical gradient, so no change in a span.
+-    // If colors change sharply across the gradient, dithering is
+-    // insufficient (it subsamples the color space) and we need to lerp.
+-    unsigned fullIndex = proc(fx);
+-    unsigned fi = fullIndex >> (16 - Gradient_Shader::kCache32Bits);
+-    sk_memset32_dither(dstC,
+-            cache[toggle + fi],
+-            cache[(toggle ^ Gradient_Shader::kDitherStride32) + fi],
+-            count);
+-}
+-
+ // Linear interpolation (lerp) is unnecessary if there are no sharp
+ // discontinuities in the gradient - which must be true if there are
+ // only 2 colors - but it's cheap.
+ void shadeSpan_linear_vertical_lerp(TileProc proc, SkFixed dx, SkFixed fx,
+                                     SkPMColor* SK_RESTRICT dstC,
+                                     const SkPMColor* SK_RESTRICT cache,
+                                     int toggle, int count) {
+     if (proc == clamp_tileproc) {
+@@ -2131,16 +2102,18 @@ protected:
+         buffer.writePoint(fCenter);
+     }
+ 
+ private:
+     typedef Gradient_Shader INHERITED;
+     const SkPoint fCenter;
+ };
+ 
++#ifndef SK_SCALAR_IS_FLOAT 
++
+ #ifdef COMPUTE_SWEEP_TABLE
+ #define PI  3.14159265
+ static bool gSweepTableReady;
+ static uint8_t gSweepTable[65];
+ 
+ /*  Our table stores precomputed values for atan: [0...1] -> [0..PI/4]
+     We scale the results to [0..32]
+ */
+@@ -2168,20 +2141,23 @@ static const uint8_t gSweepTable[] = {
+     10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18,
+     19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26,
+     26, 27, 27, 27, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32,
+     32
+ };
+ static const uint8_t* build_sweep_table() { return gSweepTable; }
+ #endif
+ 
++#endif
++
+ // divide numer/denom, with a bias of 6bits. Assumes numer <= denom
+ // and denom != 0. Since our table is 6bits big (+1), this is a nice fit.
+ // Same as (but faster than) SkFixedDiv(numer, denom) >> 10
+ 
++#ifndef SK_SCALAR_IS_FLOAT
+ //unsigned div_64(int numer, int denom);
+ static unsigned div_64(int numer, int denom) {
+     SkASSERT(numer <= denom);
+     SkASSERT(numer > 0);
+     SkASSERT(denom > 0);
+ 
+     int nbits = SkCLZ(numer);
+     int dbits = SkCLZ(denom);
+@@ -2294,16 +2270,17 @@ static unsigned atan_0_90(SkFixed y, SkF
+         result = 64 - result;
+         // pin to 63
+         result -= result >> 6;
+     }
+ 
+     SkASSERT(result <= 63);
+     return result;
+ }
++#endif
+ 
+ //  returns angle in a circle [0..2PI) -> [0..255]
+ #ifdef SK_SCALAR_IS_FLOAT
+ static unsigned SkATan2_255(float y, float x) {
+     //    static const float g255Over2PI = 255 / (2 * SK_ScalarPI);
+     static const float g255Over2PI = 40.584510488433314f;
+     
+     float result = sk_float_atan2(y, x);
+diff --git a/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp b/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp
+--- a/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp
++++ b/gfx/skia/src/opts/SkBlitRect_opts_SSE2.cpp
+@@ -112,17 +112,17 @@ void BlitRect32_OpaqueWide_SSE2(SkPMColo
+ }
+ 
+ void ColorRect32_SSE2(SkPMColor* destination,
+                       int width, int height,
+                       size_t rowBytes, uint32_t color) {
+     if (0 == height || 0 == width || 0 == color) {
+         return;
+     }
+-    unsigned colorA = SkGetPackedA32(color);
++    //unsigned colorA = SkGetPackedA32(color);
+     //if (255 == colorA) {
+         //if (width < 31) {
+             //BlitRect32_OpaqueNarrow_SSE2(destination, width, height,
+                                          //rowBytes, color);
+         //} else {
+             //BlitRect32_OpaqueWide_SSE2(destination, width, height,
+                                        //rowBytes, color);
+         //}
+diff --git a/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp b/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
+--- a/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
++++ b/gfx/skia/src/ports/SkFontHost_mac_coretext.cpp
+@@ -75,20 +75,16 @@ static CGFloat CGRectGetMinY_inline(cons
+ static CGFloat CGRectGetMaxY_inline(const CGRect& rect) {
+     return rect.origin.y + rect.size.height;
+ }
+ 
+ static CGFloat CGRectGetWidth_inline(const CGRect& rect) {
+     return rect.size.width;
+ }
+ 
+-static CGFloat CGRectGetHeight(const CGRect& rect) {
+-    return rect.size.height;
+-}
+-
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ static void sk_memset_rect32(uint32_t* ptr, uint32_t value, size_t width,
+                              size_t height, size_t rowBytes) {
+     SkASSERT(width);
+     SkASSERT(width * sizeof(uint32_t) <= rowBytes);
+ 
+     if (width >= 32) {
+@@ -125,28 +121,30 @@ static void sk_memset_rect32(uint32_t* p
+                 *ptr++ = value;
+             } while (--w > 0);
+             ptr = (uint32_t*)((char*)ptr + rowBytes);
+             height -= 1;
+         }
+     }
+ }
+ 
++#if 0
+ // Potentially this should be made (1) public (2) optimized when width is small.
+ // Also might want 16 and 32 bit version
+ //
+ static void sk_memset_rect(void* ptr, U8CPU byte, size_t width, size_t height,
+                            size_t rowBytes) {
+     uint8_t* dst = (uint8_t*)ptr;
+     while (height) {
+         memset(dst, byte, width);
+         dst += rowBytes;
+         height -= 1;
+     }
+ }
++#endif
+ 
+ #include <sys/utsname.h>
+ 
+ typedef uint32_t CGRGBPixel;
+ 
+ static unsigned CGRGBPixel_getAlpha(CGRGBPixel pixel) {
+     return pixel & 0xFF;
+ }
+@@ -250,23 +248,16 @@ static CGAffineTransform MatrixToCGAffin
+     return CGAffineTransformMake(ScalarToCG(matrix[SkMatrix::kMScaleX]) * sx,
+                                  -ScalarToCG(matrix[SkMatrix::kMSkewY]) * sy,
+                                  -ScalarToCG(matrix[SkMatrix::kMSkewX]) * sx,
+                                  ScalarToCG(matrix[SkMatrix::kMScaleY]) * sy,
+                                  ScalarToCG(matrix[SkMatrix::kMTransX]) * sx,
+                                  ScalarToCG(matrix[SkMatrix::kMTransY]) * sy);
+ }
+ 
+-static void CGAffineTransformToMatrix(const CGAffineTransform& xform, SkMatrix* matrix) {
+-    matrix->setAll(
+-                   CGToScalar(xform.a), CGToScalar(xform.c), CGToScalar(xform.tx),
+-                   CGToScalar(xform.b), CGToScalar(xform.d), CGToScalar(xform.ty),
+-                   0, 0, SK_Scalar1);
+-}
+-
+ static SkScalar getFontScale(CGFontRef cgFont) {
+     int unitsPerEm = CGFontGetUnitsPerEm(cgFont);
+     return SkScalarInvert(SkIntToScalar(unitsPerEm));
+ }
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ #define BITMAP_INFO_RGB     (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host)
+@@ -1075,16 +1066,17 @@ static const uint8_t* getInverseTable(bo
+     if (!gInited) {
+         build_power_table(gWhiteTable, 1.5f);
+         build_power_table(gTable, 2.2f);
+         gInited = true;
+     }
+     return isWhite ? gWhiteTable : gTable;
+ }
+ 
++#ifdef SK_USE_COLOR_LUMINANCE
+ static const uint8_t* getGammaTable(U8CPU luminance) {
+     static uint8_t gGammaTables[4][256];
+     static bool gInited;
+     if (!gInited) {
+ #if 1
+         float start = 1.1;
+         float stop = 2.1;
+         for (int i = 0; i < 4; ++i) {
+@@ -1097,45 +1089,49 @@ static const uint8_t* getGammaTable(U8CP
+         build_power_table(gGammaTables[2], 1);
+         build_power_table(gGammaTables[3], 1);
+ #endif
+         gInited = true;
+     }
+     SkASSERT(0 == (luminance >> 8));
+     return gGammaTables[luminance >> 6];
+ }
++#endif
+ 
++#ifndef SK_USE_COLOR_LUMINANCE
+ static void invertGammaMask(bool isWhite, CGRGBPixel rgb[], int width,
+                             int height, size_t rb) {
+     const uint8_t* table = getInverseTable(isWhite);
+     for (int y = 0; y < height; ++y) {
+         for (int x = 0; x < width; ++x) {
+             uint32_t c = rgb[x];
+             int r = (c >> 16) & 0xFF;
+             int g = (c >>  8) & 0xFF;
+             int b = (c >>  0) & 0xFF;
+             rgb[x] = (table[r] << 16) | (table[g] << 8) | table[b];
+         }
+         rgb = (CGRGBPixel*)((char*)rgb + rb);
+     }
+ }
++#endif
+ 
+ static void cgpixels_to_bits(uint8_t dst[], const CGRGBPixel src[], int count) {
+     while (count > 0) {
+         uint8_t mask = 0;
+         for (int i = 7; i >= 0; --i) {
+             mask |= (CGRGBPixel_getAlpha(*src++) >> 7) << i;
+             if (0 == --count) {
+                 break;
+             }
+         }
+         *dst++ = mask;
+     }
+ }
+ 
++#ifdef SK_USE_COLOR_LUMINANCE
+ static int lerpScale(int dst, int src, int scale) {
+     return dst + (scale * (src - dst) >> 23);
+ }
+ 
+ static CGRGBPixel lerpPixel(CGRGBPixel dst, CGRGBPixel src,
+                             int scaleR, int scaleG, int scaleB) {
+     int sr = (src >> 16) & 0xFF;
+     int sg = (src >>  8) & 0xFF;
+@@ -1147,37 +1143,31 @@ static CGRGBPixel lerpPixel(CGRGBPixel d
+     int rr = lerpScale(dr, sr, scaleR);
+     int rg = lerpScale(dg, sg, scaleG);
+     int rb = lerpScale(db, sb, scaleB);
+     return (rr << 16) | (rg << 8) | rb;
+ }
+ 
+ static void lerpPixels(CGRGBPixel dst[], const CGRGBPixel src[], int width,
+                        int height, int rowBytes, int lumBits) {
+-#ifdef SK_USE_COLOR_LUMINANCE
+     int scaleR = (1 << 23) * SkColorGetR(lumBits) / 0xFF;
+     int scaleG = (1 << 23) * SkColorGetG(lumBits) / 0xFF;
+     int scaleB = (1 << 23) * SkColorGetB(lumBits) / 0xFF;
+-#else
+-    int scale = (1 << 23) * lumBits / SkScalerContext::kLuminance_Max;
+-    int scaleR = scale;
+-    int scaleG = scale;
+-    int scaleB = scale;
+-#endif
+ 
+     for (int y = 0; y < height; ++y) {
+         for (int x = 0; x < width; ++x) {
+             // bit-not the src, since it was drawn from black, so we need the
+             // compliment of those bits
+             dst[x] = lerpPixel(dst[x], ~src[x], scaleR, scaleG, scaleB);
+         }
+         src = (CGRGBPixel*)((char*)src + rowBytes);
+         dst = (CGRGBPixel*)((char*)dst + rowBytes);
+     }
+ }
++#endif
+ 
+ #if 1
+ static inline int r32_to_16(int x) { return SkR32ToR16(x); }
+ static inline int g32_to_16(int x) { return SkG32ToG16(x); }
+ static inline int b32_to_16(int x) { return SkB32ToB16(x); }
+ #else
+ static inline int round8to5(int x) {
+     return (x + 3 - (x >> 5) + (x >> 7)) >> 3;
+@@ -1212,22 +1202,21 @@ static inline uint32_t rgb_to_lcd32(CGRG
+     return SkPackARGB32(0xFF, r, g, b);
+ }
+ 
+ #define BLACK_LUMINANCE_LIMIT   0x40
+ #define WHITE_LUMINANCE_LIMIT   0xA0
+ 
+ void SkScalerContext_Mac::generateImage(const SkGlyph& glyph) {
+     CGGlyph cgGlyph = (CGGlyph) glyph.getGlyphID(fBaseGlyphCount);
+-
+     const bool isLCD = isLCDFormat(glyph.fMaskFormat);
++#ifdef SK_USE_COLOR_LUMINANCE
+     const bool isBW = SkMask::kBW_Format == glyph.fMaskFormat;
+     const bool isA8 = !isLCD && !isBW;
+-    
+-#ifdef SK_USE_COLOR_LUMINANCE
++
+     unsigned lumBits = fRec.getLuminanceColor();
+     uint32_t xorMask = 0;
+ 
+     if (isA8) {
+         // for A8, we just want a component (they're all the same)
+         lumBits = SkColorGetR(lumBits);
+     }
+ #else
+diff --git a/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp b/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp
+--- a/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp
++++ b/gfx/skia/src/utils/mac/SkCreateCGImageRef.cpp
+@@ -163,59 +163,8 @@ private:
+     CGPDFDocumentRef fDoc;
+ };
+ 
+ static void CGDataProviderReleaseData_FromMalloc(void*, const void* data,
+                                                  size_t size) {
+     sk_free((void*)data);
+ }
+ 
+-bool SkPDFDocumentToBitmap(SkStream* stream, SkBitmap* output) {
+-    size_t size = stream->getLength();
+-    void* ptr = sk_malloc_throw(size);
+-    stream->read(ptr, size);
+-    CGDataProviderRef data = CGDataProviderCreateWithData(NULL, ptr, size,
+-                                          CGDataProviderReleaseData_FromMalloc);
+-    if (NULL == data) {
+-        return false;
+-    }
+-    
+-    CGPDFDocumentRef pdf = CGPDFDocumentCreateWithProvider(data);
+-    CGDataProviderRelease(data);
+-    if (NULL == pdf) {
+-        return false;
+-    }
+-    SkAutoPDFRelease releaseMe(pdf);
+-
+-    CGPDFPageRef page = CGPDFDocumentGetPage(pdf, 1);
+-    if (NULL == page) {
+-        return false;
+-    }
+-    
+-    CGRect bounds = CGPDFPageGetBoxRect(page, kCGPDFMediaBox);
+-    
+-    int w = (int)CGRectGetWidth(bounds);
+-    int h = (int)CGRectGetHeight(bounds);
+-        
+-    SkBitmap bitmap;
+-    bitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h);
+-    bitmap.allocPixels();
+-    bitmap.eraseColor(SK_ColorWHITE);
+-
+-    size_t bitsPerComponent;
+-    CGBitmapInfo info;
+-    getBitmapInfo(bitmap, &bitsPerComponent, &info, NULL); 
+-
+-    CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
+-    CGContextRef ctx = CGBitmapContextCreate(bitmap.getPixels(), w, h,
+-                                             bitsPerComponent, bitmap.rowBytes(),
+-                                             cs, info);
+-    CGColorSpaceRelease(cs);
+-
+-    if (ctx) {
+-        CGContextDrawPDFPage(ctx, page);
+-        CGContextRelease(ctx);
+-    }
+-
+-    output->swap(bitmap);
+-    return true;
+-}
+-
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0016-Bug-718849-Radial-gradients.patch
@@ -0,0 +1,400 @@
+# HG changeset patch
+# User Matt Woodrow <mwoodrow@mozilla.com>
+# Date 1339988782 -43200
+# Node ID 1e9dae659ee6c992f719fd4136efbcc5410ded37
+# Parent 946750f6d95febd199fb7b748e9d2c48fd01c8a6
+[mq]: skia-windows-gradients
+
+diff --git a/gfx/skia/src/effects/SkGradientShader.cpp b/gfx/skia/src/effects/SkGradientShader.cpp
+--- a/gfx/skia/src/effects/SkGradientShader.cpp
++++ b/gfx/skia/src/effects/SkGradientShader.cpp
+@@ -847,16 +847,19 @@ bool Linear_Gradient::setContext(const S
+         fFlags |= SkShader::kConstInY32_Flag;
+         if ((fFlags & SkShader::kHasSpan16_Flag) && !paint.isDither()) {
+             // only claim this if we do have a 16bit mode (i.e. none of our
+             // colors have alpha), and if we are not dithering (which obviously
+             // is not const in Y).
+             fFlags |= SkShader::kConstInY16_Flag;
+         }
+     }
++    if (fStart == fEnd) {
++        fFlags &= ~kOpaqueAlpha_Flag;
++    }
+     return true;
+ }
+ 
+ #define NO_CHECK_ITER               \
+     do {                            \
+     unsigned fi = fx >> Gradient_Shader::kCache32Shift; \
+     SkASSERT(fi <= 0xFF);           \
+     fx += dx;                       \
+@@ -976,16 +979,21 @@ void Linear_Gradient::shadeSpan(int x, i
+     TileProc            proc = fTileProc;
+     const SkPMColor* SK_RESTRICT cache = this->getCache32();
+ #ifdef USE_DITHER_32BIT_GRADIENT
+     int                 toggle = ((x ^ y) & 1) * kDitherStride32;
+ #else
+     int toggle = 0;
+ #endif
+ 
++    if (fStart == fEnd) {
++        sk_bzero(dstC, count * sizeof(*dstC));
++        return;
++    }
++
+     if (fDstToIndexClass != kPerspective_MatrixClass) {
+         dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf,
+                              SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
+         SkFixed dx, fx = SkScalarToFixed(srcPt.fX);
+ 
+         if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
+             SkFixed dxStorage[1];
+             (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), dxStorage, NULL);
+@@ -1169,16 +1177,21 @@ void Linear_Gradient::shadeSpan16(int x,
+     SkASSERT(count > 0);
+ 
+     SkPoint             srcPt;
+     SkMatrix::MapXYProc dstProc = fDstToIndexProc;
+     TileProc            proc = fTileProc;
+     const uint16_t* SK_RESTRICT cache = this->getCache16();
+     int                 toggle = ((x ^ y) & 1) * kDitherStride16;
+ 
++    if (fStart == fEnd) {
++        sk_bzero(dstC, count * sizeof(*dstC));
++        return;
++    }
++
+     if (fDstToIndexClass != kPerspective_MatrixClass) {
+         dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf,
+                              SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
+         SkFixed dx, fx = SkScalarToFixed(srcPt.fX);
+ 
+         if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
+             SkFixed dxStorage[1];
+             (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), dxStorage, NULL);
+@@ -1739,21 +1752,25 @@ void Radial_Gradient::shadeSpan(int x, i
+    possible circles on which the point may fall.  Solving for t yields
+    the gradient value to use.
+ 
+    If a<0, the start circle is entirely contained in the
+    end circle, and one of the roots will be <0 or >1 (off the line
+    segment).  If a>0, the start circle falls at least partially
+    outside the end circle (or vice versa), and the gradient
+    defines a "tube" where a point may be on one circle (on the
+-   inside of the tube) or the other (outside of the tube).  We choose
+-   one arbitrarily.
++   inside of the tube) or the other (outside of the tube). We choose
++   the one with the highest t value, as long as the radius that it 
++   corresponds to is >=0. In the case where neither root has a positive
++   radius, we don't draw anything.
+ 
++   XXXmattwoodrow: I've removed this for now since it breaks
++   down when Dr == 0. Is there something else we can do instead?
+    In order to keep the math to within the limits of fixed point,
+-   we divide the entire quadratic by Dr^2, and replace
++   we divide the entire quadratic by Dr, and replace
+    (x - Sx)/Dr with x' and (y - Sy)/Dr with y', giving
+ 
+    [Dx^2 / Dr^2 + Dy^2 / Dr^2 - 1)] * t^2
+    + 2 * [x' * Dx / Dr + y' * Dy / Dr - Sr / Dr] * t
+    + [x'^2 + y'^2 - Sr^2/Dr^2] = 0
+ 
+    (x' and y' are computed by appending the subtract and scale to the
+    fDstToIndex matrix in the constructor).
+@@ -1763,99 +1780,122 @@ void Radial_Gradient::shadeSpan(int x, i
+    x' and y', if x and y are linear in the span, 'B' can be computed
+    incrementally with a simple delta (db below).  If it is not (e.g.,
+    a perspective projection), it must be computed in the loop.
+ 
+ */
+ 
+ namespace {
+ 
+-inline SkFixed two_point_radial(SkScalar b, SkScalar fx, SkScalar fy,
+-                                SkScalar sr2d2, SkScalar foura,
+-                                SkScalar oneOverTwoA, bool posRoot) {
++inline bool two_point_radial(SkScalar b, SkScalar fx, SkScalar fy,
++                             SkScalar sr2d2, SkScalar foura,
++                             SkScalar oneOverTwoA, SkScalar diffRadius, 
++                             SkScalar startRadius, SkFixed& t) {
+     SkScalar c = SkScalarSquare(fx) + SkScalarSquare(fy) - sr2d2;
+     if (0 == foura) {
+-        return SkScalarToFixed(SkScalarDiv(-c, b));
++        SkScalar result = SkScalarDiv(-c, b);
++        if (result * diffRadius + startRadius >= 0) {
++            t = SkScalarToFixed(result);
++            return true;
++        }
++        return false;
+     }
+ 
+     SkScalar discrim = SkScalarSquare(b) - SkScalarMul(foura, c);
+     if (discrim < 0) {
+-        discrim = -discrim;
++        return false;
+     }
+     SkScalar rootDiscrim = SkScalarSqrt(discrim);
+-    SkScalar result;
+-    if (posRoot) {
+-        result = SkScalarMul(-b + rootDiscrim, oneOverTwoA);
+-    } else {
+-        result = SkScalarMul(-b - rootDiscrim, oneOverTwoA);
++
++    // Make sure the results corresponds to a positive radius.
++    SkScalar result = SkScalarMul(-b + rootDiscrim, oneOverTwoA);
++    if (result * diffRadius + startRadius >= 0) {
++        t = SkScalarToFixed(result);
++        return true;
+     }
+-    return SkScalarToFixed(result);
++    result = SkScalarMul(-b - rootDiscrim, oneOverTwoA);
++    if (result * diffRadius + startRadius >= 0) {
++        t = SkScalarToFixed(result);
++        return true;
++    }
++
++    return false;
+ }
+ 
+ typedef void (* TwoPointRadialShadeProc)(SkScalar fx, SkScalar dx,
+         SkScalar fy, SkScalar dy,
+         SkScalar b, SkScalar db,
+-        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA, bool posRoot,
++        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA,
++        SkScalar fDiffRadius, SkScalar fRadius1,
+         SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RESTRICT cache,
+         int count);
+ 
+ void shadeSpan_twopoint_clamp(SkScalar fx, SkScalar dx,
+         SkScalar fy, SkScalar dy,
+         SkScalar b, SkScalar db,
+-        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA, bool posRoot,
++        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA,
++        SkScalar fDiffRadius, SkScalar fRadius1,
+         SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RESTRICT cache,
+         int count) {
+     for (; count > 0; --count) {
+-        SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
+-                                     fOneOverTwoA, posRoot);
+-
+-        if (t < 0) {
++        SkFixed t;
++        if (!two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, fDiffRadius, fRadius1, t)) {
++          *(dstC++) = 0;
++        } else if (t < 0) {
+             *dstC++ = cache[-1];
+         } else if (t > 0xFFFF) {
+             *dstC++ = cache[Gradient_Shader::kCache32Count * 2];
+         } else {
+             SkASSERT(t <= 0xFFFF);
+             *dstC++ = cache[t >> Gradient_Shader::kCache32Shift];
+         }
+ 
+         fx += dx;
+         fy += dy;
+         b += db;
+     }
+ }
+ void shadeSpan_twopoint_mirror(SkScalar fx, SkScalar dx,
+         SkScalar fy, SkScalar dy,
+         SkScalar b, SkScalar db,
+-        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA, bool posRoot,
++        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA,
++        SkScalar fDiffRadius, SkScalar fRadius1,
+         SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RESTRICT cache,
+         int count) {
+     for (; count > 0; --count) {
+-        SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
+-                                     fOneOverTwoA, posRoot);
+-        SkFixed index = mirror_tileproc(t);
+-        SkASSERT(index <= 0xFFFF);
+-        *dstC++ = cache[index >> Gradient_Shader::kCache32Shift];
++        SkFixed t;
++        if (!two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, fDiffRadius, fRadius1, t)) {
++          *(dstC++) = 0;
++        } else {
++          SkFixed index = mirror_tileproc(t);
++          SkASSERT(index <= 0xFFFF);
++          *dstC++ = cache[index >> (16 - Gradient_Shader::kCache32Shift)];
++        }
+         fx += dx;
+         fy += dy;
+         b += db;
+     }
+ }
+ 
+ void shadeSpan_twopoint_repeat(SkScalar fx, SkScalar dx,
+         SkScalar fy, SkScalar dy,
+         SkScalar b, SkScalar db,
+-        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA, bool posRoot,
++        SkScalar fSr2D2, SkScalar foura, SkScalar fOneOverTwoA, 
++        SkScalar fDiffRadius, SkScalar fRadius1,
+         SkPMColor* SK_RESTRICT dstC, const SkPMColor* SK_RESTRICT cache,
+         int count) {
+     for (; count > 0; --count) {
+-        SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
+-                                     fOneOverTwoA, posRoot);
+-        SkFixed index = repeat_tileproc(t);
+-        SkASSERT(index <= 0xFFFF);
+-        *dstC++ = cache[index >> Gradient_Shader::kCache32Shift];
++        SkFixed t;
++        if (!two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, fDiffRadius, fRadius1, t)) {
++          *(dstC++) = 0;
++        } else {
++          SkFixed index = repeat_tileproc(t);
++          SkASSERT(index <= 0xFFFF);
++          *dstC++ = cache[index >> (16 - Gradient_Shader::kCache32Shift)];
++        }
+         fx += dx;
+         fy += dy;
+         b += db;
+     }
+ }
+ 
+ 
+ 
+@@ -1935,17 +1975,16 @@ public:
+           sk_bzero(dstC, count * sizeof(*dstC));
+           return;
+         }
+         SkMatrix::MapXYProc dstProc = fDstToIndexProc;
+         TileProc            proc = fTileProc;
+         const SkPMColor* SK_RESTRICT cache = this->getCache32();
+ 
+         SkScalar foura = fA * 4;
+-        bool posRoot = fDiffRadius < 0;
+         if (fDstToIndexClass != kPerspective_MatrixClass) {
+             SkPoint srcPt;
+             dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf,
+                                  SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
+             SkScalar dx, fx = srcPt.fX;
+             SkScalar dy, fy = srcPt.fY;
+ 
+             if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
+@@ -1954,60 +1993,69 @@ public:
+                 dx = SkFixedToScalar(fixedX);
+                 dy = SkFixedToScalar(fixedY);
+             } else {
+                 SkASSERT(fDstToIndexClass == kLinear_MatrixClass);
+                 dx = fDstToIndex.getScaleX();
+                 dy = fDstToIndex.getSkewY();
+             }
+             SkScalar b = (SkScalarMul(fDiff.fX, fx) +
+-                         SkScalarMul(fDiff.fY, fy) - fStartRadius) * 2;
++                          SkScalarMul(fDiff.fY, fy) - fStartRadius * fDiffRadius) * 2;
+             SkScalar db = (SkScalarMul(fDiff.fX, dx) +
+                           SkScalarMul(fDiff.fY, dy)) * 2;
+ 
+             TwoPointRadialShadeProc shadeProc = shadeSpan_twopoint_repeat;
+             if (proc == clamp_tileproc) {
+                 shadeProc = shadeSpan_twopoint_clamp;
+             } else if (proc == mirror_tileproc) {
+                 shadeProc = shadeSpan_twopoint_mirror;
+             } else {
+                 SkASSERT(proc == repeat_tileproc);
+             }
+             (*shadeProc)(fx, dx, fy, dy, b, db,
+-                         fSr2D2, foura, fOneOverTwoA, posRoot,
++                         fSr2D2, foura, fOneOverTwoA, fDiffRadius, fRadius1,
+                          dstC, cache, count);
+         } else {    // perspective case
+             SkScalar dstX = SkIntToScalar(x);
+             SkScalar dstY = SkIntToScalar(y);
+             for (; count > 0; --count) {
+                 SkPoint             srcPt;
+                 dstProc(fDstToIndex, dstX, dstY, &srcPt);
+                 SkScalar fx = srcPt.fX;
+                 SkScalar fy = srcPt.fY;
+                 SkScalar b = (SkScalarMul(fDiff.fX, fx) +
+                              SkScalarMul(fDiff.fY, fy) - fStartRadius) * 2;
+-                SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura,
+-                                             fOneOverTwoA, posRoot);
+-                SkFixed index = proc(t);
+-                SkASSERT(index <= 0xFFFF);
+-                *dstC++ = cache[index >> Gradient_Shader::kCache32Shift];
++                SkFixed t;
++                if (!two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, fDiffRadius, fRadius1, t)) {
++                  *(dstC++) = 0;
++                } else {
++                  SkFixed index = proc(t);
++                  SkASSERT(index <= 0xFFFF);
++                  *dstC++ = cache[index >> (16 - kCache32Bits)];
++                }
+                 dstX += SK_Scalar1;
+             }
+         }
+     }
+ 
+     virtual bool setContext(const SkBitmap& device,
+                             const SkPaint& paint,
+                             const SkMatrix& matrix) SK_OVERRIDE {
+         if (!this->INHERITED::setContext(device, paint, matrix)) {
+             return false;
+         }
+ 
+         // we don't have a span16 proc
+         fFlags &= ~kHasSpan16_Flag;
++
++        // If we might end up wanting to draw nothing as part of the gradient
++        // then we should mark ourselves as not being opaque.
++        if (fA >= 0 || (fDiffRadius == 0 && fCenter1 == fCenter2)) {
++            fFlags &= ~kOpaqueAlpha_Flag;
++        }
+         return true;
+     }
+ 
+     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Two_Point_Radial_Gradient)
+ 
+ protected:
+     Two_Point_Radial_Gradient(SkFlattenableReadBuffer& buffer)
+             : INHERITED(buffer),
+@@ -2033,26 +2081,22 @@ private:
+     const SkScalar fRadius1;
+     const SkScalar fRadius2;
+     SkPoint fDiff;
+     SkScalar fStartRadius, fDiffRadius, fSr2D2, fA, fOneOverTwoA;
+ 
+     void init() {
+         fDiff = fCenter1 - fCenter2;
+         fDiffRadius = fRadius2 - fRadius1;
+-        SkScalar inv = SkScalarInvert(fDiffRadius);
+-        fDiff.fX = SkScalarMul(fDiff.fX, inv);
+-        fDiff.fY = SkScalarMul(fDiff.fY, inv);
+-        fStartRadius = SkScalarMul(fRadius1, inv);
++        fStartRadius = fRadius1;
+         fSr2D2 = SkScalarSquare(fStartRadius);
+-        fA = SkScalarSquare(fDiff.fX) + SkScalarSquare(fDiff.fY) - SK_Scalar1;
++        fA = SkScalarSquare(fDiff.fX) + SkScalarSquare(fDiff.fY) - SkScalarSquare(fDiffRadius);
+         fOneOverTwoA = fA ? SkScalarInvert(fA * 2) : 0;
+ 
+         fPtsToUnit.setTranslate(-fCenter1.fX, -fCenter1.fY);
+-        fPtsToUnit.postScale(inv, inv);
+     }
+ };
+ 
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ class Sweep_Gradient : public Gradient_Shader {
+ public:
+     Sweep_Gradient(SkScalar cx, SkScalar cy, const SkColor colors[],
+@@ -2488,16 +2532,20 @@ SkShader* SkGradientShader::CreateTwoPoi
+                                                  int colorCount,
+                                                  SkShader::TileMode mode,
+                                                  SkUnitMapper* mapper) {
+     if (startRadius < 0 || endRadius < 0 || NULL == colors || colorCount < 1) {
+         return NULL;
+     }
+     EXPAND_1_COLOR(colorCount);
+ 
++    if (start == end && startRadius == 0) {
++        return CreateRadial(start, endRadius, colors, pos, colorCount, mode, mapper);
++    }
++
+     return SkNEW_ARGS(Two_Point_Radial_Gradient,
+                       (start, startRadius, end, endRadius, colors, pos,
+                        colorCount, mode, mapper));
+ }
+ 
+ SkShader* SkGradientShader::CreateSweep(SkScalar cx, SkScalar cy,
+                                         const SkColor colors[],
+                                         const SkScalar pos[],
new file mode 100644
--- /dev/null
+++ b/gfx/skia/patches/archive/0017-Bug-740194-SkMemory-mozalloc.patch
@@ -0,0 +1,73 @@
+commit 5786f516119bcb677510f3c9256b870c3b5616c8
+Author: George Wright <gwright@mozilla.com>
+Date:   Wed Aug 15 23:51:34 2012 -0400
+
+    Bug 740194 - [Skia] Implement a version of SkMemory for Mozilla that uses the infallible mozalloc allocators r=cjones
+
+diff --git a/gfx/skia/include/config/SkUserConfig.h b/gfx/skia/include/config/SkUserConfig.h
+index f98ba85..17be191 100644
+--- a/gfx/skia/include/config/SkUserConfig.h
++++ b/gfx/skia/include/config/SkUserConfig.h
+@@ -35,6 +35,16 @@
+     commented out, so including it will have no effect.
+ */
+ 
++/*
++    Override new/delete with Mozilla's allocator, mozalloc
++
++    Ideally we shouldn't need to do this here, but until
++    http://code.google.com/p/skia/issues/detail?id=598 is fixed
++    we need to include this here to override operator new and delete
++*/
++
++#include "mozilla/mozalloc.h"
++
+ ///////////////////////////////////////////////////////////////////////////////
+ 
+ /*  Scalars (the fractional value type in skia) can be implemented either as
+diff --git a/gfx/skia/src/ports/SkMemory_mozalloc.cpp b/gfx/skia/src/ports/SkMemory_mozalloc.cpp
+new file mode 100644
+index 0000000..1f16ee5
+--- /dev/null
++++ b/gfx/skia/src/ports/SkMemory_mozalloc.cpp
+@@ -0,0 +1,40 @@
++/*
++ * Copyright 2011 Google Inc.
++ * Copyright 2012 Mozilla Foundation
++ *
++ * Use of this source code is governed by a BSD-style license that can be
++ * found in the LICENSE file.
++ */
++
++#include "SkTypes.h"
++
++#include "mozilla/mozalloc.h"
++#include "mozilla/mozalloc_abort.h"
++#include "mozilla/mozalloc_oom.h"
++
++void sk_throw() {
++    SkDEBUGFAIL("sk_throw");
++    mozalloc_abort("Abort from sk_throw");
++}
++
++void sk_out_of_memory(void) {
++    SkDEBUGFAIL("sk_out_of_memory");
++    mozalloc_handle_oom(0);
++}
++
++void* sk_malloc_throw(size_t size) {
++    return sk_malloc_flags(size, SK_MALLOC_THROW);
++}
++
++void* sk_realloc_throw(void* addr, size_t size) {
++    return moz_xrealloc(addr, size);
++}
++
++void sk_free(void* p) {
++    moz_free(p);
++}
++
++void* sk_malloc_flags(size_t size, unsigned flags) {
++    return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : moz_malloc(size);
++}
++