Back out 5ddda2b25e28 and 3abfdb807a4f (bug 699258) for crashes in WinXP tests
authorMatt Brubeck <mbrubeck@mozilla.com>
Fri, 11 Nov 2011 17:49:47 -0800
changeset 81825 c02f29cef915f106cc67e43bf0f57cf15605a6ca
parent 81824 8ac0226cb220d3cd0378519a594b5f682336206f
child 81826 b914869ee1e03c4df1e31828c1a494cba32b045e
child 81830 80154fc0c58293a003f248c754c9fe308dea1195
push idunknown
push userunknown
push dateunknown
bugs699258
milestone11.0a1
backs out5ddda2b25e287b389a356da31de1dc816ef16b35
Back out 5ddda2b25e28 and 3abfdb807a4f (bug 699258) for crashes in WinXP tests
content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
gfx/2d/Factory.cpp
gfx/2d/Makefile.in
gfx/2d/ScaledFontWin.cpp
gfx/2d/ScaledFontWin.h
gfx/2d/Tools.h
gfx/2d/Types.h
gfx/Makefile.in
gfx/layers/d3d9/CanvasLayerD3D9.cpp
gfx/layers/d3d9/CanvasLayerD3D9.h
gfx/skia/Makefile.in
gfx/skia/include/core/SkPreConfig.h
gfx/skia/skia_restrict_problem.patch
gfx/skia/src/effects/SkGradientShader.cpp
gfx/skia/update.sh
gfx/thebes/Makefile.in
gfx/thebes/gfxWindowsPlatform.cpp
toolkit/library/libxul-config.mk
--- a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
@@ -983,17 +983,23 @@ NS_INTERFACE_MAP_END
 // Initialize our static variables.
 PRUint32 nsCanvasRenderingContext2DAzure::sNumLivingContexts = 0;
 PRUint8 (*nsCanvasRenderingContext2DAzure::sUnpremultiplyTable)[256] = nsnull;
 PRUint8 (*nsCanvasRenderingContext2DAzure::sPremultiplyTable)[256] = nsnull;
 
 nsresult
 NS_NewCanvasRenderingContext2DAzure(nsIDOMCanvasRenderingContext2D** aResult)
 {
-#if !defined(XP_WIN) && !defined(XP_MACOSX) && !defined(ANDROID)
+#ifdef XP_WIN
+  if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() !=
+      gfxWindowsPlatform::RENDER_DIRECT2D ||
+      !gfxWindowsPlatform::GetPlatform()->DWriteEnabled()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+#elif !defined(XP_MACOSX) && !defined(ANDROID)
   return NS_ERROR_NOT_AVAILABLE;
 #endif
 
   nsRefPtr<nsIDOMCanvasRenderingContext2D> ctx = new nsCanvasRenderingContext2DAzure();
   if (!ctx)
     return NS_ERROR_OUT_OF_MEMORY;
 
   *aResult = ctx.forget().get();
--- a/gfx/2d/Factory.cpp
+++ b/gfx/2d/Factory.cpp
@@ -41,19 +41,16 @@
 #include "DrawTargetCairo.h"
 #endif
 
 #ifdef USE_SKIA
 #include "DrawTargetSkia.h"
 #ifdef XP_MACOSX
 #include "ScaledFontMac.h"
 #endif
-#ifdef WIN32
-#include "ScaledFontWin.h"
-#endif
 #include "ScaledFontSkia.h"
 #endif
 
 #ifdef WIN32
 #include "DrawTargetD2D.h"
 #include "ScaledFontDWrite.h"
 #include <d3d10_1.h>
 #endif
@@ -123,22 +120,16 @@ Factory::CreateScaledFontForNativeFont(c
 #endif
 #ifdef USE_SKIA
 #ifdef XP_MACOSX
   case NATIVE_FONT_MAC_FONT_FACE:
     {
       return new ScaledFontMac(static_cast<CGFontRef>(aNativeFont.mFont), aSize);
     }
 #endif
-#ifdef WIN32
-  case NATIVE_FONT_GDI_FONT_FACE:
-    {
-      return new ScaledFontWin(static_cast<gfxGDIFont*>(aNativeFont.mFont), aSize);
-    }
-#endif
   case NATIVE_FONT_SKIA_FONT_FACE:
     {
       return new ScaledFontSkia(static_cast<gfxFont*>(aNativeFont.mFont), aSize);
     }
 #endif
   default:
     gfxWarning() << "Invalid native font type specified.";
     return NULL;
--- a/gfx/2d/Makefile.in
+++ b/gfx/2d/Makefile.in
@@ -102,23 +102,19 @@ endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 CPPSRCS	+= \
         DrawTargetD2D.cpp \
         SourceSurfaceD2D.cpp \
         SourceSurfaceD2DTarget.cpp \
         PathD2D.cpp \
         ScaledFontDWrite.cpp \
-        SourceSurfaceSkia.cpp \
-        DrawTargetSkia.cpp \
-        PathSkia.cpp \
-        ScaledFontSkia.cpp \
-        ScaledFontWin.cpp \
-        $(NULL)
-DEFINES += -DWIN32 -DUSE_SKIA
+	$(NULL)
+
+DEFINES += -DWIN32
 endif
 
 #ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 #CPPSRCS	+= \
 #        DrawTargetCG.cpp \
 #        SourceSurfaceCG.cpp \
 #	$(NULL)
 #
deleted file mode 100644
--- a/gfx/2d/ScaledFontWin.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Corporation code.
- *
- * The Initial Developer of the Original Code is Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2011
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Marco Castelluccio <mar.castelluccio@studenti.unina.it>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "ScaledFontWin.h"
-#include "skia/SkTypeface_win.h"
-
-namespace mozilla {
-namespace gfx {
-
-ScaledFontWin::ScaledFontWin(gfxGDIFont* aFont, Float aSize)
-  : ScaledFontSkia(aSize)
-{
-  LOGFONT lf;
-  GetObject(aFont->GetHFONT(), sizeof(LOGFONT), &lf);
-  mTypeface = SkCreateTypefaceFromLOGFONT(lf);
-}
-
-}
-}
deleted file mode 100644
--- a/gfx/2d/ScaledFontWin.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Corporation code.
- *
- * The Initial Developer of the Original Code is Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2011
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Marco Castelluccio <mar.castelluccio@studenti.unina.it>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef MOZILLA_GFX_SCALEDFONTWIN_H_
-#define MOZILLA_GFX_SCALEDFONTWIN_H_
-
-#include "ScaledFontSkia.h"
-#include "gfxGDIFont.h"
-
-namespace mozilla {
-namespace gfx {
-
-class ScaledFontWin : public ScaledFontSkia
-{
-public:
-  ScaledFontWin(gfxGDIFont* aFont, Float aSize);
-
-  virtual FontType GetType() const { return FONT_GDI; }
-
-private:
-  friend class DrawTargetSkia;
-};
-
-}
-}
-
-#endif /* MOZILLA_GFX_SCALEDFONTWIN_H_ */
--- a/gfx/2d/Tools.h
+++ b/gfx/2d/Tools.h
@@ -38,17 +38,17 @@
 #ifndef MOZILLA_GFX_TOOLS_H_
 #define MOZILLA_GFX_TOOLS_H_
 
 #include "Types.h"
 
 namespace mozilla {
 namespace gfx {
 
-static inline bool
+bool
 IsOperatorBoundByMask(CompositionOp aOp) {
   switch (aOp) {
   case OP_IN:
   case OP_OUT:
   case OP_DEST_IN:
   case OP_DEST_ATOP:
   case OP_SOURCE:
     return false;
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -86,30 +86,28 @@ enum BackendType
   BACKEND_COREGRAPHICS,
   BACKEND_CAIRO,
   BACKEND_SKIA
 };
 
 enum FontType
 {
   FONT_DWRITE,
-  FONT_GDI,
   FONT_MAC,
   FONT_SKIA
 };
 
 enum NativeSurfaceType
 {
   NATIVE_SURFACE_D3D10_TEXTURE
 };
 
 enum NativeFontType
 {
   NATIVE_FONT_DWRITE_FONT_FACE,
-  NATIVE_FONT_GDI_FONT_FACE,
   NATIVE_FONT_MAC_FONT_FACE,
   NATIVE_FONT_SKIA_FONT_FACE
 };
 
 enum CompositionOp { OP_OVER, OP_ADD, OP_ATOP, OP_OUT, OP_IN, OP_SOURCE, OP_DEST_IN, OP_DEST_OUT, OP_DEST_OVER, OP_DEST_ATOP, OP_XOR, OP_COUNT };
 enum ExtendMode { EXTEND_CLAMP, EXTEND_WRAP, EXTEND_MIRROR };
 enum FillRule { FILL_WINDING, FILL_EVEN_ODD };
 enum AntialiasMode { AA_NONE, AA_GRAY, AA_SUBPIXEL };
--- a/gfx/Makefile.in
+++ b/gfx/Makefile.in
@@ -45,17 +45,17 @@ include $(DEPTH)/config/autoconf.mk
 MODULE		= gfx
 
 ifdef MOZ_TREE_CAIRO
 DIRS		= cairo
 endif
 
 DIRS		+= 2d ycbcr angle src qcms layers harfbuzz/src ots/src thebes ipc
 
-ifeq (,$(filter-out cocoa android windows,$(MOZ_WIDGET_TOOLKIT)))
+ifeq (,$(filter-out cocoa android,$(MOZ_WIDGET_TOOLKIT)))
 DIRS        += skia
 endif
 
 ifdef ENABLE_TESTS
 TOOL_DIRS	+= tests
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/gfx/layers/d3d9/CanvasLayerD3D9.cpp
+++ b/gfx/layers/d3d9/CanvasLayerD3D9.cpp
@@ -57,34 +57,30 @@ CanvasLayerD3D9::~CanvasLayerD3D9()
   }
 }
 
 void
 CanvasLayerD3D9::Initialize(const Data& aData)
 {
   NS_ASSERTION(mSurface == nsnull, "BasicCanvasLayer::Initialize called twice!");
 
-  if (aData.mDrawTarget) {
-    mDrawTarget = aData.mDrawTarget;
-    mNeedsYFlip = false;
-    mDataIsPremultiplied = true;
-  } else if (aData.mSurface) {
+  if (aData.mSurface) {
     mSurface = aData.mSurface;
     NS_ASSERTION(aData.mGLContext == nsnull,
                  "CanvasLayer can't have both surface and GLContext");
     mNeedsYFlip = false;
     mDataIsPremultiplied = true;
   } else if (aData.mGLContext) {
     NS_ASSERTION(aData.mGLContext->IsOffscreen(), "canvas gl context isn't offscreen");
     mGLContext = aData.mGLContext;
     mCanvasFramebuffer = mGLContext->GetOffscreenFBO();
     mDataIsPremultiplied = aData.mGLBufferIsPremultiplied;
     mNeedsYFlip = true;
   } else {
-    NS_ERROR("CanvasLayer created without mSurface, mGLContext or mDrawTarget?");
+    NS_ERROR("CanvasLayer created without mSurface or mGLContext?");
   }
 
   mBounds.SetRect(0, 0, aData.mSize.width, aData.mSize.height);
 
   CreateTexture();
 }
 
 void
@@ -149,44 +145,37 @@ CanvasLayerD3D9::UpdateSurface()
     if (r.Pitch != mBounds.width * 4) {
       for (int y = 0; y < mBounds.height; y++) {
         memcpy((PRUint8*)r.pBits + r.Pitch * y,
                destination + mBounds.width * 4 * y,
                mBounds.width * 4);
       }
       delete [] destination;
     }
-  } else {
+  } else if (mSurface) {
     RECT r;
     r.left = mBounds.x;
     r.top = mBounds.y;
     r.right = mBounds.XMost();
     r.bottom = mBounds.YMost();
 
     LockTextureRectD3D9 textureLock(mTexture);
     if (!textureLock.HasLock()) {
       NS_WARNING("Failed to lock CanvasLayer texture.");
       return;
     }
 
     D3DLOCKED_RECT lockedRect = textureLock.GetLockRect();
 
     nsRefPtr<gfxImageSurface> sourceSurface;
-    nsRefPtr<gfxASurface> tempSurface;
-    if (mDrawTarget) {
-      tempSurface = gfxPlatform::GetPlatform()->GetThebesSurfaceForDrawTarget(mDrawTarget);
-    }
-    else {
-      tempSurface = mSurface;
-    }
 
-    if (tempSurface->GetType() == gfxASurface::SurfaceTypeWin32) {
-      sourceSurface = tempSurface->GetAsImageSurface();
-    } else if (tempSurface->GetType() == gfxASurface::SurfaceTypeImage) {
-      sourceSurface = static_cast<gfxImageSurface*>(tempSurface.get());
+    if (mSurface->GetType() == gfxASurface::SurfaceTypeWin32) {
+      sourceSurface = mSurface->GetAsImageSurface();
+    } else if (mSurface->GetType() == gfxASurface::SurfaceTypeImage) {
+      sourceSurface = static_cast<gfxImageSurface*>(mSurface.get());
       if (sourceSurface->Format() != gfxASurface::ImageFormatARGB32 &&
           sourceSurface->Format() != gfxASurface::ImageFormatRGB24)
       {
         return;
       }
     } else {
       sourceSurface = new gfxImageSurface(gfxIntSize(mBounds.width, mBounds.height),
                                           gfxASurface::ImageFormatARGB32);
--- a/gfx/layers/d3d9/CanvasLayerD3D9.h
+++ b/gfx/layers/d3d9/CanvasLayerD3D9.h
@@ -80,17 +80,16 @@ public:
 protected:
   typedef mozilla::gl::GLContext GLContext;
 
   void UpdateSurface();
 
   nsRefPtr<gfxASurface> mSurface;
   nsRefPtr<GLContext> mGLContext;
   nsRefPtr<IDirect3DTexture9> mTexture;
-  RefPtr<gfx::DrawTarget> mDrawTarget;
 
   PRUint32 mCanvasFramebuffer;
 
   bool mDataIsPremultiplied;
   bool mNeedsYFlip;
   bool mHasAlpha;
 };
 
--- a/gfx/skia/Makefile.in
+++ b/gfx/skia/Makefile.in
@@ -53,17 +53,16 @@ DEFINES += -DSK_A32_SHIFT=24 -DSK_R32_SH
 
 LOCAL_INCLUDES += \
 	-I$(srcdir)/include/core \
 	-I$(srcdir)/include/config \
 	-I$(srcdir)/include/ports \
 	-I$(srcdir)/src/core \
 	-I$(srcdir)/include/images \
 	-I$(srcdir)/include/utils/mac \
-	-I$(srcdir)/include/utils/win \
 	-I$(srcdir)/include/views \
 	-I$(srcdir)/include/effects \
 	$(NULL)
 
 VPATH += \
 	$(srcdir)/src/core \
 	$(srcdir)/src/ports \
 	$(srcdir)/src/opts \
@@ -168,16 +167,17 @@ EXPORTS_skia = \
 	include/core/SkAdvancedTypefaceMetrics.h \
 	include/config/SkUserConfig.h \
 	include/effects/SkGradientShader.h \
 	include/effects/SkBlurDrawLooper.h \
 	include/effects/SkBlurMaskFilter.h \
 	include/effects/SkLayerDrawLooper.h \
 	include/effects/SkLayerRasterizer.h \
 	include/effects/SkDashPathEffect.h \
+	include/ports/SkTypeface_mac.h \
 	$(NULL)
 
 DEFINES += -DUSE_SKIA
 
 CPPSRCS = \
 	Sk64.cpp \
 	SkAAClip.cpp \
 	SkAdvancedTypefaceMetrics.cpp \
@@ -225,16 +225,17 @@ CPPSRCS = \
 	SkFloat.cpp \
 	SkFloatBits.cpp \
 	SkFontHost.cpp \
 	SkGeometry.cpp \
 	SkGlobals.cpp \
 	SkGlyphCache.cpp \
 	SkGraphics.cpp \
 	SkLineClipper.cpp \
+	SkMMapStream.cpp \
 	SkMallocPixelRef.cpp \
 	SkMask.cpp \
 	SkMaskFilter.cpp \
 	SkMath.cpp \
 	SkMatrix.cpp \
 	SkMemory_stdlib.cpp \
 	SkMetaData.cpp \
 	SkPackBits.cpp \
@@ -280,16 +281,17 @@ CPPSRCS = \
 	SkUnPreMultiply.cpp \
 	SkUtils.cpp \
 	SkWriter32.cpp \
 	SkXfermode.cpp \
 	SkDebug_stdio.cpp \
 	SkGlobals_global.cpp \
 	SkOSFile_stdio.cpp \
 	SkThread_none.cpp \
+	SkTime_Unix.cpp \
 	SkGradientShader.cpp \
 	SkBitmapCache.cpp \
 	SkBlurDrawLooper.cpp \
 	SkBlurMaskFilter.cpp \
 	SkBlurMask.cpp \
 	SkColorFilters.cpp \
 	SkLayerDrawLooper.cpp \
 	SkLayerRasterizer.cpp \
@@ -301,44 +303,26 @@ EXPORTS_skia += \
 	include/ports/SkTypeface_mac.h \
 	$(NULL)
 CPPSRCS += \
 	SkFontHost_mac_coretext.cpp \
 	SkBitmapProcState_opts_SSE2.cpp \
 	SkBlitRow_opts_SSE2.cpp \
 	SkUtils_opts_SSE2.cpp \
 	opts_check_SSE2.cpp \
-	SkTime_Unix.cpp \
 	$(NULL)
 endif
 
 ifeq (android,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += \
 	SkBitmapProcState_opts_arm.cpp \
 	SkBlitRow_opts_arm.cpp \
 	SkFontHost_FreeType.cpp \
 	SkFontHost_android.cpp \
 	SkFontHost_gamma.cpp \
 	SkUtils_opts_none.cpp \
-	SkMMapStream.cpp \
-	SkTime_Unix.cpp \
 	$(NULL)
 
 DEFINES += -DSK_BUILD_FOR_ANDROID_NDK
 OS_CXXFLAGS += $(CAIRO_FT_CFLAGS)
 endif
 
-ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
-EXPORTS_skia += \
-	include/config/sk_stdint.h \
-	include/ports/SkTypeface_win.h \
-	$(NULL)
-CPPSRCS += \
-	SkFontHost_win.cpp \
-	SkTime_win.cpp \
-	SkBitmapProcState_opts_SSE2.cpp \
-	SkBlitRow_opts_SSE2.cpp \
-	SkUtils_opts_SSE2.cpp \
-	opts_check_SSE2.cpp \
-	$(NULL)
-endif
-
 include $(topsrcdir)/config/rules.mk
--- a/gfx/skia/include/core/SkPreConfig.h
+++ b/gfx/skia/include/core/SkPreConfig.h
@@ -54,17 +54,16 @@
     #endif
 #endif
 
 #ifdef SK_BUILD_FOR_WIN32
     #if !defined(SK_RESTRICT)
         #define SK_RESTRICT __restrict
     #endif
     #include "sk_stdint.h"
-    #define SK_IGNORE_STDINT_DOT_H
 #endif
 
 //////////////////////////////////////////////////////////////////////
 
 #if !defined(SK_RESTRICT)
     #define SK_RESTRICT __restrict__
 #endif
 
deleted file mode 100644
--- a/gfx/skia/skia_restrict_problem.patch
+++ /dev/null
@@ -1,463 +0,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
-@@ -1170,117 +1170,18 @@ public:
-           fRadius(radius)
-     {
-         // make sure our table is insync with our current #define for kSQRT_TABLE_SIZE
-         SkASSERT(sizeof(gSqrt8Table) == kSQRT_TABLE_SIZE);
- 
-         rad_to_unit_matrix(center, radius, &fPtsToUnit);
-     }
- 
--    virtual void shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, int count);
--    virtual void shadeSpan16(int x, int y, uint16_t* SK_RESTRICT dstC, int count) {
--        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) << kCache16Bits;
--
--        if (fDstToIndexClass != kPerspective_MatrixClass) {
--            dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf,
--                                 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
--            SkFixed dx, fx = SkScalarToFixed(srcPt.fX);
--            SkFixed dy, fy = SkScalarToFixed(srcPt.fY);
--
--            if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
--                SkFixed storage[2];
--                (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &storage[0], &storage[1]);
--                dx = storage[0];
--                dy = storage[1];
--            } else {
--                SkASSERT(fDstToIndexClass == kLinear_MatrixClass);
--                dx = SkScalarToFixed(fDstToIndex.getScaleX());
--                dy = SkScalarToFixed(fDstToIndex.getSkewY());
--            }
--
--            if (proc == clamp_tileproc) {
--                const uint8_t* SK_RESTRICT sqrt_table = gSqrt8Table;
--
--                /* knock these down so we can pin against +- 0x7FFF, which is an immediate load,
--                    rather than 0xFFFF which is slower. This is a compromise, since it reduces our
--                    precision, but that appears to be visually OK. If we decide this is OK for
--                    all of our cases, we could (it seems) put this scale-down into fDstToIndex,
--                    to avoid having to do these extra shifts each time.
--                */
--                fx >>= 1;
--                dx >>= 1;
--                fy >>= 1;
--                dy >>= 1;
--                if (dy == 0) {    // might perform this check for the other modes, but the win will be a smaller % of the total
--                    fy = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1);
--                    fy *= fy;
--                    do {
--                        unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1);
--                        unsigned fi = (xx * xx + fy) >> (14 + 16 - kSQRT_TABLE_BITS);
--                        fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS));
--                        fx += dx;
--                        *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))];
--                        toggle ^= (1 << kCache16Bits);
--                    } while (--count != 0);
--                } else {
--                    do {
--                        unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1);
--                        unsigned fi = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1);
--                        fi = (xx * xx + fi * fi) >> (14 + 16 - kSQRT_TABLE_BITS);
--                        fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS));
--                        fx += dx;
--                        fy += dy;
--                        *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))];
--                        toggle ^= (1 << kCache16Bits);
--                    } while (--count != 0);
--                }
--            } else if (proc == mirror_tileproc) {
--                do {
--                    SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy));
--                    unsigned fi = mirror_tileproc(dist);
--                    SkASSERT(fi <= 0xFFFF);
--                    fx += dx;
--                    fy += dy;
--                    *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))];
--                    toggle ^= (1 << kCache16Bits);
--                } while (--count != 0);
--            } else {
--                SkASSERT(proc == repeat_tileproc);
--                do {
--                    SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy));
--                    unsigned fi = repeat_tileproc(dist);
--                    SkASSERT(fi <= 0xFFFF);
--                    fx += dx;
--                    fy += dy;
--                    *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))];
--                    toggle ^= (1 << kCache16Bits);
--                } while (--count != 0);
--            }
--        } else {    // perspective case
--            SkScalar dstX = SkIntToScalar(x);
--            SkScalar dstY = SkIntToScalar(y);
--            do {
--                dstProc(fDstToIndex, dstX, dstY, &srcPt);
--                unsigned fi = proc(SkScalarToFixed(srcPt.length()));
--                SkASSERT(fi <= 0xFFFF);
--
--                int index = fi >> (16 - kCache16Bits);
--                *dstC++ = cache[toggle + index];
--                toggle ^= (1 << kCache16Bits);
--
--                dstX += SK_Scalar1;
--            } while (--count != 0);
--        }
--    }
-+    virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count);
-+    virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count);
- 
-     virtual BitmapType asABitmap(SkBitmap* bitmap,
-                                  SkMatrix* matrix,
-                                  TileMode* xy,
-                                  SkScalar* twoPointRadialParams) const {
-         if (bitmap) {
-             this->commonAsABitmap(bitmap);
-         }
-@@ -1494,16 +1395,117 @@ void Radial_Gradient::shadeSpan(int x, i
-             unsigned fi = proc(SkScalarToFixed(srcPt.length()));
-             SkASSERT(fi <= 0xFFFF);
-             *dstC++ = cache[fi >> (16 - kCache32Bits)];
-             dstX += SK_Scalar1;
-         } while (--count != 0);
-     }
- }
- 
-+void Radial_Gradient::shadeSpan16(int x, int y, uint16_t* SK_RESTRICT dstC, int count) {
-+    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) << kCache16Bits;
-+
-+    if (fDstToIndexClass != kPerspective_MatrixClass) {
-+        dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf,
-+                             SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
-+        SkFixed dx, fx = SkScalarToFixed(srcPt.fX);
-+        SkFixed dy, fy = SkScalarToFixed(srcPt.fY);
-+
-+        if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
-+            SkFixed storage[2];
-+            (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &storage[0], &storage[1]);
-+            dx = storage[0];
-+            dy = storage[1];
-+        } else {
-+            SkASSERT(fDstToIndexClass == kLinear_MatrixClass);
-+            dx = SkScalarToFixed(fDstToIndex.getScaleX());
-+            dy = SkScalarToFixed(fDstToIndex.getSkewY());
-+        }
-+
-+        if (proc == clamp_tileproc) {
-+            const uint8_t* SK_RESTRICT sqrt_table = gSqrt8Table;
-+
-+            /* knock these down so we can pin against +- 0x7FFF, which is an immediate load,
-+                rather than 0xFFFF which is slower. This is a compromise, since it reduces our
-+                precision, but that appears to be visually OK. If we decide this is OK for
-+                all of our cases, we could (it seems) put this scale-down into fDstToIndex,
-+                to avoid having to do these extra shifts each time.
-+            */
-+            fx >>= 1;
-+            dx >>= 1;
-+            fy >>= 1;
-+            dy >>= 1;
-+            if (dy == 0) {    // might perform this check for the other modes, but the win will be a smaller % of the total
-+                fy = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1);
-+                fy *= fy;
-+                do {
-+                    unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1);
-+                    unsigned fi = (xx * xx + fy) >> (14 + 16 - kSQRT_TABLE_BITS);
-+                    fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS));
-+                    fx += dx;
-+                    *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))];
-+                    toggle ^= (1 << kCache16Bits);
-+                } while (--count != 0);
-+            } else {
-+                do {
-+                    unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1);
-+                    unsigned fi = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1);
-+                    fi = (xx * xx + fi * fi) >> (14 + 16 - kSQRT_TABLE_BITS);
-+                    fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS));
-+                    fx += dx;
-+                    fy += dy;
-+                    *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))];
-+                    toggle ^= (1 << kCache16Bits);
-+                } while (--count != 0);
-+            }
-+        } else if (proc == mirror_tileproc) {
-+            do {
-+                SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy));
-+                unsigned fi = mirror_tileproc(dist);
-+                SkASSERT(fi <= 0xFFFF);
-+                fx += dx;
-+                fy += dy;
-+                *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))];
-+                toggle ^= (1 << kCache16Bits);
-+            } while (--count != 0);
-+        } else {
-+            SkASSERT(proc == repeat_tileproc);
-+            do {
-+                SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy));
-+                unsigned fi = repeat_tileproc(dist);
-+                SkASSERT(fi <= 0xFFFF);
-+                fx += dx;
-+                fy += dy;
-+                *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))];
-+                toggle ^= (1 << kCache16Bits);
-+            } while (--count != 0);
-+        }
-+    } else {    // perspective case
-+        SkScalar dstX = SkIntToScalar(x);
-+        SkScalar dstY = SkIntToScalar(y);
-+        do {
-+            dstProc(fDstToIndex, dstX, dstY, &srcPt);
-+            unsigned fi = proc(SkScalarToFixed(srcPt.length()));
-+            SkASSERT(fi <= 0xFFFF);
-+
-+            int index = fi >> (16 - kCache16Bits);
-+            *dstC++ = cache[toggle + index];
-+            toggle ^= (1 << kCache16Bits);
-+
-+            dstX += SK_Scalar1;
-+        } while (--count != 0);
-+    }
-+}
-+
- /* Two-point radial gradients are specified by two circles, each with a center
-    point and radius.  The gradient can be considered to be a series of
-    concentric circles, with the color interpolated from the start circle
-    (at t=0) to the end circle (at t=1).
- 
-    For each point (x, y) in the span, we want to find the
-    interpolated circle that intersects that point.  The center
-    of the desired circle (Cx, Cy) falls at some distance t
-@@ -1648,109 +1650,17 @@ public:
-             info->fPoint[0] = fCenter1;
-             info->fPoint[1] = fCenter2;
-             info->fRadius[0] = fRadius1;
-             info->fRadius[1] = fRadius2;
-         }
-         return kRadial2_GradientType;
-     }
- 
--    virtual void shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, int count) {
--        SkASSERT(count > 0);
--
--        // Zero difference between radii:  fill with transparent black.
--        // 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;
--        }
--        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) {
--                SkFixed fixedX, fixedY;
--                (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &fixedX, &fixedY);
--                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;
--            SkScalar db = (SkScalarMul(fDiff.fX, dx) +
--                          SkScalarMul(fDiff.fY, dy)) * 2;
--            if (proc == clamp_tileproc) {
--                for (; count > 0; --count) {
--                    SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot);
--                    if (t < 0) {
--                      *dstC++ = cache[-1];
--                    } else if (t > 0xFFFF) {
--                      *dstC++ = cache[kCache32Count * 2];
--                    } else {
--                      SkASSERT(t <= 0xFFFF);
--                      *dstC++ = cache[t >> (16 - kCache32Bits)];
--                    }
--                    fx += dx;
--                    fy += dy;
--                    b += db;
--                }
--            } else if (proc == mirror_tileproc) {
--                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 >> (16 - kCache32Bits)];
--                    fx += dx;
--                    fy += dy;
--                    b += db;
--                }
--            } else {
--                SkASSERT(proc == repeat_tileproc);
--                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 >> (16 - kCache32Bits)];
--                    fx += dx;
--                    fy += dy;
--                    b += db;
--                }
--            }
--        } 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 >> (16 - kCache32Bits)];
--                dstX += SK_Scalar1;
--            }
--        }
--    }
-+    virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count);
- 
-     virtual bool setContext(const SkBitmap& device,
-                             const SkPaint& paint,
-                             const SkMatrix& matrix) {
-         if (!this->INHERITED::setContext(device, paint, matrix)) {
-             return false;
-         }
- 
-@@ -1804,16 +1714,110 @@ private:
-         fA = SkScalarSquare(fDiff.fX) + SkScalarSquare(fDiff.fY) - SK_Scalar1;
-         fOneOverTwoA = fA ? SkScalarInvert(fA * 2) : 0;
- 
-         fPtsToUnit.setTranslate(-fCenter1.fX, -fCenter1.fY);
-         fPtsToUnit.postScale(inv, inv);
-     }
- };
- 
-+void Two_Point_Radial_Gradient::shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, int count) {
-+    SkASSERT(count > 0);
-+
-+    // Zero difference between radii:  fill with transparent black.
-+    // 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;
-+    }
-+    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) {
-+            SkFixed fixedX, fixedY;
-+            (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &fixedX, &fixedY);
-+            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;
-+        SkScalar db = (SkScalarMul(fDiff.fX, dx) +
-+                      SkScalarMul(fDiff.fY, dy)) * 2;
-+        if (proc == clamp_tileproc) {
-+            for (; count > 0; --count) {
-+                SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot);
-+                if (t < 0) {
-+                  *dstC++ = cache[-1];
-+                } else if (t > 0xFFFF) {
-+                  *dstC++ = cache[kCache32Count * 2];
-+                } else {
-+                  SkASSERT(t <= 0xFFFF);
-+                  *dstC++ = cache[t >> (16 - kCache32Bits)];
-+                }
-+                fx += dx;
-+                fy += dy;
-+                b += db;
-+            }
-+        } else if (proc == mirror_tileproc) {
-+            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 >> (16 - kCache32Bits)];
-+                fx += dx;
-+                fy += dy;
-+                b += db;
-+            }
-+        } else {
-+            SkASSERT(proc == repeat_tileproc);
-+            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 >> (16 - kCache32Bits)];
-+                fx += dx;
-+                fy += dy;
-+                b += db;
-+            }
-+        }
-+    } 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 >> (16 - kCache32Bits)];
-+            dstX += SK_Scalar1;
-+        }
-+    }
-+}
-+
- ///////////////////////////////////////////////////////////////////////////////
- 
- class Sweep_Gradient : public Gradient_Shader {
- public:
-     Sweep_Gradient(SkScalar cx, SkScalar cy, const SkColor colors[],
-                    const SkScalar pos[], int count, SkUnitMapper* mapper)
-     : Gradient_Shader(colors, pos, count, SkShader::kClamp_TileMode, mapper),
-       fCenter(SkPoint::Make(cx, cy))
--- a/gfx/skia/src/effects/SkGradientShader.cpp
+++ b/gfx/skia/src/effects/SkGradientShader.cpp
@@ -1170,18 +1170,117 @@ public:
           fRadius(radius)
     {
         // make sure our table is insync with our current #define for kSQRT_TABLE_SIZE
         SkASSERT(sizeof(gSqrt8Table) == kSQRT_TABLE_SIZE);
 
         rad_to_unit_matrix(center, radius, &fPtsToUnit);
     }
 
-    virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count);
-    virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count);
+    virtual void shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, int count);
+    virtual void shadeSpan16(int x, int y, uint16_t* SK_RESTRICT dstC, int count) {
+        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) << kCache16Bits;
+
+        if (fDstToIndexClass != kPerspective_MatrixClass) {
+            dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf,
+                                 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
+            SkFixed dx, fx = SkScalarToFixed(srcPt.fX);
+            SkFixed dy, fy = SkScalarToFixed(srcPt.fY);
+
+            if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
+                SkFixed storage[2];
+                (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &storage[0], &storage[1]);
+                dx = storage[0];
+                dy = storage[1];
+            } else {
+                SkASSERT(fDstToIndexClass == kLinear_MatrixClass);
+                dx = SkScalarToFixed(fDstToIndex.getScaleX());
+                dy = SkScalarToFixed(fDstToIndex.getSkewY());
+            }
+
+            if (proc == clamp_tileproc) {
+                const uint8_t* SK_RESTRICT sqrt_table = gSqrt8Table;
+
+                /* knock these down so we can pin against +- 0x7FFF, which is an immediate load,
+                    rather than 0xFFFF which is slower. This is a compromise, since it reduces our
+                    precision, but that appears to be visually OK. If we decide this is OK for
+                    all of our cases, we could (it seems) put this scale-down into fDstToIndex,
+                    to avoid having to do these extra shifts each time.
+                */
+                fx >>= 1;
+                dx >>= 1;
+                fy >>= 1;
+                dy >>= 1;
+                if (dy == 0) {    // might perform this check for the other modes, but the win will be a smaller % of the total
+                    fy = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1);
+                    fy *= fy;
+                    do {
+                        unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1);
+                        unsigned fi = (xx * xx + fy) >> (14 + 16 - kSQRT_TABLE_BITS);
+                        fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS));
+                        fx += dx;
+                        *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))];
+                        toggle ^= (1 << kCache16Bits);
+                    } while (--count != 0);
+                } else {
+                    do {
+                        unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1);
+                        unsigned fi = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1);
+                        fi = (xx * xx + fi * fi) >> (14 + 16 - kSQRT_TABLE_BITS);
+                        fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS));
+                        fx += dx;
+                        fy += dy;
+                        *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))];
+                        toggle ^= (1 << kCache16Bits);
+                    } while (--count != 0);
+                }
+            } else if (proc == mirror_tileproc) {
+                do {
+                    SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy));
+                    unsigned fi = mirror_tileproc(dist);
+                    SkASSERT(fi <= 0xFFFF);
+                    fx += dx;
+                    fy += dy;
+                    *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))];
+                    toggle ^= (1 << kCache16Bits);
+                } while (--count != 0);
+            } else {
+                SkASSERT(proc == repeat_tileproc);
+                do {
+                    SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy));
+                    unsigned fi = repeat_tileproc(dist);
+                    SkASSERT(fi <= 0xFFFF);
+                    fx += dx;
+                    fy += dy;
+                    *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))];
+                    toggle ^= (1 << kCache16Bits);
+                } while (--count != 0);
+            }
+        } else {    // perspective case
+            SkScalar dstX = SkIntToScalar(x);
+            SkScalar dstY = SkIntToScalar(y);
+            do {
+                dstProc(fDstToIndex, dstX, dstY, &srcPt);
+                unsigned fi = proc(SkScalarToFixed(srcPt.length()));
+                SkASSERT(fi <= 0xFFFF);
+
+                int index = fi >> (16 - kCache16Bits);
+                *dstC++ = cache[toggle + index];
+                toggle ^= (1 << kCache16Bits);
+
+                dstX += SK_Scalar1;
+            } while (--count != 0);
+        }
+    }
 
     virtual BitmapType asABitmap(SkBitmap* bitmap,
                                  SkMatrix* matrix,
                                  TileMode* xy,
                                  SkScalar* twoPointRadialParams) const {
         if (bitmap) {
             this->commonAsABitmap(bitmap);
         }
@@ -1395,117 +1494,16 @@ void Radial_Gradient::shadeSpan(int x, i
             unsigned fi = proc(SkScalarToFixed(srcPt.length()));
             SkASSERT(fi <= 0xFFFF);
             *dstC++ = cache[fi >> (16 - kCache32Bits)];
             dstX += SK_Scalar1;
         } while (--count != 0);
     }
 }
 
-void Radial_Gradient::shadeSpan16(int x, int y, uint16_t* SK_RESTRICT dstC, int count) {
-    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) << kCache16Bits;
-
-    if (fDstToIndexClass != kPerspective_MatrixClass) {
-        dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf,
-                             SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
-        SkFixed dx, fx = SkScalarToFixed(srcPt.fX);
-        SkFixed dy, fy = SkScalarToFixed(srcPt.fY);
-
-        if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
-            SkFixed storage[2];
-            (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &storage[0], &storage[1]);
-            dx = storage[0];
-            dy = storage[1];
-        } else {
-            SkASSERT(fDstToIndexClass == kLinear_MatrixClass);
-            dx = SkScalarToFixed(fDstToIndex.getScaleX());
-            dy = SkScalarToFixed(fDstToIndex.getSkewY());
-        }
-
-        if (proc == clamp_tileproc) {
-            const uint8_t* SK_RESTRICT sqrt_table = gSqrt8Table;
-
-            /* knock these down so we can pin against +- 0x7FFF, which is an immediate load,
-                rather than 0xFFFF which is slower. This is a compromise, since it reduces our
-                precision, but that appears to be visually OK. If we decide this is OK for
-                all of our cases, we could (it seems) put this scale-down into fDstToIndex,
-                to avoid having to do these extra shifts each time.
-            */
-            fx >>= 1;
-            dx >>= 1;
-            fy >>= 1;
-            dy >>= 1;
-            if (dy == 0) {    // might perform this check for the other modes, but the win will be a smaller % of the total
-                fy = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1);
-                fy *= fy;
-                do {
-                    unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1);
-                    unsigned fi = (xx * xx + fy) >> (14 + 16 - kSQRT_TABLE_BITS);
-                    fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS));
-                    fx += dx;
-                    *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))];
-                    toggle ^= (1 << kCache16Bits);
-                } while (--count != 0);
-            } else {
-                do {
-                    unsigned xx = SkPin32(fx, -0xFFFF >> 1, 0xFFFF >> 1);
-                    unsigned fi = SkPin32(fy, -0xFFFF >> 1, 0xFFFF >> 1);
-                    fi = (xx * xx + fi * fi) >> (14 + 16 - kSQRT_TABLE_BITS);
-                    fi = SkFastMin32(fi, 0xFFFF >> (16 - kSQRT_TABLE_BITS));
-                    fx += dx;
-                    fy += dy;
-                    *dstC++ = cache[toggle + (sqrt_table[fi] >> (8 - kCache16Bits))];
-                    toggle ^= (1 << kCache16Bits);
-                } while (--count != 0);
-            }
-        } else if (proc == mirror_tileproc) {
-            do {
-                SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy));
-                unsigned fi = mirror_tileproc(dist);
-                SkASSERT(fi <= 0xFFFF);
-                fx += dx;
-                fy += dy;
-                *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))];
-                toggle ^= (1 << kCache16Bits);
-            } while (--count != 0);
-        } else {
-            SkASSERT(proc == repeat_tileproc);
-            do {
-                SkFixed dist = SkFixedSqrt(SkFixedSquare(fx) + SkFixedSquare(fy));
-                unsigned fi = repeat_tileproc(dist);
-                SkASSERT(fi <= 0xFFFF);
-                fx += dx;
-                fy += dy;
-                *dstC++ = cache[toggle + (fi >> (16 - kCache16Bits))];
-                toggle ^= (1 << kCache16Bits);
-            } while (--count != 0);
-        }
-    } else {    // perspective case
-        SkScalar dstX = SkIntToScalar(x);
-        SkScalar dstY = SkIntToScalar(y);
-        do {
-            dstProc(fDstToIndex, dstX, dstY, &srcPt);
-            unsigned fi = proc(SkScalarToFixed(srcPt.length()));
-            SkASSERT(fi <= 0xFFFF);
-
-            int index = fi >> (16 - kCache16Bits);
-            *dstC++ = cache[toggle + index];
-            toggle ^= (1 << kCache16Bits);
-
-            dstX += SK_Scalar1;
-        } while (--count != 0);
-    }
-}
-
 /* Two-point radial gradients are specified by two circles, each with a center
    point and radius.  The gradient can be considered to be a series of
    concentric circles, with the color interpolated from the start circle
    (at t=0) to the end circle (at t=1).
 
    For each point (x, y) in the span, we want to find the
    interpolated circle that intersects that point.  The center
    of the desired circle (Cx, Cy) falls at some distance t
@@ -1650,17 +1648,109 @@ public:
             info->fPoint[0] = fCenter1;
             info->fPoint[1] = fCenter2;
             info->fRadius[0] = fRadius1;
             info->fRadius[1] = fRadius2;
         }
         return kRadial2_GradientType;
     }
 
-    virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count);
+    virtual void shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, int count) {
+        SkASSERT(count > 0);
+
+        // Zero difference between radii:  fill with transparent black.
+        // 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;
+        }
+        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) {
+                SkFixed fixedX, fixedY;
+                (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &fixedX, &fixedY);
+                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;
+            SkScalar db = (SkScalarMul(fDiff.fX, dx) +
+                          SkScalarMul(fDiff.fY, dy)) * 2;
+            if (proc == clamp_tileproc) {
+                for (; count > 0; --count) {
+                    SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot);
+                    if (t < 0) {
+                      *dstC++ = cache[-1];
+                    } else if (t > 0xFFFF) {
+                      *dstC++ = cache[kCache32Count * 2];
+                    } else {
+                      SkASSERT(t <= 0xFFFF);
+                      *dstC++ = cache[t >> (16 - kCache32Bits)];
+                    }
+                    fx += dx;
+                    fy += dy;
+                    b += db;
+                }
+            } else if (proc == mirror_tileproc) {
+                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 >> (16 - kCache32Bits)];
+                    fx += dx;
+                    fy += dy;
+                    b += db;
+                }
+            } else {
+                SkASSERT(proc == repeat_tileproc);
+                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 >> (16 - kCache32Bits)];
+                    fx += dx;
+                    fy += dy;
+                    b += db;
+                }
+            }
+        } 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 >> (16 - kCache32Bits)];
+                dstX += SK_Scalar1;
+            }
+        }
+    }
 
     virtual bool setContext(const SkBitmap& device,
                             const SkPaint& paint,
                             const SkMatrix& matrix) {
         if (!this->INHERITED::setContext(device, paint, matrix)) {
             return false;
         }
 
@@ -1714,110 +1804,16 @@ private:
         fA = SkScalarSquare(fDiff.fX) + SkScalarSquare(fDiff.fY) - SK_Scalar1;
         fOneOverTwoA = fA ? SkScalarInvert(fA * 2) : 0;
 
         fPtsToUnit.setTranslate(-fCenter1.fX, -fCenter1.fY);
         fPtsToUnit.postScale(inv, inv);
     }
 };
 
-void Two_Point_Radial_Gradient::shadeSpan(int x, int y, SkPMColor* SK_RESTRICT dstC, int count) {
-    SkASSERT(count > 0);
-
-    // Zero difference between radii:  fill with transparent black.
-    // 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;
-    }
-    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) {
-            SkFixed fixedX, fixedY;
-            (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), &fixedX, &fixedY);
-            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;
-        SkScalar db = (SkScalarMul(fDiff.fX, dx) +
-                      SkScalarMul(fDiff.fY, dy)) * 2;
-        if (proc == clamp_tileproc) {
-            for (; count > 0; --count) {
-                SkFixed t = two_point_radial(b, fx, fy, fSr2D2, foura, fOneOverTwoA, posRoot);
-                if (t < 0) {
-                  *dstC++ = cache[-1];
-                } else if (t > 0xFFFF) {
-                  *dstC++ = cache[kCache32Count * 2];
-                } else {
-                  SkASSERT(t <= 0xFFFF);
-                  *dstC++ = cache[t >> (16 - kCache32Bits)];
-                }
-                fx += dx;
-                fy += dy;
-                b += db;
-            }
-        } else if (proc == mirror_tileproc) {
-            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 >> (16 - kCache32Bits)];
-                fx += dx;
-                fy += dy;
-                b += db;
-            }
-        } else {
-            SkASSERT(proc == repeat_tileproc);
-            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 >> (16 - kCache32Bits)];
-                fx += dx;
-                fy += dy;
-                b += db;
-            }
-        }
-    } 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 >> (16 - kCache32Bits)];
-            dstX += SK_Scalar1;
-        }
-    }
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 class Sweep_Gradient : public Gradient_Shader {
 public:
     Sweep_Gradient(SkScalar cx, SkScalar cy, const SkColor colors[],
                    const SkScalar pos[], int count, SkUnitMapper* mapper)
     : Gradient_Shader(colors, pos, count, SkShader::kClamp_TileMode, mapper),
       fCenter(SkPoint::Make(cx, cy))
--- a/gfx/skia/update.sh
+++ b/gfx/skia/update.sh
@@ -98,10 +98,8 @@ patch -p3 < arm-opts.patch
 # Bug 687188 - Skia radial gradients should use the 0/1 color stop values for clamping.
 patch -p3 < fix-gradient-clamp.patch
 # Bug 687189 - Implement SkPaint::getPosTextPath.
 patch -p3 < getpostextpath.patch
 # Bug 688365 - Enable Skia 'New AA' mode.
 patch -p3 < new-aa.patch
 # Bug 688366 - Fix Skia marking radial gradients with the same radius as invalid.
 patch -p3 < radial-gradients.patch
-# Fix restrict keyword problem for VS2005
-patch -p3 < skia-restrict-problem.patch
--- a/gfx/thebes/Makefile.in
+++ b/gfx/thebes/Makefile.in
@@ -146,21 +146,16 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 EXPORTS	+= \
 	gfxPDFSurface.h \
 	gfxWindowsPlatform.h \
 	gfxWindowsSurface.h \
 	gfxWindowsNativeDrawing.h \
 	WGLLibrary.h \
 	gfxDWriteFonts.h \
 	gfxD2DSurface.h \
-	gfxGDIFont.h \
-	gfxGDIFontList.h \
-	gfxPlatformFontList.h \
-	gfxAtoms.h \
-	gfxAtomList.h \
 	$(NULL)
 endif
 
 CPPSRCS	= \
 	gfx3DMatrix.cpp \
 	gfxASurface.cpp \
 	gfxAlphaRecovery.cpp \
 	gfxBlur.cpp \
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -477,21 +477,16 @@ gfxWindowsPlatform::CreateOffscreenSurfa
 RefPtr<DrawTarget>
 gfxWindowsPlatform::CreateOffscreenDrawTarget(const IntSize& aSize, SurfaceFormat aFormat)
 {
 #ifdef CAIRO_HAS_D2D_SURFACE
   if (mRenderMode == RENDER_DIRECT2D) {
       return Factory::CreateDrawTarget(BACKEND_DIRECT2D, aSize, aFormat); 
   }
 #endif
-
-  if (Preferences::GetBool("gfx.canvas.azure.prefer-skia", false)) {
-    return Factory::CreateDrawTarget(BACKEND_SKIA, aSize, aFormat);
-  }
-
   return NULL;
 }
 
 RefPtr<ScaledFont>
 gfxWindowsPlatform::GetScaledFontForFont(gfxFont *aFont)
 {
   if(mUseDirectWrite) {
     gfxDWriteFont *font = static_cast<gfxDWriteFont*>(aFont);
@@ -500,23 +495,17 @@ gfxWindowsPlatform::GetScaledFontForFont
     nativeFont.mType = NATIVE_FONT_DWRITE_FONT_FACE;
     nativeFont.mFont = font->GetFontFace();
     RefPtr<ScaledFont> scaledFont =
       mozilla::gfx::Factory::CreateScaledFontForNativeFont(nativeFont, font->GetAdjustedSize());
 
     return scaledFont;
   }
 
-  NativeFont nativeFont;
-  nativeFont.mType = NATIVE_FONT_GDI_FONT_FACE;
-  nativeFont.mFont = aFont;
-  RefPtr<ScaledFont> scaledFont =
-    Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
-
-  return scaledFont;
+  return NULL;
 }
 
 already_AddRefed<gfxASurface>
 gfxWindowsPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
 {
 #ifdef XP_WIN
   if (aTarget->GetType() == BACKEND_DIRECT2D) {
     RefPtr<ID3D10Texture2D> texture =
--- a/toolkit/library/libxul-config.mk
+++ b/toolkit/library/libxul-config.mk
@@ -357,17 +357,17 @@ ifeq ($(OS_ARCH),Linux)
 EXTRA_DSO_LDOPTS += $(MOZ_ALSA_LIBS)
 endif
 endif
 
 ifdef HAVE_CLOCK_MONOTONIC
 EXTRA_DSO_LDOPTS += $(REALTIME_LIBS)
 endif
 
-ifeq (,$(filter-out cocoa android windows,$(MOZ_WIDGET_TOOLKIT)))
+ifeq (,$(filter-out cocoa android,$(MOZ_WIDGET_TOOLKIT)))
 EXTRA_DSO_LDOPTS += $(MOZ_SKIA_LIBS)
 endif
 
 ifeq (android,$(MOZ_WIDGET_TOOLKIT))
 OS_LIBS += -lGLESv2
 endif
 
 ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))