Merge inbound to mozilla-central a=merge
authorarthur.iakab <aiakab@mozilla.com>
Wed, 31 Oct 2018 11:44:44 +0200
changeset 443697 0029fe1e56d7870fac39504a9c212775e2939f58
parent 443696 4774ae235f5f816562b4cc99ae8bed81e7c30e05 (current diff)
parent 443615 f7ec22650157429d62ff51ac1aeeee51e78a35bd (diff)
child 443698 4d4ac8ba6d62f9e93f182ec32d1c4912d19c3cbd
child 443752 1e15b59301a2f6c80066dbd1d3a1a16012396f04
push id109424
push useraiakab@mozilla.com
push dateWed, 31 Oct 2018 09:47:52 +0000
treeherdermozilla-inbound@4d4ac8ba6d62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone65.0a1
first release with
nightly linux32
0029fe1e56d7 / 65.0a1 / 20181031100345 / files
nightly linux64
0029fe1e56d7 / 65.0a1 / 20181031100345 / files
nightly mac
0029fe1e56d7 / 65.0a1 / 20181031100345 / files
nightly win32
0029fe1e56d7 / 65.0a1 / 20181031100345 / files
nightly win64
0029fe1e56d7 / 65.0a1 / 20181031100345 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central a=merge
gfx/skia/skia/include/core/SkColorSpaceXform.h
gfx/skia/skia/include/core/SkDrawFilter.h
gfx/skia/skia/include/effects/SkPaintFlagsDrawFilter.h
gfx/skia/skia/include/effects/SkRRectsGaussianEdgeMaskFilter.h
gfx/skia/skia/include/gpu/GrCaps.h
gfx/skia/skia/include/gpu/GrShaderCaps.h
gfx/skia/skia/include/gpu/vk/GrVkInterface.h
gfx/skia/skia/include/ports/SkFontMgr.h
gfx/skia/skia/include/private/GrGLSL.h
gfx/skia/skia/include/private/GrSurfaceProxyRef.h
gfx/skia/skia/include/private/GrSwizzle.h
gfx/skia/skia/include/private/SkSurfaceCharacterization.h
gfx/skia/skia/include/utils/SkDumpCanvas.h
gfx/skia/skia/include/utils/SkTextBox.h
gfx/skia/skia/include/views/SkEvent.h
gfx/skia/skia/include/views/SkEventSink.h
gfx/skia/skia/include/views/SkKey.h
gfx/skia/skia/include/views/SkTouchGesture.h
gfx/skia/skia/include/views/SkView.h
gfx/skia/skia/src/core/SkArenaAlloc.h
gfx/skia/skia/src/core/SkAutoKern.h
gfx/skia/skia/src/core/SkBlurImageFilter.cpp
gfx/skia/skia/src/core/SkColorLookUpTable.cpp
gfx/skia/skia/src/core/SkColorLookUpTable.h
gfx/skia/skia/src/core/SkColorSpaceXform.cpp
gfx/skia/skia/src/core/SkColorSpaceXformPriv.h
gfx/skia/skia/src/core/SkColorSpaceXform_A2B.cpp
gfx/skia/skia/src/core/SkColorSpaceXform_A2B.h
gfx/skia/skia/src/core/SkColorSpaceXform_Base.h
gfx/skia/skia/src/core/SkColorSpace_A2B.cpp
gfx/skia/skia/src/core/SkColorSpace_A2B.h
gfx/skia/skia/src/core/SkColorSpace_ICC.cpp
gfx/skia/skia/src/core/SkColorSpace_New.cpp
gfx/skia/skia/src/core/SkColorSpace_New.h
gfx/skia/skia/src/core/SkColorSpace_XYZ.cpp
gfx/skia/skia/src/core/SkColorSpace_XYZ.h
gfx/skia/skia/src/core/SkColorTable.cpp
gfx/skia/skia/src/core/SkColorTable.h
gfx/skia/skia/src/core/SkDeviceProfile.cpp
gfx/skia/skia/src/core/SkDeviceProfile.h
gfx/skia/skia/src/core/SkDither.cpp
gfx/skia/skia/src/core/SkDither.h
gfx/skia/skia/src/core/SkDrawShadowInfo.cpp
gfx/skia/skia/src/core/SkGammas.h
gfx/skia/skia/src/core/SkGlyphCache_Globals.h
gfx/skia/skia/src/core/SkImageCacherator.h
gfx/skia/skia/src/core/SkImageInfoPriv.h
gfx/skia/skia/src/core/SkPipe.h
gfx/skia/skia/src/core/SkRefDict.cpp
gfx/skia/skia/src/core/SkRefDict.h
gfx/skia/skia/src/core/SkSRGB.cpp
gfx/skia/skia/src/core/SkSRGB.h
gfx/skia/skia/src/core/SkSinglyLinkedList.h
gfx/skia/skia/src/core/SkTInternalLList.h
gfx/skia/skia/src/core/SkTaskGroup2D.cpp
gfx/skia/skia/src/core/SkTaskGroup2D.h
gfx/skia/skia/src/core/SkTextBlobRunIterator.h
gfx/skia/skia/src/core/SkTextMapStateProc.h
gfx/skia/skia/src/core/SkThreadedBMPDevice.cpp
gfx/skia/skia/src/core/SkThreadedBMPDevice.h
gfx/skia/skia/src/effects/GrAlphaThresholdFragmentProcessor.cpp
gfx/skia/skia/src/effects/GrAlphaThresholdFragmentProcessor.fp
gfx/skia/skia/src/effects/GrAlphaThresholdFragmentProcessor.h
gfx/skia/skia/src/effects/GrCircleBlurFragmentProcessor.cpp
gfx/skia/skia/src/effects/GrCircleBlurFragmentProcessor.fp
gfx/skia/skia/src/effects/GrCircleBlurFragmentProcessor.h
gfx/skia/skia/src/effects/SkAlphaThresholdFilter.cpp
gfx/skia/skia/src/effects/SkArithmeticImageFilter.cpp
gfx/skia/skia/src/effects/SkBlurMask.cpp
gfx/skia/skia/src/effects/SkBlurMask.h
gfx/skia/skia/src/effects/SkBlurMaskFilter.cpp
gfx/skia/skia/src/effects/SkColorFilterImageFilter.cpp
gfx/skia/skia/src/effects/SkComposeImageFilter.cpp
gfx/skia/skia/src/effects/SkDisplacementMapEffect.cpp
gfx/skia/skia/src/effects/SkDropShadowImageFilter.cpp
gfx/skia/skia/src/effects/SkImageSource.cpp
gfx/skia/skia/src/effects/SkLightingImageFilter.cpp
gfx/skia/skia/src/effects/SkMagnifierImageFilter.cpp
gfx/skia/skia/src/effects/SkMatrixConvolutionImageFilter.cpp
gfx/skia/skia/src/effects/SkMergeImageFilter.cpp
gfx/skia/skia/src/effects/SkMorphologyImageFilter.cpp
gfx/skia/skia/src/effects/SkOffsetImageFilter.cpp
gfx/skia/skia/src/effects/SkPaintFlagsDrawFilter.cpp
gfx/skia/skia/src/effects/SkPaintImageFilter.cpp
gfx/skia/skia/src/effects/SkPictureImageFilter.cpp
gfx/skia/skia/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
gfx/skia/skia/src/effects/SkTileImageFilter.cpp
gfx/skia/skia/src/effects/SkXfermodeImageFilter.cpp
gfx/skia/skia/src/gpu/GrBlend.cpp
gfx/skia/skia/src/gpu/GrGpuFactory.cpp
gfx/skia/skia/src/gpu/GrGpuFactory.h
gfx/skia/skia/src/gpu/GrGpuResourceRef.cpp
gfx/skia/skia/src/gpu/GrGpuResourceRef.h
gfx/skia/skia/src/gpu/GrPathRange.cpp
gfx/skia/skia/src/gpu/GrPathRange.h
gfx/skia/skia/src/gpu/GrPendingProgramElement.h
gfx/skia/skia/src/gpu/GrProgramElement.h
gfx/skia/skia/src/gpu/GrSurfaceProxyRef.cpp
gfx/skia/skia/src/gpu/GrTextureStripAtlas.h
gfx/skia/skia/src/gpu/ccpr/GrCCGeometry.cpp
gfx/skia/skia/src/gpu/ccpr/GrCCGeometry.h
gfx/skia/skia/src/gpu/ccpr/GrCCPathParser.cpp
gfx/skia/skia/src/gpu/ccpr/GrCCPathParser.h
gfx/skia/skia/src/gpu/ccpr/GrCCTriangleShader.cpp
gfx/skia/skia/src/gpu/ccpr/GrCCTriangleShader.h
gfx/skia/skia/src/gpu/effects/GrArithmeticFP.cpp
gfx/skia/skia/src/gpu/effects/GrArithmeticFP.fp
gfx/skia/skia/src/gpu/effects/GrArithmeticFP.h
gfx/skia/skia/src/gpu/effects/GrDitherEffect.cpp
gfx/skia/skia/src/gpu/effects/GrDitherEffect.fp
gfx/skia/skia/src/gpu/effects/GrDitherEffect.h
gfx/skia/skia/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp
gfx/skia/skia/src/gpu/effects/GrNonlinearColorSpaceXformEffect.h
gfx/skia/skia/src/gpu/effects/GrOverdrawFragmentProcessor.cpp
gfx/skia/skia/src/gpu/effects/GrOverdrawFragmentProcessor.fp
gfx/skia/skia/src/gpu/effects/GrOverdrawFragmentProcessor.h
gfx/skia/skia/src/gpu/effects/GrTextureStripAtlas.cpp
gfx/skia/skia/src/gpu/effects/GrUnpremulInputFragmentProcessor.cpp
gfx/skia/skia/src/gpu/effects/GrUnpremulInputFragmentProcessor.fp
gfx/skia/skia/src/gpu/effects/GrUnpremulInputFragmentProcessor.h
gfx/skia/skia/src/gpu/effects/GrYUVtoRGBEffect.fp
gfx/skia/skia/src/gpu/gl/GrGLPathRange.cpp
gfx/skia/skia/src/gpu/gl/GrGLPathRange.h
gfx/skia/skia/src/gpu/ops/GrMSAAPathRenderer.cpp
gfx/skia/skia/src/gpu/ops/GrMSAAPathRenderer.h
gfx/skia/skia/src/gpu/text/GrAtlasGlyphCache.cpp
gfx/skia/skia/src/gpu/text/GrAtlasGlyphCache.h
gfx/skia/skia/src/gpu/text/GrAtlasTextBlob.cpp
gfx/skia/skia/src/gpu/text/GrAtlasTextBlob.h
gfx/skia/skia/src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp
gfx/skia/skia/src/gpu/text/GrAtlasTextContext.cpp
gfx/skia/skia/src/gpu/text/GrAtlasTextContext.h
gfx/skia/skia/src/gpu/text/GrTextUtils.cpp
gfx/skia/skia/src/gpu/text/GrTextUtils.h
gfx/skia/skia/src/gpu/vk/GrVkBackendContext.cpp
gfx/skia/skia/src/gpu/vk/GrVkExtensions.h
gfx/skia/skia/src/gpu/vk/GrVkTexelBuffer.cpp
gfx/skia/skia/src/gpu/vk/GrVkTexelBuffer.h
gfx/skia/skia/src/jumper/SkJumper_generated.S
gfx/skia/skia/src/jumper/SkJumper_generated_win.S
gfx/skia/skia/src/jumper/SkJumper_stages.cpp
gfx/skia/skia/src/jumper/SkJumper_stages_lowp.cpp
gfx/skia/skia/src/jumper/build_stages.py
gfx/skia/skia/src/opts/SkOpts_hsw.cpp
gfx/skia/skia/src/pdf/SkPDFDocument.h
gfx/skia/skia/src/pipe/SkPipeCanvas.cpp
gfx/skia/skia/src/pipe/SkPipeCanvas.h
gfx/skia/skia/src/pipe/SkPipeFormat.h
gfx/skia/skia/src/pipe/SkPipeReader.cpp
gfx/skia/skia/src/pipe/SkRefSet.h
gfx/skia/skia/src/ports/SkImageGeneratorCG.h
gfx/skia/skia/src/ports/SkImageGeneratorWIC.h
gfx/skia/skia/src/shaders/gradients/SkGradientBitmapCache.cpp
gfx/skia/skia/src/shaders/gradients/SkGradientBitmapCache.h
gfx/skia/skia/src/shaders/gradients/SkTwoPointConicalGradient_gpu.cpp
gfx/skia/skia/src/shaders/gradients/SkTwoPointConicalGradient_gpu.h
gfx/skia/skia/src/sksl/SkSLLayoutLexer.cpp
gfx/skia/skia/src/sksl/SkSLLayoutLexer.h
gfx/skia/skia/src/sksl/lex/layout.lex
gfx/skia/skia/src/utils/SkDumpCanvas.cpp
gfx/skia/skia/src/utils/SkInsetConvexPolygon.cpp
gfx/skia/skia/src/utils/SkInsetConvexPolygon.h
gfx/skia/skia/src/utils/SkShadowTessellator.cpp
gfx/skia/skia/src/utils/SkTextBox.cpp
gfx/skia/skia/src/views/SkEvent.cpp
gfx/skia/skia/src/views/SkEventSink.cpp
gfx/skia/skia/src/views/SkTouchGesture.cpp
gfx/skia/skia/src/views/SkView.cpp
gfx/skia/skia/src/xps/SkXPSDocument.h
testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/mask-mode-a.html.ini
testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/mask-mode-b.html.ini
testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/mask-mode-c.html.ini
testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/mask-mode-d.html.ini
testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/mask-mode-to-mask-type.html.ini
testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/mask-opacity-1a.html.ini
testing/web-platform/meta/css/vendor-imports/mozilla/mozilla-central-reftests/masking/mask-opacity-1b.html.ini
toolkit/mozapps/extensions/test/browser/addons/browser_dragdrop1.xpi
toolkit/mozapps/extensions/test/browser/addons/browser_dragdrop2.xpi
toolkit/mozapps/extensions/test/browser/addons/browser_dragdrop_incompat.xpi
toolkit/mozapps/extensions/test/browser/addons/browser_installssl.xpi
toolkit/mozapps/extensions/test/browser/addons/browser_update1_1.xpi
toolkit/mozapps/extensions/test/browser/addons/browser_update1_2.xpi
toolkit/mozapps/extensions/test/browser/addons/browser_webapi_install/bootstrap.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about.js
@@ -1,14 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const TP_PB_ENABLED_PREF = "privacy.trackingprotection.pbmode.enabled";
-const CB_ENABLED_PREF = "browser.contentblocking.enabled";
 
 /**
  * Opens a new private window and loads "about:privatebrowsing" there.
  */
 async function openAboutPrivateBrowsing() {
   let win = await BrowserTestUtils.openNewBrowserWindow({
     private: true,
     waitForTabURL: "about:privatebrowsing",
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -7,16 +7,17 @@
 #include "DrawTargetSkia.h"
 #include "SourceSurfaceSkia.h"
 #include "ScaledFontBase.h"
 #include "FilterNodeSoftware.h"
 #include "HelpersSkia.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/CheckedInt.h"
+#include "mozilla/Vector.h"
 
 #include "skia/include/core/SkSurface.h"
 #include "skia/include/core/SkTypeface.h"
 #include "skia/include/effects/SkGradientShader.h"
 #include "skia/include/core/SkColorFilter.h"
 #include "skia/include/core/SkRegion.h"
 #include "skia/include/effects/SkBlurImageFilter.h"
 #include "Blur.h"
@@ -33,17 +34,16 @@
 #include "skia/include/gpu/GrContext.h"
 #include "skia/include/gpu/GrTexture.h"
 #include "skia/include/gpu/gl/GrGLInterface.h"
 #endif
 
 #ifdef MOZ_WIDGET_COCOA
 #include "BorrowedContext.h"
 #include <ApplicationServices/ApplicationServices.h>
-#include "mozilla/Vector.h"
 #include "ScaledFontMac.h"
 #include "CGTextDrawing.h"
 #endif
 
 #ifdef XP_WIN
 #include "ScaledFontDWrite.h"
 #endif
 
@@ -1436,26 +1436,16 @@ DrawTargetSkia::DrawGlyphs(ScaledFont* a
       // With explicit Grayscale AA (from -moz-osx-font-smoothing:grayscale),
       // we want to have grayscale AA with no smoothing at all. This means
       // disabling the LCD font smoothing behaviour.
       // To accomplish this we have to explicitly disable hinting,
       // and disable LCDRenderText.
       paint.mPaint.setHinting(SkPaint::kNo_Hinting);
     }
     break;
-  case FontType::GDI:
-  {
-    if (!shouldLCDRenderText && aaEnabled) {
-      // If we have non LCD GDI text, render the fonts as cleartype and convert them
-      // to grayscale. This seems to be what Chrome and IE are doing on Windows 7.
-      // This also applies if cleartype is disabled system wide.
-      paint.mPaint.setFlags(paint.mPaint.getFlags() | SkPaint::kGenA8FromLCD_Flag);
-    }
-    break;
-  }
 #ifdef XP_WIN
   case FontType::DWRITE:
   {
     ScaledFontDWrite* dwriteFont = static_cast<ScaledFontDWrite*>(aFont);
     paint.mPaint.setEmbeddedBitmapText(dwriteFont->UseEmbeddedBitmaps());
 
     if (dwriteFont->ForceGDIMode()) {
       paint.mPaint.setEmbeddedBitmapText(true);
@@ -1465,39 +1455,30 @@ DrawTargetSkia::DrawGlyphs(ScaledFont* a
   }
 #endif
   default:
     break;
   }
 
   paint.mPaint.setSubpixelText(useSubpixelText);
 
-  const uint32_t heapSize = 64;
-  uint16_t indicesOnStack[heapSize];
-  SkPoint offsetsOnStack[heapSize];
-  std::vector<uint16_t> indicesOnHeap;
-  std::vector<SkPoint> offsetsOnHeap;
-  uint16_t* indices = indicesOnStack;
-  SkPoint* offsets = offsetsOnStack;
-  if (aBuffer.mNumGlyphs > heapSize) {
-    // Heap allocation/ deallocation is slow, use it only if we need a
-    // bigger(>heapSize) buffer.
-    indicesOnHeap.resize(aBuffer.mNumGlyphs);
-    offsetsOnHeap.resize(aBuffer.mNumGlyphs);
-    indices = (uint16_t*)&indicesOnHeap.front();
-    offsets = (SkPoint*)&offsetsOnHeap.front();
+  Vector<uint16_t, 64> indices;
+  Vector<SkPoint, 64> offsets;
+  if (!indices.resizeUninitialized(aBuffer.mNumGlyphs) ||
+      !offsets.resizeUninitialized(aBuffer.mNumGlyphs)) {
+    gfxDebug() << "Failed allocating Skia text buffers for GlyphBuffer";
+    return;
   }
 
-  for (unsigned int i = 0; i < aBuffer.mNumGlyphs; i++) {
+  for (uint32_t i = 0; i < aBuffer.mNumGlyphs; i++) {
     indices[i] = aBuffer.mGlyphs[i].mIndex;
-    offsets[i].fX = SkFloatToScalar(aBuffer.mGlyphs[i].mPosition.x);
-    offsets[i].fY = SkFloatToScalar(aBuffer.mGlyphs[i].mPosition.y);
+    offsets[i] = PointToSkPoint(aBuffer.mGlyphs[i].mPosition);
   }
 
-  mCanvas->drawPosText(indices, aBuffer.mNumGlyphs*2, offsets, paint.mPaint);
+  mCanvas->drawPosText(indices.begin(), indices.length() * sizeof(uint16_t), offsets.begin(), paint.mPaint);
 }
 
 void
 DrawTargetSkia::FillGlyphs(ScaledFont* aFont,
                            const GlyphBuffer& aBuffer,
                            const Pattern& aPattern,
                            const DrawOptions& aOptions)
 {
@@ -2032,19 +2013,20 @@ DrawTargetSkia::SetTransform(const Matri
   mTransform = aTransform;
 }
 
 void*
 DrawTargetSkia::GetNativeSurface(NativeSurfaceType aType)
 {
 #ifdef USE_SKIA_GPU
   if (aType == NativeSurfaceType::OPENGL_TEXTURE && mSurface) {
-    GrBackendObject handle = mSurface->getTextureHandle(SkSurface::kFlushRead_BackendHandleAccess);
-    if (handle) {
-      return (void*)(uintptr_t)reinterpret_cast<GrGLTextureInfo *>(handle)->fID;
+    GrBackendTexture tex = mSurface->getBackendTexture(SkSurface::kFlushRead_BackendHandleAccess);
+    GrGLTextureInfo info;
+    if (tex.getGLTextureInfo(&info)) {
+      return (void*)(uintptr_t)info.fID;
     }
   }
 #endif
   return nullptr;
 }
 
 
 already_AddRefed<PathBuilder>
--- a/gfx/2d/dw-extra.h
+++ b/gfx/2d/dw-extra.h
@@ -57,17 +57,28 @@ struct DWRITE_FONT_AXIS_VALUE {
 };
 
 struct DWRITE_FONT_AXIS_RANGE {
     DWRITE_FONT_AXIS_TAG axisTag;
     FLOAT minValue;
     FLOAT maxValue;
 };
 
-struct DWRITE_GLYPH_IMAGE_DATA;
+struct DWRITE_GLYPH_IMAGE_DATA
+{
+    const void* imageData;
+    UINT32 imageDataSize;
+    UINT32 uniqueDataId;
+    UINT32 pixelsPerEm;
+    D2D1_SIZE_U pixelSize;
+    D2D1_POINT_2L horizontalLeftOrigin;
+    D2D1_POINT_2L horizontalRightOrigin;
+    D2D1_POINT_2L verticalTopOrigin;
+    D2D1_POINT_2L verticalBottomOrigin;
+};
 
 interface DWRITE_DECLARE_INTERFACE("27F2A904-4EB8-441D-9678-0563F53E3E2F") IDWriteFontFace4
     : public IDWriteFontFace3
 {
     STDMETHOD_(DWRITE_GLYPH_IMAGE_FORMATS, GetGlyphImageFormats)() PURE;
     STDMETHOD(GetGlyphImageFormats)(
         UINT16 glyphId,
         UINT32 pixelsPerEmFirst,
--- a/gfx/gl/SkiaGLGlue.cpp
+++ b/gfx/gl/SkiaGLGlue.cpp
@@ -143,18 +143,18 @@ static GrGLInterface* CreateGrGLInterfac
 
     // We support both desktop GL and GLES2
     if (context->IsGLES()) {
         i->fStandard = kGLES_GrGLStandard;
     } else {
         i->fStandard = kGL_GrGLStandard;
     }
 
-    GrGLFunction<GrGLGetStringProc> getString = WrapGL(context, &glGetString_mozilla);
-    GrGLFunction<GrGLGetIntegervProc> getIntegerv = WrapGL(context, &GLContext::fGetIntegerv);
+    GrGLFunction<GrGLGetStringFn> getString = WrapGL(context, &glGetString_mozilla);
+    GrGLFunction<GrGLGetIntegervFn> getIntegerv = WrapGL(context, &GLContext::fGetIntegerv);
 
     GrGLExtensions extensions;
     if (!extensions.init(i->fStandard, getString, nullptr, getIntegerv)) {
         delete i;
         return nullptr;
     }
 
     i->fExtensions.swap(&extensions);
@@ -306,17 +306,17 @@ static GrGLInterface* CreateGrGLInterfac
 
     return i;
 }
 
 SkiaGLGlue::SkiaGLGlue(GLContext* context)
     : mGLContext(context)
 {
     mGrGLInterface.reset(CreateGrGLInterfaceFromGLContext(mGLContext));
-    mGrContext.reset(GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)mGrGLInterface.get()));
+    mGrContext = GrContext::MakeGL(mGrGLInterface);
 }
 
 SkiaGLGlue::~SkiaGLGlue()
 {
     /*
      * These members have inter-dependencies, but do not keep each other alive, so
      * destruction order is very important here: mGrContext uses mGrGLInterface, and
      * through it, uses mGLContext
--- a/gfx/layers/apz/test/reftest/reftest.list
+++ b/gfx/layers/apz/test/reftest/reftest.list
@@ -1,22 +1,22 @@
 # The following tests test the async positioning of the scrollbars.
 # Basic root-frame scrollbar with async scrolling
-fuzzy-if(Android,1-1,2-2) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-1-v.html async-scrollbar-1-v-ref.html # bug 1392259
+fuzzy-if(Android,1-1,1-2) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-1-v.html async-scrollbar-1-v-ref.html # bug 1392259
 fuzzy-if(Android,0-4,0-5) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-1-h.html async-scrollbar-1-h-ref.html
 fuzzy-if(Android,0-3,0-5) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-1-vh.html async-scrollbar-1-vh-ref.html
-fuzzy-if(Android,1-1,2-2) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-1-v-rtl.html async-scrollbar-1-v-rtl-ref.html # bug 1392259
+fuzzy-if(Android,1-1,1-2) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-1-v-rtl.html async-scrollbar-1-v-rtl-ref.html # bug 1392259
 fuzzy-if(Android,0-4,0-5) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-1-h-rtl.html async-scrollbar-1-h-rtl-ref.html
 fuzzy-if(Android,0-3,0-7) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-1-vh-rtl.html async-scrollbar-1-vh-rtl-ref.html
 
 # Different async zoom levels. Since the scrollthumb gets async-scaled in the
 # compositor, the border-radius ends of the scrollthumb are going to be a little
 # off, hence the fuzzy-if clauses.
 fuzzy-if(Android,0-54,0-20) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-zoom-1.html async-scrollbar-zoom-1-ref.html
-fuzzy-if(Android,0-45,0-26) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-zoom-2.html async-scrollbar-zoom-2-ref.html
+fuzzy-if(Android,0-45,0-27) skip-if(!Android) pref(apz.allow_zooming,true) == async-scrollbar-zoom-2.html async-scrollbar-zoom-2-ref.html
 
 # Test scrollbars working properly with pinch-zooming, i.e. different document resolutions.
 # As above, the end of the scrollthumb won't match perfectly, but the bulk of the scrollbar should be present and identical.
 fuzzy-if(Android,0-54,0-14) skip-if(!Android) pref(apz.allow_zooming,true) == scrollbar-zoom-resolution-1.html scrollbar-zoom-resolution-1-ref.html
 fuzzy-if(Android,0-51,0-22) skip-if(!Android) pref(apz.allow_zooming,true) == scrollbar-zoom-resolution-2.html scrollbar-zoom-resolution-2-ref.html
 
 # Meta-viewport tag support
 skip-if(!Android) pref(apz.allow_zooming,true) == initial-scale-1.html initial-scale-1-ref.html
--- a/gfx/skia/generate_mozbuild.py
+++ b/gfx/skia/generate_mozbuild.py
@@ -37,72 +37,62 @@ footer = """
 AllowCompilerWarnings()
 
 FINAL_LIBRARY = 'gkmedias'
 LOCAL_INCLUDES += [
     'skia/include/c',
     'skia/include/codec',
     'skia/include/config',
     'skia/include/core',
+    'skia/include/docs',
     'skia/include/effects',
     'skia/include/encode',
     'skia/include/gpu',
     'skia/include/pathops',
     'skia/include/ports',
     'skia/include/private',
     'skia/include/utils',
     'skia/include/utils/mac',
-    'skia/include/views',
+    'skia/src/codec',
     'skia/src/core',
     'skia/src/gpu',
     'skia/src/gpu/effects',
     'skia/src/gpu/gl',
     'skia/src/gpu/glsl',
     'skia/src/image',
     'skia/src/lazy',
     'skia/src/opts',
     'skia/src/sfnt',
     'skia/src/shaders',
+    'skia/src/shaders/gradients',
     'skia/src/sksl',
     'skia/src/utils',
     'skia/src/utils/mac',
     'skia/src/utils/win',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
-    if CONFIG['CC_TYPE'] in ('gcc', 'clang'):
-        DEFINES['SK_JUMPER_USE_ASSEMBLY'] = 0
-    elif CONFIG['CPU_ARCH'] == 'x86':
-        SOURCES['skia/src/jumper/SkJumper_generated_win.S'].flags += ['-safeseh']
     DEFINES['UNICODE'] = True
     DEFINES['_UNICODE'] = True
     UNIFIED_SOURCES += [
         'skia/src/fonts/SkFontMgr_indirect.cpp',
         'skia/src/fonts/SkRemotableFontMgr.cpp',
     ]
 
-# Work around a crash when jumping into assembly on platforms where
-# Clang has 4-byte stack alignment.
-if CONFIG['CPU_ARCH'] == 'x86' and CONFIG['CC_TYPE'] == 'clang':
-    SOURCES['skia/src/jumper/SkJumper.cpp'].flags += [
-        '-mstack-alignment=16',
-        '-mstackrealign'
-    ]
-
 # We should autogenerate these SSE related flags.
 
 if CONFIG['INTEL_ARCHITECTURE'] and (CONFIG['CC_TYPE'] in ('clang', 'clang-cl', 'gcc')):
     SOURCES['skia/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
     SOURCES['skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-mssse3']
     SOURCES['skia/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
     SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-mssse3']
     SOURCES['skia/src/opts/SkOpts_sse41.cpp'].flags += ['-msse4.1']
     SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags += ['-msse4.2']
     SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-mavx']
-    SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-mavx2']
+    SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-mavx2', '-mf16c', '-mfma']
 elif CONFIG['CC_TYPE'] in ('msvc', 'clang-cl') and CONFIG['INTEL_ARCHITECTURE']:
     # MSVC doesn't need special compiler flags, but Skia needs to be told that these files should
     # be built with the required SSE level or it will simply compile in stubs and cause runtime crashes
     SOURCES['skia/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=20']
     SOURCES['skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=31']
     SOURCES['skia/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=20']
     SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=31']
     SOURCES['skia/src/opts/SkOpts_sse41.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=41']
@@ -207,85 +197,81 @@ def generate_separated_sources(platform_
   blacklist = [
     'GrGLMakeNativeInterface',
     'GrGLCreateNullInterface',
     'GrGLAssembleInterface',
     'GrGLTestInterface',
     'skia/src/android/',
     'skia/src/atlastext/',
     'skia/src/c/',
-    'skia/src/effects/Gr',
-    'skia/src/effects/Sk',
+    'skia/src/effects/',
     'skia/src/fonts/',
-    'skia/src/jumper/SkJumper_generated_win.S',
     'skia/src/ports/SkImageEncoder',
     'skia/src/ports/SkImageGenerator',
     'skia/src/gpu/vk/',
     'SkBitmapRegion',
     'SkLite',
+    'SkLight',
+    'SkNormal',
     'codec',
     'SkWGL',
     'SkMemory_malloc',
     'third_party',
+    'Sk3D',
+    'SkAnimCodecPlayer',
     'SkCamera',
     'SkCanvasStack',
     'SkCanvasStateUtils',
-    'SkCurveMeasure',
-    'SkDeferredCanvas',
-    'SkDumpCanvas',
     'SkFrontBufferedStream',
     'SkInterpolator',
     'SkMultiPictureDocument',
     'SkNullCanvas',
     'SkNWayCanvas',
     'SkOverdrawCanvas',
     'SkPaintFilterCanvas',
     'SkParseColor',
     'SkTextBox',
     'SkWhitelistTypefaces',
     'SkXPS',
     'SkCreateCGImageRef',
+    'skia/src/ports/SkGlobalInitialization',
   ]
 
   def isblacklisted(value):
     for item in blacklist:
       if value.find(item) >= 0:
         return True
 
     return False
 
   separated = defaultdict(set, {
     'common': {
-      'skia/src/core/SkBlurImageFilter.cpp',
-      'skia/src/core/SkGpuBlurUtils.cpp',
-      'skia/src/effects/GrCircleBlurFragmentProcessor.cpp',
-      'skia/src/effects/SkBlurMask.cpp',
-      'skia/src/effects/SkBlurMaskFilter.cpp',
+      'skia/src/codec/SkMasks.cpp',
+      'skia/src/effects/imagefilters/SkBlurImageFilter.cpp',
       'skia/src/effects/SkDashPathEffect.cpp',
-      'skia/src/effects/SkImageSource.cpp',
       'skia/src/gpu/gl/GrGLMakeNativeInterface_none.cpp',
       'skia/src/ports/SkDiscardableMemory_none.cpp',
+      'skia/src/ports/SkGlobalInitialization_none.cpp',
+      'skia/src/ports/SkGlobalInitialization_none_imagefilters.cpp',
       'skia/src/ports/SkMemory_mozalloc.cpp',
       'skia/src/ports/SkImageGenerator_none.cpp',
+      'skia/third_party/skcms/skcms.cc',
     },
     'android': {
       # 'skia/src/ports/SkDebug_android.cpp',
       'skia/src/ports/SkFontHost_cairo.cpp',
       # 'skia/src/ports/SkFontHost_FreeType.cpp',
       'skia/src/ports/SkFontHost_FreeType_common.cpp',
       # 'skia/src/ports/SkTime_Unix.cpp',
       # 'skia/src/utils/SkThreadUtils_pthread.cpp',
     },
     'linux': {
       'skia/src/ports/SkFontHost_cairo.cpp',
       'skia/src/ports/SkFontHost_FreeType_common.cpp',
     },
-    'no-mingw': {
-      'skia/src/jumper/SkJumper_generated_win.S',
-    },
     'intel': set(),
     'arm': set(),
     'arm64': set(),
     'none': set(),
     'pdf': set(),
     'gpu': set()
   })
 
@@ -342,16 +328,17 @@ opt_whitelist = [
   'SkOpts',
   'SkBitmapProcState',
   'SkBlitMask',
   'SkBlitRow',
   'SkBlitter',
   'SkJumper',
   'SkSpriteBlitter',
   'SkMatrix.cpp',
+  'skcms',
 ]
 
 # Unfortunately for now the gpu and pathops directories are
 # non-unifiable. Keep track of this and fix it.
 unified_blacklist = [
   'FontHost',
   'SkAdvancedTypefaceMetrics',
   'SkBitmapProcState_matrixProcs.cpp',
@@ -361,39 +348,41 @@ unified_blacklist = [
   'SkBlitter_Sprite.cpp',
   'SkScan_Antihair.cpp',
   'SkScan_AntiPath.cpp',
   'SkScan_DAAPath.cpp',
   'SkParse.cpp',
   'SkPDFFont.cpp',
   'SkPictureData.cpp',
   'skia/src/gpu/effects/',
+  'skia/src/gpu/gradients/',
   'GrResourceCache',
   'GrResourceProvider',
   'GrAA',
   'GrGL',
   'GrCCPathProcessor',
+  'GrCCStrokeGeometry',
   'GrMSAAPathRenderer.cpp',
   'GrNonAAFillRect',
   'GrPathUtils',
   'GrShadowRRectOp',
   'SkColorSpace',
   'SkImage_Gpu.cpp',
   'SkPathOpsDebug.cpp',
   'SkParsePath.cpp',
   'SkRecorder.cpp',
   'SkMiniRecorder.cpp',
   'SkXfermode',
   'SkMatrix44.cpp',
   'SkRTree.cpp',
   'SkVertices.cpp',
   'SkJumper',
+  'SkSLHCodeGenerator.cpp',
   'SkSLLexer.cpp',
   'SkSLLayoutLexer.cpp',
-  'SkThreadedBMPDevice.cpp',
 ] + opt_whitelist
 
 def write_sources(f, values, indent):
   def isblacklisted(value):
     for item in unified_blacklist:
       if value.find(item) >= 0:
         return True
 
@@ -451,20 +440,16 @@ def write_mozbuild(sources):
 
   f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):\n")
   write_sources(f, sources['mac'], 4)
 
   f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':\n")
   write_sources(f, sources['linux'], 4)
 
   f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':\n")
-  f.write("    if CONFIG['CC_TYPE'] not in ('gcc', 'clang') and CONFIG['CPU_ARCH'] != 'aarch64':\n")
-  write_list(f, "SOURCES", sources['no-mingw'], 8)
-  # Windows-specific files don't get unification because of nasty headers.
-  # Luckily there are not many files in this.
   write_list(f, "SOURCES", sources['win'], 4)
 
   f.write("if CONFIG['INTEL_ARCHITECTURE']:\n")
   write_sources(f, sources['intel'], 4)
   write_cflags(f, sources['intel'], opt_whitelist, 'skia_opt_flags', 4)
 
   f.write("elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['CC_TYPE'] in ('clang', 'gcc'):\n")
   write_sources(f, sources['arm'], 4)
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -18,62 +18,61 @@ skia_opt_flags = []
 
 if CONFIG['MOZ_OPTIMIZE']:
     if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
         skia_opt_flags += ['-O2']
     elif CONFIG['CC_TYPE'] in ('clang', 'gcc'):
         skia_opt_flags += ['-O3']
 
 UNIFIED_SOURCES += [
+    'skia/src/codec/SkMasks.cpp',
     'skia/src/core/SkAAClip.cpp',
     'skia/src/core/SkAlphaRuns.cpp',
     'skia/src/core/SkAnalyticEdge.cpp',
     'skia/src/core/SkAnnotation.cpp',
     'skia/src/core/SkArenaAlloc.cpp',
     'skia/src/core/SkATrace.cpp',
     'skia/src/core/SkAutoPixmapStorage.cpp',
     'skia/src/core/SkBBHFactory.cpp',
     'skia/src/core/SkBigPicture.cpp',
     'skia/src/core/SkBitmap.cpp',
     'skia/src/core/SkBitmapCache.cpp',
     'skia/src/core/SkBitmapController.cpp',
     'skia/src/core/SkBitmapDevice.cpp',
     'skia/src/core/SkBitmapProvider.cpp',
     'skia/src/core/SkBitmapScaler.cpp',
     'skia/src/core/SkBlendMode.cpp',
-    'skia/src/core/SkBlurImageFilter.cpp',
+    'skia/src/core/SkBlurMask.cpp',
+    'skia/src/core/SkBlurMF.cpp',
     'skia/src/core/SkBuffer.cpp',
     'skia/src/core/SkCachedData.cpp',
     'skia/src/core/SkCanvas.cpp',
     'skia/src/core/SkCanvasPriv.cpp',
     'skia/src/core/SkClipStack.cpp',
     'skia/src/core/SkClipStackDevice.cpp',
     'skia/src/core/SkColor.cpp',
     'skia/src/core/SkColorFilter.cpp',
-    'skia/src/core/SkColorLookUpTable.cpp',
     'skia/src/core/SkColorMatrixFilterRowMajor255.cpp',
-    'skia/src/core/SkColorTable.cpp',
     'skia/src/core/SkConvertPixels.cpp',
     'skia/src/core/SkConvolver.cpp',
     'skia/src/core/SkCoverageDelta.cpp',
     'skia/src/core/SkCpu.cpp',
     'skia/src/core/SkCubicClipper.cpp',
     'skia/src/core/SkCubicMap.cpp',
     'skia/src/core/SkData.cpp',
     'skia/src/core/SkDataTable.cpp',
     'skia/src/core/SkDebug.cpp',
     'skia/src/core/SkDeferredDisplayList.cpp',
     'skia/src/core/SkDeferredDisplayListRecorder.cpp',
     'skia/src/core/SkDeque.cpp',
     'skia/src/core/SkDevice.cpp',
-    'skia/src/core/SkDeviceProfile.cpp',
     'skia/src/core/SkDistanceFieldGen.cpp',
-    'skia/src/core/SkDither.cpp',
     'skia/src/core/SkDocument.cpp',
     'skia/src/core/SkDraw.cpp',
+    'skia/src/core/SkDraw_text.cpp',
     'skia/src/core/SkDraw_vertices.cpp',
     'skia/src/core/SkDrawable.cpp',
     'skia/src/core/SkDrawLooper.cpp',
     'skia/src/core/SkDrawShadowInfo.cpp',
     'skia/src/core/SkEdge.cpp',
     'skia/src/core/SkEdgeBuilder.cpp',
     'skia/src/core/SkEdgeClipper.cpp',
     'skia/src/core/SkExecutor.cpp',
@@ -82,17 +81,20 @@ UNIFIED_SOURCES += [
     'skia/src/core/SkFont.cpp',
     'skia/src/core/SkFontDescriptor.cpp',
     'skia/src/core/SkFontLCDConfig.cpp',
     'skia/src/core/SkFontMgr.cpp',
     'skia/src/core/SkFontStream.cpp',
     'skia/src/core/SkGaussFilter.cpp',
     'skia/src/core/SkGeometry.cpp',
     'skia/src/core/SkGlobalInitialization_core.cpp',
+    'skia/src/core/SkGlyph.cpp',
     'skia/src/core/SkGlyphCache.cpp',
+    'skia/src/core/SkGlyphRun.cpp',
+    'skia/src/core/SkGlyphRunPainter.cpp',
     'skia/src/core/SkGpuBlurUtils.cpp',
     'skia/src/core/SkGraphics.cpp',
     'skia/src/core/SkHalf.cpp',
     'skia/src/core/SkICC.cpp',
     'skia/src/core/SkImageFilter.cpp',
     'skia/src/core/SkImageFilterCache.cpp',
     'skia/src/core/SkImageGenerator.cpp',
     'skia/src/core/SkImageInfo.cpp',
@@ -108,16 +110,17 @@ UNIFIED_SOURCES += [
     'skia/src/core/SkMath.cpp',
     'skia/src/core/SkMatrixImageFilter.cpp',
     'skia/src/core/SkMD5.cpp',
     'skia/src/core/SkMetaData.cpp',
     'skia/src/core/SkMipMap.cpp',
     'skia/src/core/SkModeColorFilter.cpp',
     'skia/src/core/SkMultiPictureDraw.cpp',
     'skia/src/core/SkPaint.cpp',
+    'skia/src/core/SkPaint_text.cpp',
     'skia/src/core/SkPaintPriv.cpp',
     'skia/src/core/SkPath.cpp',
     'skia/src/core/SkPath_serial.cpp',
     'skia/src/core/SkPathEffect.cpp',
     'skia/src/core/SkPathMeasure.cpp',
     'skia/src/core/SkPathRef.cpp',
     'skia/src/core/SkPicture.cpp',
     'skia/src/core/SkPictureFlat.cpp',
@@ -136,17 +139,16 @@ UNIFIED_SOURCES += [
     'skia/src/core/SkRasterPipelineBlitter.cpp',
     'skia/src/core/SkReadBuffer.cpp',
     'skia/src/core/SkRecord.cpp',
     'skia/src/core/SkRecordDraw.cpp',
     'skia/src/core/SkRecordedDrawable.cpp',
     'skia/src/core/SkRecordOpts.cpp',
     'skia/src/core/SkRecords.cpp',
     'skia/src/core/SkRect.cpp',
-    'skia/src/core/SkRefDict.cpp',
     'skia/src/core/SkRegion.cpp',
     'skia/src/core/SkRegion_path.cpp',
     'skia/src/core/SkRemoteGlyphCache.cpp',
     'skia/src/core/SkResourceCache.cpp',
     'skia/src/core/SkRRect.cpp',
     'skia/src/core/SkRWBuffer.cpp',
     'skia/src/core/SkScalar.cpp',
     'skia/src/core/SkScalerContext.cpp',
@@ -154,45 +156,42 @@ UNIFIED_SOURCES += [
     'skia/src/core/SkScan_AAAPath.cpp',
     'skia/src/core/SkScan_Hairline.cpp',
     'skia/src/core/SkScan_Path.cpp',
     'skia/src/core/SkSemaphore.cpp',
     'skia/src/core/SkSharedMutex.cpp',
     'skia/src/core/SkSpecialImage.cpp',
     'skia/src/core/SkSpecialSurface.cpp',
     'skia/src/core/SkSpinlock.cpp',
-    'skia/src/core/SkSRGB.cpp',
     'skia/src/core/SkStream.cpp',
+    'skia/src/core/SkStrikeCache.cpp',
     'skia/src/core/SkString.cpp',
     'skia/src/core/SkStringUtils.cpp',
     'skia/src/core/SkStroke.cpp',
     'skia/src/core/SkStrokeRec.cpp',
     'skia/src/core/SkStrokerPriv.cpp',
+    'skia/src/core/SkSurfaceCharacterization.cpp',
     'skia/src/core/SkSwizzle.cpp',
     'skia/src/core/SkTaskGroup.cpp',
-    'skia/src/core/SkTaskGroup2D.cpp',
     'skia/src/core/SkTextBlob.cpp',
     'skia/src/core/SkThreadID.cpp',
     'skia/src/core/SkTime.cpp',
     'skia/src/core/SkTLS.cpp',
     'skia/src/core/SkTSearch.cpp',
     'skia/src/core/SkTypeface.cpp',
     'skia/src/core/SkTypeface_remote.cpp',
     'skia/src/core/SkTypefaceCache.cpp',
     'skia/src/core/SkUnPreMultiply.cpp',
     'skia/src/core/SkUtils.cpp',
     'skia/src/core/SkVertState.cpp',
     'skia/src/core/SkWriteBuffer.cpp',
     'skia/src/core/SkWriter32.cpp',
     'skia/src/core/SkYUVPlanesCache.cpp',
-    'skia/src/effects/GrCircleBlurFragmentProcessor.cpp',
-    'skia/src/effects/SkBlurMask.cpp',
-    'skia/src/effects/SkBlurMaskFilter.cpp',
+    'skia/src/effects/imagefilters/SkBlurImageFilter.cpp',
     'skia/src/effects/SkDashPathEffect.cpp',
-    'skia/src/effects/SkImageSource.cpp',
     'skia/src/image/SkImage.cpp',
     'skia/src/image/SkImage_Lazy.cpp',
     'skia/src/image/SkImage_Raster.cpp',
     'skia/src/image/SkSurface.cpp',
     'skia/src/image/SkSurface_Raster.cpp',
     'skia/src/images/SkImageEncoder.cpp',
     'skia/src/lazy/SkDiscardableMemoryPool.cpp',
     'skia/src/pathops/SkAddIntersections.cpp',
@@ -205,73 +204,73 @@ UNIFIED_SOURCES += [
     'skia/src/pathops/SkOpAngle.cpp',
     'skia/src/pathops/SkOpBuilder.cpp',
     'skia/src/pathops/SkOpCoincidence.cpp',
     'skia/src/pathops/SkOpContour.cpp',
     'skia/src/pathops/SkOpCubicHull.cpp',
     'skia/src/pathops/SkOpEdgeBuilder.cpp',
     'skia/src/pathops/SkOpSegment.cpp',
     'skia/src/pathops/SkOpSpan.cpp',
+    'skia/src/pathops/SkPathOpsAsWinding.cpp',
     'skia/src/pathops/SkPathOpsCommon.cpp',
     'skia/src/pathops/SkPathOpsConic.cpp',
     'skia/src/pathops/SkPathOpsCubic.cpp',
     'skia/src/pathops/SkPathOpsCurve.cpp',
     'skia/src/pathops/SkPathOpsLine.cpp',
     'skia/src/pathops/SkPathOpsOp.cpp',
     'skia/src/pathops/SkPathOpsPoint.cpp',
     'skia/src/pathops/SkPathOpsQuad.cpp',
     'skia/src/pathops/SkPathOpsRect.cpp',
     'skia/src/pathops/SkPathOpsSimplify.cpp',
     'skia/src/pathops/SkPathOpsTightBounds.cpp',
     'skia/src/pathops/SkPathOpsTSect.cpp',
     'skia/src/pathops/SkPathOpsTypes.cpp',
     'skia/src/pathops/SkPathOpsWinding.cpp',
     'skia/src/pathops/SkPathWriter.cpp',
     'skia/src/pathops/SkReduceOrder.cpp',
-    'skia/src/pipe/SkPipeCanvas.cpp',
-    'skia/src/pipe/SkPipeReader.cpp',
     'skia/src/ports/SkDiscardableMemory_none.cpp',
-    'skia/src/ports/SkGlobalInitialization_default.cpp',
+    'skia/src/ports/SkGlobalInitialization_none.cpp',
+    'skia/src/ports/SkGlobalInitialization_none_imagefilters.cpp',
     'skia/src/ports/SkImageGenerator_none.cpp',
     'skia/src/ports/SkMemory_mozalloc.cpp',
     'skia/src/ports/SkOSFile_stdio.cpp',
     'skia/src/sfnt/SkOTTable_name.cpp',
     'skia/src/sfnt/SkOTUtils.cpp',
     'skia/src/shaders/gradients/Sk4fGradientBase.cpp',
     'skia/src/shaders/gradients/Sk4fLinearGradient.cpp',
-    'skia/src/shaders/gradients/SkGradientBitmapCache.cpp',
     'skia/src/shaders/gradients/SkGradientShader.cpp',
     'skia/src/shaders/gradients/SkLinearGradient.cpp',
     'skia/src/shaders/gradients/SkRadialGradient.cpp',
     'skia/src/shaders/gradients/SkSweepGradient.cpp',
     'skia/src/shaders/gradients/SkTwoPointConicalGradient.cpp',
-    'skia/src/shaders/gradients/SkTwoPointConicalGradient_gpu.cpp',
     'skia/src/shaders/SkBitmapProcShader.cpp',
     'skia/src/shaders/SkColorFilterShader.cpp',
     'skia/src/shaders/SkColorShader.cpp',
     'skia/src/shaders/SkComposeShader.cpp',
     'skia/src/shaders/SkImageShader.cpp',
     'skia/src/shaders/SkLocalMatrixShader.cpp',
     'skia/src/shaders/SkPerlinNoiseShader.cpp',
     'skia/src/shaders/SkPictureShader.cpp',
     'skia/src/shaders/SkShader.cpp',
     'skia/src/utils/mac/SkStream_mac.cpp',
     'skia/src/utils/SkBase64.cpp',
     'skia/src/utils/SkDashPath.cpp',
     'skia/src/utils/SkEventTracer.cpp',
     'skia/src/utils/SkFloatToDecimal.cpp',
-    'skia/src/utils/SkInsetConvexPolygon.cpp',
+    'skia/src/utils/SkJSON.cpp',
     'skia/src/utils/SkJSONWriter.cpp',
     'skia/src/utils/SkMatrix22.cpp',
     'skia/src/utils/SkOSPath.cpp',
     'skia/src/utils/SkPatchUtils.cpp',
+    'skia/src/utils/SkPolyUtils.cpp',
     'skia/src/utils/SkShadowTessellator.cpp',
     'skia/src/utils/SkShadowUtils.cpp',
     'skia/src/utils/SkThreadUtils_pthread.cpp',
     'skia/src/utils/SkThreadUtils_win.cpp',
+    'skia/src/utils/SkUTF.cpp',
     'skia/src/utils/win/SkAutoCoInitialize.cpp',
     'skia/src/utils/win/SkDWrite.cpp',
     'skia/src/utils/win/SkDWriteFontFileStream.cpp',
     'skia/src/utils/win/SkDWriteGeometrySink.cpp',
     'skia/src/utils/win/SkHRESULT.cpp',
     'skia/src/utils/win/SkIStream.cpp',
 ]
 SOURCES += [
@@ -280,147 +279,146 @@ SOURCES += [
     'skia/src/core/SkBlitMask_D32.cpp',
     'skia/src/core/SkBlitRow_D32.cpp',
     'skia/src/core/SkBlitter.cpp',
     'skia/src/core/SkBlitter_A8.cpp',
     'skia/src/core/SkBlitter_ARGB32.cpp',
     'skia/src/core/SkBlitter_RGB565.cpp',
     'skia/src/core/SkBlitter_Sprite.cpp',
     'skia/src/core/SkColorSpace.cpp',
-    'skia/src/core/SkColorSpace_A2B.cpp',
-    'skia/src/core/SkColorSpace_ICC.cpp',
-    'skia/src/core/SkColorSpace_New.cpp',
-    'skia/src/core/SkColorSpace_XYZ.cpp',
-    'skia/src/core/SkColorSpaceXform.cpp',
-    'skia/src/core/SkColorSpaceXform_A2B.cpp',
     'skia/src/core/SkColorSpaceXformCanvas.cpp',
     'skia/src/core/SkColorSpaceXformer.cpp',
+    'skia/src/core/SkColorSpaceXformSteps.cpp',
     'skia/src/core/SkMatrix.cpp',
     'skia/src/core/SkMatrix44.cpp',
     'skia/src/core/SkMiniRecorder.cpp',
     'skia/src/core/SkOpts.cpp',
     'skia/src/core/SkPictureData.cpp',
     'skia/src/core/SkRecorder.cpp',
     'skia/src/core/SkRTree.cpp',
     'skia/src/core/SkScan_Antihair.cpp',
     'skia/src/core/SkScan_AntiPath.cpp',
     'skia/src/core/SkScan_DAAPath.cpp',
     'skia/src/core/SkSpriteBlitter_ARGB32.cpp',
     'skia/src/core/SkSpriteBlitter_RGB565.cpp',
-    'skia/src/core/SkThreadedBMPDevice.cpp',
     'skia/src/core/SkVertices.cpp',
     'skia/src/core/SkXfermode.cpp',
     'skia/src/core/SkXfermodeInterpretation.cpp',
     'skia/src/gpu/gl/GrGLMakeNativeInterface_none.cpp',
     'skia/src/jumper/SkJumper.cpp',
-    'skia/src/jumper/SkJumper_stages.cpp',
-    'skia/src/jumper/SkJumper_stages_lowp.cpp',
     'skia/src/pathops/SkPathOpsDebug.cpp',
     'skia/src/utils/SkParse.cpp',
     'skia/src/utils/SkParsePath.cpp',
+    'skia/third_party/skcms/skcms.cc',
 ]
 SOURCES['skia/src/core/SkBitmapProcState.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkBitmapProcState_matrixProcs.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkBlitMask_D32.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkBlitRow_D32.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkBlitter.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkBlitter_A8.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkBlitter_ARGB32.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkBlitter_RGB565.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkBlitter_Sprite.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkMatrix.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkOpts.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkSpriteBlitter_ARGB32.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/core/SkSpriteBlitter_RGB565.cpp'].flags += skia_opt_flags
 SOURCES['skia/src/jumper/SkJumper.cpp'].flags += skia_opt_flags
-SOURCES['skia/src/jumper/SkJumper_stages.cpp'].flags += skia_opt_flags
-SOURCES['skia/src/jumper/SkJumper_stages_lowp.cpp'].flags += skia_opt_flags
+SOURCES['skia/third_party/skcms/skcms.cc'].flags += skia_opt_flags
 if CONFIG['MOZ_ENABLE_SKIA_PDF']:
     UNIFIED_SOURCES += [
+        'skia/src/pdf/SkClusterator.cpp',
         'skia/src/pdf/SkDeflate.cpp',
         'skia/src/pdf/SkJpegInfo.cpp',
         'skia/src/pdf/SkKeyedImage.cpp',
         'skia/src/pdf/SkPDFBitmap.cpp',
         'skia/src/pdf/SkPDFCanon.cpp',
         'skia/src/pdf/SkPDFConvertType1FontStream.cpp',
         'skia/src/pdf/SkPDFDevice.cpp',
         'skia/src/pdf/SkPDFDocument.cpp',
         'skia/src/pdf/SkPDFFormXObject.cpp',
         'skia/src/pdf/SkPDFGradientShader.cpp',
         'skia/src/pdf/SkPDFGraphicState.cpp',
         'skia/src/pdf/SkPDFMakeCIDGlyphWidthsArray.cpp',
         'skia/src/pdf/SkPDFMakeToUnicodeCmap.cpp',
         'skia/src/pdf/SkPDFMetadata.cpp',
         'skia/src/pdf/SkPDFResourceDict.cpp',
         'skia/src/pdf/SkPDFShader.cpp',
+        'skia/src/pdf/SkPDFTag.cpp',
         'skia/src/pdf/SkPDFTypes.cpp',
         'skia/src/pdf/SkPDFUtils.cpp',
     ]
     SOURCES += [
         'skia/src/pdf/SkPDFFont.cpp',
     ]
 if CONFIG['MOZ_ENABLE_SKIA_GPU']:
     UNIFIED_SOURCES += [
         'skia/src/gpu/ccpr/GrCCAtlas.cpp',
+        'skia/src/gpu/ccpr/GrCCClipPath.cpp',
         'skia/src/gpu/ccpr/GrCCClipProcessor.cpp',
+        'skia/src/gpu/ccpr/GrCCConicShader.cpp',
         'skia/src/gpu/ccpr/GrCCCoverageProcessor.cpp',
         'skia/src/gpu/ccpr/GrCCCoverageProcessor_GSImpl.cpp',
         'skia/src/gpu/ccpr/GrCCCoverageProcessor_VSImpl.cpp',
         'skia/src/gpu/ccpr/GrCCCubicShader.cpp',
-        'skia/src/gpu/ccpr/GrCCGeometry.cpp',
-        'skia/src/gpu/ccpr/GrCCPathParser.cpp',
+        'skia/src/gpu/ccpr/GrCCDrawPathsOp.cpp',
+        'skia/src/gpu/ccpr/GrCCFiller.cpp',
+        'skia/src/gpu/ccpr/GrCCFillGeometry.cpp',
+        'skia/src/gpu/ccpr/GrCCPathCache.cpp',
+        'skia/src/gpu/ccpr/GrCCPerFlushResources.cpp',
         'skia/src/gpu/ccpr/GrCCQuadraticShader.cpp',
-        'skia/src/gpu/ccpr/GrCCTriangleShader.cpp',
+        'skia/src/gpu/ccpr/GrCCStroker.cpp',
         'skia/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp',
         'skia/src/gpu/GrAHardwareBufferImageGenerator.cpp',
         'skia/src/gpu/GrAuditTrail.cpp',
         'skia/src/gpu/GrBackendSurface.cpp',
         'skia/src/gpu/GrBackendTextureImageGenerator.cpp',
         'skia/src/gpu/GrBitmapTextureMaker.cpp',
-        'skia/src/gpu/GrBlend.cpp',
         'skia/src/gpu/GrBlurUtils.cpp',
         'skia/src/gpu/GrBuffer.cpp',
         'skia/src/gpu/GrBufferAllocPool.cpp',
         'skia/src/gpu/GrCaps.cpp',
         'skia/src/gpu/GrClipStackClip.cpp',
         'skia/src/gpu/GrColorSpaceInfo.cpp',
         'skia/src/gpu/GrColorSpaceXform.cpp',
         'skia/src/gpu/GrContext.cpp',
+        'skia/src/gpu/GrDDLContext.cpp',
         'skia/src/gpu/GrDefaultGeoProcFactory.cpp',
+        'skia/src/gpu/GrDirectContext.cpp',
         'skia/src/gpu/GrDistanceFieldGenFromVector.cpp',
         'skia/src/gpu/GrDrawingManager.cpp',
         'skia/src/gpu/GrDrawOpAtlas.cpp',
         'skia/src/gpu/GrDrawOpTest.cpp',
+        'skia/src/gpu/GrDriverBugWorkarounds.cpp',
         'skia/src/gpu/GrFixedClip.cpp',
         'skia/src/gpu/GrFragmentProcessor.cpp',
         'skia/src/gpu/GrGpu.cpp',
         'skia/src/gpu/GrGpuCommandBuffer.cpp',
-        'skia/src/gpu/GrGpuFactory.cpp',
         'skia/src/gpu/GrGpuResource.cpp',
-        'skia/src/gpu/GrGpuResourceRef.cpp',
         'skia/src/gpu/GrImageTextureMaker.cpp',
         'skia/src/gpu/GrMemoryPool.cpp',
         'skia/src/gpu/GrOnFlushResourceProvider.cpp',
         'skia/src/gpu/GrOpFlushState.cpp',
         'skia/src/gpu/GrOpList.cpp',
         'skia/src/gpu/GrPaint.cpp',
         'skia/src/gpu/GrPath.cpp',
         'skia/src/gpu/GrPathProcessor.cpp',
-        'skia/src/gpu/GrPathRange.cpp',
         'skia/src/gpu/GrPathRenderer.cpp',
         'skia/src/gpu/GrPathRendererChain.cpp',
         'skia/src/gpu/GrPathRendering.cpp',
         'skia/src/gpu/GrPipeline.cpp',
         'skia/src/gpu/GrPrimitiveProcessor.cpp',
         'skia/src/gpu/GrProcessor.cpp',
         'skia/src/gpu/GrProcessorAnalysis.cpp',
         'skia/src/gpu/GrProcessorSet.cpp',
         'skia/src/gpu/GrProcessorUnitTest.cpp',
         'skia/src/gpu/GrProgramDesc.cpp',
         'skia/src/gpu/GrProxyProvider.cpp',
+        'skia/src/gpu/GrQuad.cpp',
         'skia/src/gpu/GrRectanizer_pow2.cpp',
         'skia/src/gpu/GrRectanizer_skyline.cpp',
         'skia/src/gpu/GrReducedClip.cpp',
         'skia/src/gpu/GrRenderTarget.cpp',
         'skia/src/gpu/GrRenderTargetContext.cpp',
         'skia/src/gpu/GrRenderTargetOpList.cpp',
         'skia/src/gpu/GrRenderTargetProxy.cpp',
         'skia/src/gpu/GrResourceAllocator.cpp',
@@ -430,36 +428,38 @@ if CONFIG['MOZ_ENABLE_SKIA_GPU']:
         'skia/src/gpu/GrSKSLPrettyPrint.cpp',
         'skia/src/gpu/GrSoftwarePathRenderer.cpp',
         'skia/src/gpu/GrStencilAttachment.cpp',
         'skia/src/gpu/GrStencilSettings.cpp',
         'skia/src/gpu/GrStyle.cpp',
         'skia/src/gpu/GrSurface.cpp',
         'skia/src/gpu/GrSurfaceContext.cpp',
         'skia/src/gpu/GrSurfaceProxy.cpp',
-        'skia/src/gpu/GrSurfaceProxyRef.cpp',
         'skia/src/gpu/GrSWMaskHelper.cpp',
         'skia/src/gpu/GrTessellator.cpp',
         'skia/src/gpu/GrTestUtils.cpp',
         'skia/src/gpu/GrTexture.cpp',
         'skia/src/gpu/GrTextureAdjuster.cpp',
         'skia/src/gpu/GrTextureContext.cpp',
         'skia/src/gpu/GrTextureMaker.cpp',
         'skia/src/gpu/GrTextureOpList.cpp',
         'skia/src/gpu/GrTextureProducer.cpp',
         'skia/src/gpu/GrTextureProxy.cpp',
         'skia/src/gpu/GrTextureRenderTargetProxy.cpp',
+        'skia/src/gpu/GrUninstantiateProxyTracker.cpp',
         'skia/src/gpu/GrXferProcessor.cpp',
         'skia/src/gpu/GrYUVProvider.cpp',
         'skia/src/gpu/mock/GrMockGpu.cpp',
         'skia/src/gpu/ops/GrAtlasTextOp.cpp',
         'skia/src/gpu/ops/GrClearOp.cpp',
+        'skia/src/gpu/ops/GrClearStencilClipOp.cpp',
         'skia/src/gpu/ops/GrCopySurfaceOp.cpp',
         'skia/src/gpu/ops/GrDashLinePathRenderer.cpp',
         'skia/src/gpu/ops/GrDashOp.cpp',
+        'skia/src/gpu/ops/GrDebugMarkerOp.cpp',
         'skia/src/gpu/ops/GrDefaultPathRenderer.cpp',
         'skia/src/gpu/ops/GrDrawAtlasOp.cpp',
         'skia/src/gpu/ops/GrDrawPathOp.cpp',
         'skia/src/gpu/ops/GrDrawVerticesOp.cpp',
         'skia/src/gpu/ops/GrLatticeOp.cpp',
         'skia/src/gpu/ops/GrMeshDrawOp.cpp',
         'skia/src/gpu/ops/GrNonAAStrokeRectOp.cpp',
         'skia/src/gpu/ops/GrOp.cpp',
@@ -470,90 +470,94 @@ if CONFIG['MOZ_ENABLE_SKIA_GPU']:
         'skia/src/gpu/ops/GrSmallPathRenderer.cpp',
         'skia/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp',
         'skia/src/gpu/ops/GrStencilPathOp.cpp',
         'skia/src/gpu/ops/GrTessellatingPathRenderer.cpp',
         'skia/src/gpu/ops/GrTextureOp.cpp',
         'skia/src/gpu/SkGpuDevice.cpp',
         'skia/src/gpu/SkGpuDevice_drawTexture.cpp',
         'skia/src/gpu/SkGr.cpp',
-        'skia/src/gpu/text/GrAtlasGlyphCache.cpp',
-        'skia/src/gpu/text/GrAtlasTextBlob.cpp',
-        'skia/src/gpu/text/GrAtlasTextBlobVertexRegenerator.cpp',
-        'skia/src/gpu/text/GrAtlasTextContext.cpp',
+        'skia/src/gpu/text/GrAtlasManager.cpp',
         'skia/src/gpu/text/GrDistanceFieldAdjustTable.cpp',
+        'skia/src/gpu/text/GrGlyphCache.cpp',
+        'skia/src/gpu/text/GrSDFMaskFilter.cpp',
+        'skia/src/gpu/text/GrTextBlob.cpp',
         'skia/src/gpu/text/GrTextBlobCache.cpp',
-        'skia/src/gpu/text/GrTextUtils.cpp',
+        'skia/src/gpu/text/GrTextBlobVertexRegenerator.cpp',
+        'skia/src/gpu/text/GrTextContext.cpp',
+        'skia/src/image/SkImage_GpuBase.cpp',
+        'skia/src/image/SkImage_GpuYUVA.cpp',
         'skia/src/image/SkSurface_Gpu.cpp',
         'skia/src/sksl/ir/SkSLSetting.cpp',
         'skia/src/sksl/ir/SkSLSymbolTable.cpp',
         'skia/src/sksl/ir/SkSLType.cpp',
+        'skia/src/sksl/ir/SkSLVariableReference.cpp',
         'skia/src/sksl/SkSLCFGGenerator.cpp',
         'skia/src/sksl/SkSLCompiler.cpp',
         'skia/src/sksl/SkSLCPPCodeGenerator.cpp',
+        'skia/src/sksl/SkSLCPPUniformCTypes.cpp',
         'skia/src/sksl/SkSLGLSLCodeGenerator.cpp',
-        'skia/src/sksl/SkSLHCodeGenerator.cpp',
+        'skia/src/sksl/SkSLInterpreter.cpp',
         'skia/src/sksl/SkSLIRGenerator.cpp',
+        'skia/src/sksl/SkSLJIT.cpp',
         'skia/src/sksl/SkSLMetalCodeGenerator.cpp',
         'skia/src/sksl/SkSLParser.cpp',
+        'skia/src/sksl/SkSLPipelineStageCodeGenerator.cpp',
         'skia/src/sksl/SkSLSPIRVCodeGenerator.cpp',
         'skia/src/sksl/SkSLString.cpp',
         'skia/src/sksl/SkSLUtil.cpp',
     ]
     SOURCES += [
         'skia/src/gpu/ccpr/GrCCPathProcessor.cpp',
+        'skia/src/gpu/ccpr/GrCCStrokeGeometry.cpp',
         'skia/src/gpu/effects/GrAARectEffect.cpp',
-        'skia/src/gpu/effects/GrArithmeticFP.cpp',
+        'skia/src/gpu/effects/GrAlphaThresholdFragmentProcessor.cpp',
         'skia/src/gpu/effects/GrBezierEffect.cpp',
         'skia/src/gpu/effects/GrBicubicEffect.cpp',
         'skia/src/gpu/effects/GrBitmapTextGeoProc.cpp',
         'skia/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp',
+        'skia/src/gpu/effects/GrCircleBlurFragmentProcessor.cpp',
         'skia/src/gpu/effects/GrCircleEffect.cpp',
         'skia/src/gpu/effects/GrConfigConversionEffect.cpp',
         'skia/src/gpu/effects/GrConstColorProcessor.cpp',
         'skia/src/gpu/effects/GrConvexPolyEffect.cpp',
         'skia/src/gpu/effects/GrCoverageSetOpXP.cpp',
         'skia/src/gpu/effects/GrCustomXfermode.cpp',
         'skia/src/gpu/effects/GrDisableColorXP.cpp',
         'skia/src/gpu/effects/GrDistanceFieldGeoProc.cpp',
-        'skia/src/gpu/effects/GrDitherEffect.cpp',
         'skia/src/gpu/effects/GrEllipseEffect.cpp',
         'skia/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp',
         'skia/src/gpu/effects/GrLumaColorFilterEffect.cpp',
         'skia/src/gpu/effects/GrMagnifierEffect.cpp',
         'skia/src/gpu/effects/GrMatrixConvolutionEffect.cpp',
-        'skia/src/gpu/effects/GrNonlinearColorSpaceXformEffect.cpp',
         'skia/src/gpu/effects/GrOvalEffect.cpp',
-        'skia/src/gpu/effects/GrOverdrawFragmentProcessor.cpp',
         'skia/src/gpu/effects/GrPorterDuffXferProcessor.cpp',
         'skia/src/gpu/effects/GrPremulInputFragmentProcessor.cpp',
         'skia/src/gpu/effects/GrRectBlurEffect.cpp',
         'skia/src/gpu/effects/GrRRectBlurEffect.cpp',
         'skia/src/gpu/effects/GrRRectEffect.cpp',
         'skia/src/gpu/effects/GrShadowGeoProc.cpp',
         'skia/src/gpu/effects/GrSimpleTextureEffect.cpp',
+        'skia/src/gpu/effects/GrSkSLFP.cpp',
         'skia/src/gpu/effects/GrSRGBEffect.cpp',
         'skia/src/gpu/effects/GrTextureDomain.cpp',
-        'skia/src/gpu/effects/GrTextureStripAtlas.cpp',
-        'skia/src/gpu/effects/GrUnpremulInputFragmentProcessor.cpp',
         'skia/src/gpu/effects/GrXfermodeFragmentProcessor.cpp',
         'skia/src/gpu/effects/GrYUVtoRGBEffect.cpp',
         'skia/src/gpu/gl/builders/GrGLProgramBuilder.cpp',
         'skia/src/gpu/gl/builders/GrGLShaderStringBuilder.cpp',
         'skia/src/gpu/gl/GrGLBuffer.cpp',
         'skia/src/gpu/gl/GrGLCaps.cpp',
         'skia/src/gpu/gl/GrGLContext.cpp',
         'skia/src/gpu/gl/GrGLExtensions.cpp',
         'skia/src/gpu/gl/GrGLGLSL.cpp',
         'skia/src/gpu/gl/GrGLGpu.cpp',
         'skia/src/gpu/gl/GrGLGpuCommandBuffer.cpp',
         'skia/src/gpu/gl/GrGLGpuProgramCache.cpp',
         'skia/src/gpu/gl/GrGLInterface.cpp',
         'skia/src/gpu/gl/GrGLPath.cpp',
-        'skia/src/gpu/gl/GrGLPathRange.cpp',
         'skia/src/gpu/gl/GrGLPathRendering.cpp',
         'skia/src/gpu/gl/GrGLProgram.cpp',
         'skia/src/gpu/gl/GrGLProgramDataManager.cpp',
         'skia/src/gpu/gl/GrGLRenderTarget.cpp',
         'skia/src/gpu/gl/GrGLSemaphore.cpp',
         'skia/src/gpu/gl/GrGLStencilAttachment.cpp',
         'skia/src/gpu/gl/GrGLTexture.cpp',
         'skia/src/gpu/gl/GrGLTextureRenderTarget.cpp',
@@ -569,72 +573,76 @@ if CONFIG['MOZ_ENABLE_SKIA_GPU']:
         'skia/src/gpu/glsl/GrGLSLPrimitiveProcessor.cpp',
         'skia/src/gpu/glsl/GrGLSLProgramBuilder.cpp',
         'skia/src/gpu/glsl/GrGLSLProgramDataManager.cpp',
         'skia/src/gpu/glsl/GrGLSLShaderBuilder.cpp',
         'skia/src/gpu/glsl/GrGLSLUtil.cpp',
         'skia/src/gpu/glsl/GrGLSLVarying.cpp',
         'skia/src/gpu/glsl/GrGLSLVertexGeoBuilder.cpp',
         'skia/src/gpu/glsl/GrGLSLXferProcessor.cpp',
+        'skia/src/gpu/gradients/GrClampedGradientEffect.cpp',
+        'skia/src/gpu/gradients/GrDualIntervalGradientColorizer.cpp',
+        'skia/src/gpu/gradients/GrGradientBitmapCache.cpp',
+        'skia/src/gpu/gradients/GrGradientShader.cpp',
+        'skia/src/gpu/gradients/GrLinearGradientLayout.cpp',
+        'skia/src/gpu/gradients/GrRadialGradientLayout.cpp',
+        'skia/src/gpu/gradients/GrSingleIntervalGradientColorizer.cpp',
+        'skia/src/gpu/gradients/GrSweepGradientLayout.cpp',
+        'skia/src/gpu/gradients/GrTextureGradientColorizer.cpp',
+        'skia/src/gpu/gradients/GrTiledGradientEffect.cpp',
+        'skia/src/gpu/gradients/GrTwoPointConicalGradientLayout.cpp',
+        'skia/src/gpu/gradients/GrUnrolledBinaryGradientColorizer.cpp',
         'skia/src/gpu/GrPathUtils.cpp',
         'skia/src/gpu/GrResourceCache.cpp',
         'skia/src/gpu/GrResourceProvider.cpp',
         'skia/src/gpu/ops/GrAAConvexPathRenderer.cpp',
         'skia/src/gpu/ops/GrAAConvexTessellator.cpp',
         'skia/src/gpu/ops/GrAAFillRectOp.cpp',
         'skia/src/gpu/ops/GrAAHairLinePathRenderer.cpp',
         'skia/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp',
         'skia/src/gpu/ops/GrAAStrokeRectOp.cpp',
-        'skia/src/gpu/ops/GrMSAAPathRenderer.cpp',
         'skia/src/gpu/ops/GrNonAAFillRectOp.cpp',
         'skia/src/gpu/ops/GrShadowRRectOp.cpp',
         'skia/src/image/SkImage_Gpu.cpp',
-        'skia/src/sksl/SkSLLayoutLexer.cpp',
+        'skia/src/sksl/SkSLHCodeGenerator.cpp',
         'skia/src/sksl/SkSLLexer.cpp',
     ]
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     UNIFIED_SOURCES += [
         'skia/src/ports/SkDebug_android.cpp',
         'skia/src/ports/SkOSFile_posix.cpp',
         'skia/src/ports/SkOSLibrary_posix.cpp',
         'skia/src/ports/SkTLS_pthread.cpp',
     ]
     SOURCES += [
-        'skia/src/jumper/SkJumper_generated.S',
         'skia/src/ports/SkFontHost_cairo.cpp',
         'skia/src/ports/SkFontHost_FreeType_common.cpp',
     ]
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
     UNIFIED_SOURCES += [
         'skia/src/ports/SkDebug_stdio.cpp',
         'skia/src/ports/SkOSFile_posix.cpp',
         'skia/src/ports/SkOSLibrary_posix.cpp',
         'skia/src/ports/SkTLS_pthread.cpp',
     ]
     SOURCES += [
-        'skia/src/jumper/SkJumper_generated.S',
         'skia/src/ports/SkFontHost_mac.cpp',
     ]
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
     UNIFIED_SOURCES += [
         'skia/src/ports/SkDebug_stdio.cpp',
         'skia/src/ports/SkOSFile_posix.cpp',
         'skia/src/ports/SkOSLibrary_posix.cpp',
         'skia/src/ports/SkTLS_pthread.cpp',
     ]
     SOURCES += [
-        'skia/src/jumper/SkJumper_generated.S',
         'skia/src/ports/SkFontHost_cairo.cpp',
         'skia/src/ports/SkFontHost_FreeType_common.cpp',
     ]
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
-    if CONFIG['CC_TYPE'] not in ('gcc', 'clang') and CONFIG['CPU_ARCH'] != 'aarch64':
-        SOURCES += [
-            'skia/src/jumper/SkJumper_generated_win.S',
-        ]
     SOURCES += [
         'skia/src/ports/SkDebug_win.cpp',
         'skia/src/ports/SkFontHost_win.cpp',
         'skia/src/ports/SkFontMgr_win_dw.cpp',
         'skia/src/ports/SkFontMgr_win_dw_factory.cpp',
         'skia/src/ports/SkOSFile_win.cpp',
         'skia/src/ports/SkOSLibrary_win.cpp',
         'skia/src/ports/SkScalerContext_win_dw.cpp',
@@ -711,72 +719,62 @@ else:
 AllowCompilerWarnings()
 
 FINAL_LIBRARY = 'gkmedias'
 LOCAL_INCLUDES += [
     'skia/include/c',
     'skia/include/codec',
     'skia/include/config',
     'skia/include/core',
+    'skia/include/docs',
     'skia/include/effects',
     'skia/include/encode',
     'skia/include/gpu',
     'skia/include/pathops',
     'skia/include/ports',
     'skia/include/private',
     'skia/include/utils',
     'skia/include/utils/mac',
-    'skia/include/views',
+    'skia/src/codec',
     'skia/src/core',
     'skia/src/gpu',
     'skia/src/gpu/effects',
     'skia/src/gpu/gl',
     'skia/src/gpu/glsl',
     'skia/src/image',
     'skia/src/lazy',
     'skia/src/opts',
     'skia/src/sfnt',
     'skia/src/shaders',
+    'skia/src/shaders/gradients',
     'skia/src/sksl',
     'skia/src/utils',
     'skia/src/utils/mac',
     'skia/src/utils/win',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
-    if CONFIG['CC_TYPE'] in ('gcc', 'clang'):
-        DEFINES['SK_JUMPER_USE_ASSEMBLY'] = 0
-    elif CONFIG['CPU_ARCH'] == 'x86':
-        SOURCES['skia/src/jumper/SkJumper_generated_win.S'].flags += ['-safeseh']
     DEFINES['UNICODE'] = True
     DEFINES['_UNICODE'] = True
     UNIFIED_SOURCES += [
         'skia/src/fonts/SkFontMgr_indirect.cpp',
         'skia/src/fonts/SkRemotableFontMgr.cpp',
     ]
 
-# Work around a crash when jumping into assembly on platforms where
-# Clang has 4-byte stack alignment.
-if CONFIG['CPU_ARCH'] == 'x86' and CONFIG['CC_TYPE'] == 'clang':
-    SOURCES['skia/src/jumper/SkJumper.cpp'].flags += [
-        '-mstack-alignment=16',
-        '-mstackrealign'
-    ]
-
 # We should autogenerate these SSE related flags.
 
 if CONFIG['INTEL_ARCHITECTURE'] and (CONFIG['CC_TYPE'] in ('clang', 'clang-cl', 'gcc')):
     SOURCES['skia/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
     SOURCES['skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-mssse3']
     SOURCES['skia/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
     SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-mssse3']
     SOURCES['skia/src/opts/SkOpts_sse41.cpp'].flags += ['-msse4.1']
     SOURCES['skia/src/opts/SkOpts_sse42.cpp'].flags += ['-msse4.2']
     SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-mavx']
-    SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-mavx2']
+    SOURCES['skia/src/opts/SkOpts_hsw.cpp'].flags += ['-mavx2', '-mf16c', '-mfma']
 elif CONFIG['CC_TYPE'] in ('msvc', 'clang-cl') and CONFIG['INTEL_ARCHITECTURE']:
     # MSVC doesn't need special compiler flags, but Skia needs to be told that these files should
     # be built with the required SSE level or it will simply compile in stubs and cause runtime crashes
     SOURCES['skia/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=20']
     SOURCES['skia/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=31']
     SOURCES['skia/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=20']
     SOURCES['skia/src/opts/SkOpts_ssse3.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=31']
     SOURCES['skia/src/opts/SkOpts_sse41.cpp'].flags += ['-DSK_CPU_SSE_LEVEL=41']
--- a/gfx/skia/skia/include/android/SkAnimatedImage.h
+++ b/gfx/skia/skia/include/android/SkAnimatedImage.h
@@ -102,32 +102,46 @@ protected:
     void onDraw(SkCanvas*) override;
 
 private:
     struct Frame {
         SkBitmap fBitmap;
         int      fIndex;
         SkCodecAnimation::DisposalMethod fDisposalMethod;
 
+        // init() may have to create a new SkPixelRef, if the
+        // current one is already in use by another owner (e.g.
+        // an SkPicture). This determines whether to copy the
+        // existing one to the new one.
+        enum class OnInit {
+            // Restore the image from the old SkPixelRef to the
+            // new one.
+            kRestoreIfNecessary,
+            // No need to restore.
+            kNoRestore,
+        };
+
         Frame();
+        bool init(const SkImageInfo& info, OnInit);
         bool copyTo(Frame*) const;
     };
 
     std::unique_ptr<SkAndroidCodec> fCodec;
     const SkISize                   fScaledSize;
     const SkImageInfo               fDecodeInfo;
     const SkIRect                   fCropRect;
     const sk_sp<SkPicture>          fPostProcess;
     const int                       fFrameCount;
     const bool                      fSimple;     // no crop, scale, or postprocess
     SkMatrix                        fMatrix;     // used only if !fSimple
 
     bool                            fFinished;
     int                             fCurrentFrameDuration;
-    Frame                           fActiveFrame;
+    Frame                           fDisplayFrame;
+    Frame                           fDecodingFrame;
     Frame                           fRestoreFrame;
     int                             fRepetitionCount;
     int                             fRepetitionsCompleted;
 
     SkAnimatedImage(std::unique_ptr<SkAndroidCodec>, SkISize scaledSize,
             SkImageInfo decodeInfo, SkIRect cropRect, sk_sp<SkPicture> postProcess);
     SkAnimatedImage(std::unique_ptr<SkAndroidCodec>);
 
--- a/gfx/skia/skia/include/atlastext/SkAtlasTextRenderer.h
+++ b/gfx/skia/skia/include/atlastext/SkAtlasTextRenderer.h
@@ -25,17 +25,18 @@ public:
     };
 
     struct SDFVertex {
         /** Position in device space (not normalized). The third component is w (not z). */
         SkPoint3 fPosition;
         /** Color, same value for all four corners of a glyph quad. */
         uint32_t fColor;
         /** Texture coordinate (in texel units, not normalized). */
-        SkIPoint16 fTextureCoord;
+        int16_t fTextureCoordX;
+        int16_t fTextureCoordY;
     };
 
     virtual ~SkAtlasTextRenderer() = default;
 
     /**
      * Create a texture of the provided format with dimensions 'width' x 'height'
      * and return a unique handle.
      */
--- a/gfx/skia/skia/include/atlastext/SkAtlasTextTarget.h
+++ b/gfx/skia/skia/include/atlastext/SkAtlasTextTarget.h
@@ -3,36 +3,39 @@
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 #ifndef SkAtlasTextTarget_DEFINED
 #define SkAtlasTextTarget_DEFINED
 
-#include <memory>
 #include "SkDeque.h"
 #include "SkRefCnt.h"
 #include "SkScalar.h"
 
+#include <memory>
+
 class SkAtlasTextContext;
 class SkAtlasTextFont;
 class SkMatrix;
 struct SkPoint;
 
 /** Represents a client-created renderable surface and is used to draw text into the surface. */
 class SK_API SkAtlasTextTarget {
 public:
     virtual ~SkAtlasTextTarget();
 
     /**
      * Creates a text drawing target. ‘handle’ is used to identify this rendering surface when
      * draws are flushed to the SkAtlasTextContext's SkAtlasTextRenderer.
      */
-    static std::unique_ptr<SkAtlasTextTarget> Make(sk_sp<SkAtlasTextContext>, int width, int height,
+    static std::unique_ptr<SkAtlasTextTarget> Make(sk_sp<SkAtlasTextContext>,
+                                                   int width,
+                                                   int height,
                                                    void* handle);
 
     /**
      * Enqueues a text draw in the target. The caller provides an array of glyphs and their
      * positions. The meaning of 'color' here is interpreted by the client's SkAtlasTextRenderer
      * when it actually renders the text.
      */
     virtual void drawText(const SkGlyphID[], const SkPoint[], int glyphCnt, uint32_t color,
new file mode 100644
--- /dev/null
+++ b/gfx/skia/skia/include/c/sk_colorspace.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_imageinfo_DEFINED
+#define sk_imageinfo_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+sk_colorspace_t* sk_colorspace_new_srgb();
+
+void sk_colorspace_ref(sk_colorspace_t*);
+void sk_colorspace_unref(sk_colorspace_t*);
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
new file mode 100644
--- /dev/null
+++ b/gfx/skia/skia/include/c/sk_imageinfo.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_imageinfo_DEFINED
+#define sk_imageinfo_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+typedef enum {
+    UNKNOWN_SK_COLORTYPE,
+    RGBA_8888_SK_COLORTYPE,
+    BGRA_8888_SK_COLORTYPE,
+    ALPHA_8_SK_COLORTYPE,
+    GRAY_8_SK_COLORTYPE,
+    RGBA_F16_SK_COLORTYPE,
+    RGBA_F32_SK_COLORTYPE,
+} sk_colortype_t;
+
+typedef enum {
+    OPAQUE_SK_ALPHATYPE,
+    PREMUL_SK_ALPHATYPE,
+    UNPREMUL_SK_ALPHATYPE,
+} sk_alphatype_t;
+
+/**
+ *  Allocate a new imageinfo object. If colorspace is not null, it's owner-count will be
+ *  incremented automatically.
+ */
+sk_imageinfo_t* sk_imageinfo_new(int width, int height, sk_colortype_t ct, sk_alphatype_t at,
+                                 sk_colorspace_t* cs);
+
+/**
+ *  Free the imageinfo object. If it contains a reference to a colorspace, its owner-count will
+ *  be decremented automatically.
+ */
+void sk_imageinfo_delete(sk_imageinfo_t*);
+
+int32_t          sk_imageinfo_get_width(sk_imageinfo_t*);
+int32_t          sk_imageinfo_get_height(sk_imageinfo_t*);
+sk_colortype_t   sk_imageinfo_get_colortype(sk_imageinfo_t*);
+sk_alphatype_t   sk_imageinfo_get_alphatype(sk_imageinfo_t*);
+
+/**
+ *  Return the colorspace object reference contained in the imageinfo, or null if there is none.
+ *  Note: this does not modify the owner-count on the colorspace object. If the caller needs to
+ *  use the colorspace beyond the lifetime of the imageinfo, it should manually call
+ *  sk_colorspace_ref() (and then call unref() when it is done).
+ */
+sk_colorspace_t* sk_imageinfo_get_colorspace(sk_imageinfo_t*);
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
--- a/gfx/skia/skia/include/c/sk_types.h
+++ b/gfx/skia/skia/include/c/sk_types.h
@@ -48,53 +48,28 @@ typedef uint32_t sk_color_t;
 /* This macro assumes all arguments are >=0 and <=255. */
 #define sk_color_set_argb(a, r, g, b)   (((a) << 24) | ((r) << 16) | ((g) << 8) | (b))
 #define sk_color_get_a(c)               (((c) >> 24) & 0xFF)
 #define sk_color_get_r(c)               (((c) >> 16) & 0xFF)
 #define sk_color_get_g(c)               (((c) >>  8) & 0xFF)
 #define sk_color_get_b(c)               (((c) >>  0) & 0xFF)
 
 typedef enum {
-    UNKNOWN_SK_COLORTYPE,
-    RGBA_8888_SK_COLORTYPE,
-    BGRA_8888_SK_COLORTYPE,
-    ALPHA_8_SK_COLORTYPE,
-} sk_colortype_t;
-
-typedef enum {
-    OPAQUE_SK_ALPHATYPE,
-    PREMUL_SK_ALPHATYPE,
-    UNPREMUL_SK_ALPHATYPE,
-} sk_alphatype_t;
-
-typedef enum {
     INTERSECT_SK_CLIPTYPE,
     DIFFERENCE_SK_CLIPTYPE,
 } sk_cliptype_t;
 
 typedef enum {
     UNKNOWN_SK_PIXELGEOMETRY,
     RGB_H_SK_PIXELGEOMETRY,
     BGR_H_SK_PIXELGEOMETRY,
     RGB_V_SK_PIXELGEOMETRY,
     BGR_V_SK_PIXELGEOMETRY,
 } sk_pixelgeometry_t;
 
-/**
-    Return the default sk_colortype_t; this is operating-system dependent.
-*/
-SK_API sk_colortype_t sk_colortype_get_default_8888(void);
-
-typedef struct {
-    int32_t         width;
-    int32_t         height;
-    sk_colortype_t  colorType;
-    sk_alphatype_t  alphaType;
-} sk_imageinfo_t;
-
 typedef struct {
     sk_pixelgeometry_t pixelGeometry;
 } sk_surfaceprops_t;
 
 typedef struct {
     float   x;
     float   y;
 } sk_point_t;
@@ -182,16 +157,27 @@ typedef struct sk_canvas_t sk_canvas_t;
 typedef struct sk_data_t sk_data_t;
 /**
     A sk_image_t is an abstraction for drawing a rectagle of pixels.
     The content of the image is always immutable, though the actual
     storage may change, if for example that image can be re-created via
     encoded data or other means.
 */
 typedef struct sk_image_t sk_image_t;
+
+/**
+ *  Describes the color components. See ICC Profiles.
+ */
+typedef struct sk_colorspace_t sk_colorspace_t;
+
+/**
+ *  Describes an image buffer : width, height, pixel type, colorspace, etc.
+ */
+typedef struct sk_imageinfo_t sk_imageinfo_t;
+
 /**
     A sk_maskfilter_t is an object that perform transformations on an
     alpha-channel mask before drawing it; it may be installed into a
     sk_paint_t.  Each time a primitive is drawn, it is first
     scan-converted into a alpha mask, which os handed to the
     maskfilter, which may create a new mask is to render into the
     destination.
  */
--- a/gfx/skia/skia/include/codec/SkCodec.h
+++ b/gfx/skia/skia/include/codec/SkCodec.h
@@ -3,21 +3,21 @@
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 #ifndef SkCodec_DEFINED
 #define SkCodec_DEFINED
 
+#include "../private/SkNoncopyable.h"
 #include "../private/SkTemplates.h"
 #include "../private/SkEncodedInfo.h"
 #include "SkCodecAnimation.h"
 #include "SkColor.h"
-#include "SkColorSpaceXform.h"
 #include "SkEncodedImageFormat.h"
 #include "SkEncodedOrigin.h"
 #include "SkImageInfo.h"
 #include "SkPixmap.h"
 #include "SkSize.h"
 #include "SkStream.h"
 #include "SkTypes.h"
 #include "SkYUVSizeInfo.h"
@@ -29,17 +29,16 @@ class SkData;
 class SkFrameHolder;
 class SkPngChunkReader;
 class SkSampler;
 
 namespace DM {
 class CodecSrc;
 class ColorCodecSrc;
 }
-class ColorCodecBench;
 
 /**
  *  Abstraction layer directly on top of an image codec.
  */
 class SK_API SkCodec : SkNoncopyable {
 public:
     /**
      *  Minimum number of bytes that must be buffered in SkStream input.
@@ -165,19 +164,24 @@ public:
      *      If the PNG does not contain unknown chunks, the SkPngChunkReader
      *      will not be used or modified.
      */
     static std::unique_ptr<SkCodec> MakeFromData(sk_sp<SkData>, SkPngChunkReader* = nullptr);
 
     virtual ~SkCodec();
 
     /**
-     *  Return the ImageInfo associated with this codec.
+     *  Return a reasonable SkImageInfo to decode into.
      */
-    const SkImageInfo& getInfo() const { return fSrcInfo; }
+    SkImageInfo getInfo() const { return fEncodedInfo.makeImageInfo(); }
+
+    SkISize dimensions() const { return {fEncodedInfo.width(), fEncodedInfo.height()}; }
+    SkIRect bounds() const {
+        return SkIRect::MakeWH(fEncodedInfo.width(), fEncodedInfo.height());
+    }
 
     /**
      *  Returns the image orientation stored in the EXIF data.
      *  If there is no EXIF data, or if we cannot read the EXIF data, returns kTopLeft.
      */
     SkEncodedOrigin getOrigin() const { return fOrigin; }
 
     /**
@@ -192,17 +196,17 @@ public:
         SkASSERT(desiredScale > 0.0f);
         if (desiredScale <= 0.0f) {
             return SkISize::Make(0, 0);
         }
 
         // Upscaling is not supported. Return the original size if the client
         // requests an upscale.
         if (desiredScale >= 1.0f) {
-            return this->getInfo().dimensions();
+            return this->dimensions();
         }
         return this->onGetScaledDimensions(desiredScale);
     }
 
     /**
      *  Return (via desiredSubset) a subset which can decoded from this codec,
      *  or false if this codec cannot decode subsets or anything similar to
      *  desiredSubset.
@@ -247,18 +251,17 @@ public:
     /**
      *  Additional options to pass to getPixels.
      */
     struct Options {
         Options()
             : fZeroInitialized(kNo_ZeroInitialized)
             , fSubset(nullptr)
             , fFrameIndex(0)
-            , fPriorFrame(kNone)
-            , fPremulBehavior(SkTransferFunctionBehavior::kRespect)
+            , fPriorFrame(kNoFrame)
         {}
 
         ZeroInitialized            fZeroInitialized;
         /**
          *  If not NULL, represents a subset of the original image to decode.
          *  Must be within the bounds returned by getInfo().
          *  If the EncodedFormat is SkEncodedImageFormat::kWEBP (the only one which
          *  currently supports subsets), the top and left values must be even.
@@ -279,37 +282,29 @@ public:
         /**
          *  The frame to decode.
          *
          *  Only meaningful for multi-frame images.
          */
         int                        fFrameIndex;
 
         /**
-         *  If not kNone, the dst already contains the prior frame at this index.
+         *  If not kNoFrame, the dst already contains the prior frame at this index.
          *
          *  Only meaningful for multi-frame images.
          *
          *  If fFrameIndex needs to be blended with a prior frame (as reported by
          *  getFrameInfo[fFrameIndex].fRequiredFrame), the client can set this to
          *  any non-kRestorePrevious frame in [fRequiredFrame, fFrameIndex) to
          *  indicate that that frame is already in the dst. Options.fZeroInitialized
          *  is ignored in this case.
          *
-         *  If set to kNone, the codec will decode any necessary required frame(s) first.
+         *  If set to kNoFrame, the codec will decode any necessary required frame(s) first.
          */
         int                        fPriorFrame;
-
-        /**
-         *  Indicates whether we should do a linear premultiply or a legacy premultiply.
-         *
-         *  In the case where the dst SkColorSpace is nullptr, this flag is ignored and
-         *  we will always do a legacy premultiply.
-         */
-        SkTransferFunctionBehavior fPremulBehavior;
     };
 
     /**
      *  Decode into the given pixels, a block of memory of size at
      *  least (info.fHeight - 1) * rowBytes + (info.fWidth *
      *  bytesPerPixel)
      *
      *  Repeated calls to this function should give the same results,
@@ -575,27 +570,35 @@ public:
      *  Return the number of frames in the image.
      *
      *  May require reading through the stream.
      */
     int getFrameCount() {
         return this->onGetFrameCount();
     }
 
-    // The required frame for an independent frame is marked as
-    // kNone.
-    static constexpr int kNone = -1;
+    // Sentinel value used when a frame index implies "no frame":
+    // - FrameInfo::fRequiredFrame set to this value means the frame
+    //   is independent.
+    // - Options::fPriorFrame set to this value means no (relevant) prior frame
+    //   is residing in dst's memory.
+    static constexpr int kNoFrame = -1;
+
+    // This transitional definition was added in August 2018, and will eventually be removed.
+#ifdef SK_LEGACY_SKCODEC_NONE_ENUM
+    static constexpr int kNone = kNoFrame;
+#endif
 
     /**
      *  Information about individual frames in a multi-framed image.
      */
     struct FrameInfo {
         /**
          *  The frame that this frame needs to be blended with, or
-         *  kNone if this frame is independent.
+         *  kNoFrame if this frame is independent.
          *
          *  Note that this is the *earliest* frame that can be used
          *  for blending. Any frame from [fRequiredFrame, i) can be
          *  used, unless its fDisposalMethod is kRestorePrevious.
          */
         int fRequiredFrame;
 
         /**
@@ -640,60 +643,53 @@ public:
     /**
      *  Return info about all the frames in the image.
      *
      *  May require reading through the stream to determine info about the
      *  frames (including the count).
      *
      *  As such, future decoding calls may require a rewind.
      *
-     *  For single-frame images, this will return an empty vector.
+     *  For still (non-animated) image codecs, this will return an empty vector.
      */
     std::vector<FrameInfo> getFrameInfo();
 
     static constexpr int kRepetitionCountInfinite = -1;
 
     /**
-     *  Return the number of times to repeat, if this image is animated.
+     *  Return the number of times to repeat, if this image is animated. This number does not
+     *  include the first play through of each frame. For example, a repetition count of 4 means
+     *  that each frame is played 5 times and then the animation stops.
+     *
+     *  It can return kRepetitionCountInfinite, a negative number, meaning that the animation
+     *  should loop forever.
      *
      *  May require reading the stream to find the repetition count.
      *
      *  As such, future decoding calls may require a rewind.
      *
-     *  For single-frame images, this will return 0.
+     *  For still (non-animated) image codecs, this will return 0.
      */
     int getRepetitionCount() {
         return this->onGetRepetitionCount();
     }
 
 protected:
     const SkEncodedInfo& getEncodedInfo() const { return fEncodedInfo; }
 
-    using XformFormat = SkColorSpaceXform::ColorFormat;
+    using XformFormat = skcms_PixelFormat;
 
-    SkCodec(int width,
-            int height,
-            const SkEncodedInfo&,
-            XformFormat srcFormat,
-            std::unique_ptr<SkStream>,
-            sk_sp<SkColorSpace>,
-            SkEncodedOrigin = kTopLeft_SkEncodedOrigin);
-
-    /**
-     *  Allows the subclass to set the recommended SkImageInfo
-     */
-    SkCodec(const SkEncodedInfo&,
-            const SkImageInfo&,
+    SkCodec(SkEncodedInfo&&,
             XformFormat srcFormat,
             std::unique_ptr<SkStream>,
             SkEncodedOrigin = kTopLeft_SkEncodedOrigin);
 
     virtual SkISize onGetScaledDimensions(float /*desiredScale*/) const {
         // By default, scaling is not supported.
-        return this->getInfo().dimensions();
+        return this->dimensions();
     }
 
     // FIXME: What to do about subsets??
     /**
      *  Subclasses should override if they support dimensions other than the
      *  srcInfo's.
      */
     virtual bool onDimensionsSupported(const SkISize&) {
@@ -727,59 +723,31 @@ protected:
 
     /**
      *  If the stream was previously read, attempt to rewind.
      *
      *  If the stream needed to be rewound, call onRewind.
      *  @returns true if the codec is at the right position and can be used.
      *      false if there was a failure to rewind.
      *
-     *  This is called by getPixels() and start(). Subclasses may call if they
-     *  need to rewind at another time.
+     *  This is called by getPixels(), getYUV8Planes(), startIncrementalDecode() and
+     *  startScanlineDecode(). Subclasses may call if they need to rewind at another time.
      */
     bool SK_WARN_UNUSED_RESULT rewindIfNeeded();
 
     /**
      *  Called by rewindIfNeeded, if the stream needed to be rewound.
      *
      *  Subclasses should do any set up needed after a rewind.
      */
     virtual bool onRewind() {
         return true;
     }
 
     /**
-     * On an incomplete input, getPixels() and getScanlines() will fill any uninitialized
-     * scanlines.  This allows the subclass to indicate what value to fill with.
-     *
-     * @param dstInfo   Describes the destination.
-     * @return          The value with which to fill uninitialized pixels.
-     *
-     * Note that we can interpret the return value as a 64-bit Float16 color, a SkPMColor,
-     * a 16-bit 565 color, an 8-bit gray color, or an 8-bit index into a color table,
-     * depending on the color type.
-     */
-    uint64_t getFillValue(const SkImageInfo& dstInfo) const {
-        return this->onGetFillValue(dstInfo);
-    }
-
-    /**
-     * Some subclasses will override this function, but this is a useful default for the color
-     * types that we support.  Note that for color types that do not use the full 64-bits,
-     * we will simply take the low bits of the fill value.
-     *
-     * The defaults are:
-     * kRGBA_F16_SkColorType: Transparent or Black, depending on the src alpha type
-     * kN32_SkColorType: Transparent or Black, depending on the src alpha type
-     * kRGB_565_SkColorType: Black
-     * kGray_8_SkColorType: Black
-     */
-    virtual uint64_t onGetFillValue(const SkImageInfo& dstInfo) const;
-
-    /**
      * Get method for the input stream
      */
     SkStream* stream() {
         return fStream.get();
     }
 
     /**
      *  The remaining functions revolve around decoding scanlines.
@@ -799,77 +767,83 @@ protected:
      *  This is unaffected by the SkScanlineOrder.
      *
      *  Returns -1 if we have not started a scanline decode.
      */
     int currScanline() const { return fCurrScanline; }
 
     virtual int onOutputScanline(int inputScanline) const;
 
-    bool initializeColorXform(const SkImageInfo& dstInfo, SkEncodedInfo::Alpha,
-                              SkTransferFunctionBehavior premulBehavior);
     // Some classes never need a colorXform e.g.
     // - ICO uses its embedded codec's colorXform
     // - WBMP is just Black/White
     virtual bool usesColorXform() const { return true; }
-    void applyColorXform(void* dst, const void* src, int count, SkAlphaType) const;
     void applyColorXform(void* dst, const void* src, int count) const;
 
-    SkColorSpaceXform* colorXform() const { return fColorXform.get(); }
-    bool xformOnDecode() const { return fXformOnDecode; }
+    bool colorXform() const { return fXformTime != kNo_XformTime; }
+    bool xformOnDecode() const { return fXformTime == kDecodeRow_XformTime; }
 
     virtual int onGetFrameCount() {
         return 1;
     }
 
     virtual bool onGetFrameInfo(int, FrameInfo*) const {
         return false;
     }
 
     virtual int onGetRepetitionCount() {
         return 0;
     }
 
 private:
     const SkEncodedInfo                fEncodedInfo;
-    const SkImageInfo                  fSrcInfo;
     const XformFormat                  fSrcXformFormat;
     std::unique_ptr<SkStream>          fStream;
     bool                               fNeedsRewind;
     const SkEncodedOrigin              fOrigin;
 
     SkImageInfo                        fDstInfo;
     Options                            fOptions;
+
+    enum XformTime {
+        kNo_XformTime,
+        kPalette_XformTime,
+        kDecodeRow_XformTime,
+    };
+    XformTime                          fXformTime;
     XformFormat                        fDstXformFormat; // Based on fDstInfo.
-    std::unique_ptr<SkColorSpaceXform> fColorXform;
-    bool                               fXformOnDecode;
+    skcms_ICCProfile                   fDstProfile;
+    skcms_AlphaFormat                  fDstXformAlphaFormat;
 
     // Only meaningful during scanline decodes.
     int                                fCurrScanline;
 
     bool                               fStartedIncrementalDecode;
 
     /**
-     *  Return whether {srcColor, srcIsOpaque, srcCS} can convert to dst.
+     *  Return whether we can convert to dst.
      *
      *  Will be called for the appropriate frame, prior to initializing the colorXform.
      */
-    virtual bool conversionSupported(const SkImageInfo& dst, SkColorType srcColor,
-                                     bool srcIsOpaque, const SkColorSpace* srcCS) const;
+    virtual bool conversionSupported(const SkImageInfo& dst, bool srcIsOpaque,
+                                     bool needsColorXform);
+
+    bool initializeColorXform(const SkImageInfo& dstInfo, SkEncodedInfo::Alpha, bool srcIsOpaque);
+
     /**
      *  Return whether these dimensions are supported as a scale.
      *
      *  The codec may choose to cache the information about scale and subset.
      *  Either way, the same information will be passed to onGetPixels/onStart
      *  on success.
      *
      *  This must return true for a size returned from getScaledDimensions.
      */
     bool dimensionsSupported(const SkISize& dim) {
-        return dim == fSrcInfo.dimensions() || this->onDimensionsSupported(dim);
+        return dim == this->dimensions() || this->onDimensionsSupported(dim);
     }
 
     /**
      *  For multi-framed images, return the object with information about the frames.
      */
     virtual const SkFrameHolder* getFrameHolder() const {
         return nullptr;
     }
--- a/gfx/skia/skia/include/config/SkUserConfig.h
+++ b/gfx/skia/skia/include/config/SkUserConfig.h
@@ -95,24 +95,16 @@
 
 /*  Define this to set the upper limit for text to support LCD. Values that
     are very large increase the cost in the font cache and draw slower, without
     improving readability. If this is undefined, Skia will use its default
     value (e.g. 48)
  */
 //#define SK_MAX_SIZE_FOR_LCDTEXT     48
 
-/*  If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST
-    which will run additional self-tests at startup. These can take a long time,
-    so this flag is optional.
- */
-#ifdef SK_DEBUG
-//#define SK_SUPPORT_UNITTEST
-#endif
-
 /*  Change the ordering to work in X windows.
  */
 //#ifdef SK_SAMPLES_FOR_X
 //        #define SK_R32_SHIFT    16
 //        #define SK_G32_SHIFT    8
 //        #define SK_B32_SHIFT    0
 //        #define SK_A32_SHIFT    24
 //#endif
@@ -147,18 +139,16 @@
 #define GR_GL_FUNCTION_TYPE
 
 #define SK_RASTERIZE_EVEN_ROUNDING
 
 #define SK_DISABLE_SLOW_DEBUG_VALIDATION 1
 
 #define SK_SUPPORT_DEPRECATED_CLIPOPS
 
-#define SK_DISABLE_EXPLICIT_GPU_RESOURCE_ALLOCATION
-
 #ifndef MOZ_IMPLICIT
 #  ifdef MOZ_CLANG_PLUGIN
 #    define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
 #  else
 #    define MOZ_IMPLICIT
 #  endif
 #endif
 
--- a/gfx/skia/skia/include/core/SkBitmap.h
+++ b/gfx/skia/skia/include/core/SkBitmap.h
@@ -1,15 +1,25 @@
 /*
  * 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.
  */
 
+/* Generated by tools/bookmaker from include/core/SkBitmap.h and docs/SkBitmap_Reference.bmh
+   on 2018-09-13 13:59:55. Additional documentation and examples can be found at:
+   https://skia.org/user/api/SkBitmap_Reference
+
+   You may edit either file directly. Structural changes to public interfaces require
+   editing both files. After editing docs/SkBitmap_Reference.bmh, run:
+       bookmaker -b docs -i include/core/SkBitmap.h -p
+   to create an updated version of this file.
+ */
+
 #ifndef SkBitmap_DEFINED
 #define SkBitmap_DEFINED
 
 #include "SkColor.h"
 #include "SkImageInfo.h"
 #include "SkPixmap.h"
 #include "SkPoint.h"
 #include "SkRefCnt.h"
@@ -24,18 +34,18 @@ class SkString;
 /** \class SkBitmap
     SkBitmap describes a two-dimensional raster pixel array. SkBitmap is built on
     SkImageInfo, containing integer width and height, SkColorType and SkAlphaType
     describing the pixel format, and SkColorSpace describing the range of colors.
     SkBitmap points to SkPixelRef, which describes the physical array of pixels.
     SkImageInfo bounds may be located anywhere fully inside SkPixelRef bounds.
 
     SkBitmap can be drawn using SkCanvas. SkBitmap can be a drawing destination for SkCanvas
-    draw methods. SkBitmap flexibility as a pixel container limits some optimizations
-    available to the target platform.
+    draw member functions. SkBitmap flexibility as a pixel container limits some
+    optimizations available to the target platform.
 
     If pixel array is primarily read-only, use SkImage for better performance.
     If pixel array is primarily written to, use SkSurface for better performance.
 
     Declaring SkBitmap const prevents altering SkImageInfo: the SkBitmap height, width,
     and so on cannot change. It does not affect SkPixelRef: a caller may write its
     pixels. Declaring SkBitmap const affects SkBitmap configuration, not its contents.
 
@@ -107,59 +117,62 @@ public:
     const SkPixmap& pixmap() const { return fPixmap; }
 
     /** Returns width, height, SkAlphaType, SkColorType, and SkColorSpace.
 
         @return  reference to SkImageInfo
     */
     const SkImageInfo& info() const { return fPixmap.info(); }
 
-    /** Returns pixel count in each row. Should be equal or less than:
+    /** Returns pixel count in each row. Should be equal or less than
         rowBytes() / info().bytesPerPixel().
 
-        Maybe be less than pixelRef().width(). Will not exceed pixelRef().width() less
+        May be less than pixelRef().width(). Will not exceed pixelRef().width() less
         pixelRefOrigin().fX.
 
         @return  pixel width in SkImageInfo
     */
     int width() const { return fPixmap.width(); }
 
     /** Returns pixel row count.
 
         Maybe be less than pixelRef().height(). Will not exceed pixelRef().height() less
         pixelRefOrigin().fY.
 
         @return  pixel height in SkImageInfo
     */
     int height() const { return fPixmap.height(); }
 
-    /** Returns SkColorType, one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
-        kRGB_565_SkColorType, kARGB_4444_SkColorType, kRGBA_8888_SkColorType,
-        kBGRA_8888_SkColorType, kGray_8_SkColorType, kRGBA_F16_SkColorType.
+    /** Returns SkColorType, one of:
+        kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,
+        kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,
+        kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,
+        kGray_8_SkColorType, kRGBA_F16_SkColorType.
 
         @return  SkColorType in SkImageInfo
     */
     SkColorType colorType() const { return fPixmap.colorType(); }
 
-    /** Returns SkAlphaType, one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
-        kPremul_SkAlphaType, kUnpremul_SkAlphaType.
+    /** Returns SkAlphaType, one of:
+        kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
+        kUnpremul_SkAlphaType.
 
         @return  SkAlphaType in SkImageInfo
     */
     SkAlphaType alphaType() const { return fPixmap.alphaType(); }
 
     /** Returns SkColorSpace, the range of colors, associated with SkImageInfo. The
         reference count of SkColorSpace is unchanged. The returned SkColorSpace is
         immutable.
 
         @return  SkColorSpace in SkImageInfo, or nullptr
     */
     SkColorSpace* colorSpace() const { return fPixmap.colorSpace(); }
 
-    /** Returns a smart pointer to SkColorSpace, the range of colors, associated with
+    /** Returns smart pointer to SkColorSpace, the range of colors, associated with
         SkImageInfo. The smart pointer tracks the number of objects sharing this
         SkColorSpace reference so the memory is released when the owners destruct.
 
         The returned SkColorSpace is immutable.
 
         @return  SkColorSpace in SkImageInfo wrapped in a smart pointer
     */
     sk_sp<SkColorSpace> refColorSpace() const { return fPixmap.info().refColorSpace(); }
@@ -189,36 +202,36 @@ public:
 
         Does not check if SkPixelRef is nullptr; call drawsNothing() to check width(),
         height(), and SkPixelRef.
 
         @return  true if dimensions do not enclose area
     */
     bool empty() const { return fPixmap.info().isEmpty(); }
 
-    /** Return true if SkPixelRef is nullptr.
+    /** Returns true if SkPixelRef is nullptr.
 
         Does not check if width() or height() are zero; call drawsNothing() to check
         width(), height(), and SkPixelRef.
 
         @return  true if no SkPixelRef is associated
     */
     bool isNull() const { return nullptr == fPixelRef; }
 
-    /** Return true if width() or height() are zero, or if SkPixelRef is nullptr.
+    /** Returns true if width() or height() are zero, or if SkPixelRef is nullptr.
         If true, SkBitmap has no effect when drawn or drawn into.
 
         @return  true if drawing has no effect
     */
     bool drawsNothing() const {
         return this->empty() || this->isNull();
     }
 
     /** Returns row bytes, the interval from one pixel row to the next. Row bytes
-        is at least as large as width() * info().bytesPerPixel().
+        is at least as large as: width() * info().bytesPerPixel().
 
         Returns zero if colorType() is kUnknown_SkColorType, or if row bytes supplied to
         setInfo() is not large enough to hold a row of pixels.
 
         @return  byte length of pixel row
     */
     size_t rowBytes() const { return fPixmap.rowBytes(); }
 
@@ -240,18 +253,19 @@ public:
         If SkColorType is kAlpha_8_SkColorType, returns true unless
         alphaType is kUnknown_SkAlphaType and SkAlphaType is not kUnknown_SkAlphaType.
         If SkAlphaType is kUnknown_SkAlphaType, alphaType is ignored. If alphaType is
         kUnpremul_SkAlphaType, it is treated as kPremul_SkAlphaType.
 
         This changes SkAlphaType in SkPixelRef; all bitmaps sharing SkPixelRef
         are affected.
 
-        @param alphaType  one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
-                          kPremul_SkAlphaType, kUnpremul_SkAlphaType
+        @param alphaType  one of:
+                          kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
+                          kUnpremul_SkAlphaType
         @return           true if SkAlphaType is set
     */
     bool setAlphaType(SkAlphaType alphaType);
 
     /** Returns pixel address, the base address corresponding to the pixel origin.
 
         @return  pixel address
     */
@@ -278,28 +292,31 @@ public:
     /** Sets internal flag to mark SkBitmap as immutable. Once set, pixels can not change.
         Any other bitmap sharing the same SkPixelRef are also marked as immutable.
         Once SkPixelRef is marked immutable, the setting cannot be cleared.
 
         Writing to immutable SkBitmap pixels triggers an assert on debug builds.
     */
     void setImmutable();
 
-    /** Returns true if SkAlphaType is kOpaque_SkAlphaType.
+    /** Returns true if SkAlphaType is set to hint that all pixels are opaque; their
+        alpha value is implicitly or explicitly 1.0. If true, and all pixels are
+        not opaque, Skia may draw incorrectly.
+
         Does not check if SkColorType allows alpha, or if any pixel value has
         transparency.
 
-        @return  true if SkImageInfo describes opaque alpha
+        @return  true if SkImageInfo SkAlphaType is kOpaque_SkAlphaType
     */
     bool isOpaque() const {
         return SkAlphaTypeIsOpaque(this->alphaType());
     }
 
-    /** If true, provides a hint to caller that pixels should not
-        be cached. Only true if setIsVolatile() has been called to mark as volatile.
+    /** Provides a hint to caller that pixels should not be cached. Only true if
+        setIsVolatile() has been called to mark as volatile.
 
         Volatile state is not shared by other bitmaps sharing the same SkPixelRef.
 
         @return  true if marked volatile
     */
     bool isVolatile() const;
 
     /** Sets if pixels should be read from SkPixelRef on every access. SkBitmap are not
@@ -407,34 +424,33 @@ public:
         @return           true if SkImageInfo set successfully
     */
     bool setInfo(const SkImageInfo& imageInfo, size_t rowBytes = 0);
 
     /** \enum SkBitmap::AllocFlags
         AllocFlags provides the option to zero pixel memory when allocated.
     */
     enum AllocFlags {
-        /** Instructs tryAllocPixelsFlags() and allocPixelsFlags() to zero pixel memory. */
-        kZeroPixels_AllocFlag = 1 << 0,
+        kZeroPixels_AllocFlag = 1 << 0, //!< zero pixel memory
     };
 
     /** Sets SkImageInfo to info following the rules in setInfo() and allocates pixel
         memory. If flags is kZeroPixels_AllocFlag, memory is zeroed.
 
         Returns false and calls reset() if SkImageInfo could not be set, or memory could
         not be allocated, or memory could not optionally be zeroed.
 
         On most platforms, allocating pixel memory may succeed even though there is
         not sufficient memory to hold pixels; allocation does not take place
         until the pixels are written to. The actual behavior depends on the platform
         implementation of malloc(), if flags is zero, and calloc(), if flags is
         kZeroPixels_AllocFlag.
 
-        Passing kZeroPixels_AllocFlag is usually faster than separately calling
-        eraseColor(SK_ColorTRANSPARENT).
+        flags set to kZeroPixels_AllocFlag offers equal or better performance than
+        subsequently calling eraseColor() with SK_ColorTRANSPARENT.
 
         @param info   contains width, height, SkAlphaType, SkColorType, SkColorSpace
         @param flags  kZeroPixels_AllocFlag, or zero
         @return       true if pixels allocation is successful
     */
     bool SK_WARN_UNUSED_RESULT tryAllocPixelsFlags(const SkImageInfo& info, uint32_t flags);
 
     /** Sets SkImageInfo to info following the rules in setInfo() and allocates pixel
@@ -446,18 +462,18 @@ public:
         SK_ABORT.
 
         On most platforms, allocating pixel memory may succeed even though there is
         not sufficient memory to hold pixels; allocation does not take place
         until the pixels are written to. The actual behavior depends on the platform
         implementation of malloc(), if flags is zero, and calloc(), if flags is
         kZeroPixels_AllocFlag.
 
-        Passing kZeroPixels_AllocFlag is usually faster than separately calling
-        eraseColor(SK_ColorTRANSPARENT).
+        flags set to kZeroPixels_AllocFlag offers equal or better performance than
+        subsequently calling eraseColor() with SK_ColorTRANSPARENT.
 
         @param info   contains width, height, SkAlphaType, SkColorType, SkColorSpace
         @param flags  kZeroPixels_AllocFlag, or zero
     */
     void allocPixelsFlags(const SkImageInfo& info, uint32_t flags) {
         SkASSERT_RELEASE(this->tryAllocPixelsFlags(info, flags));
     }
 
@@ -530,17 +546,17 @@ public:
         implementation of malloc().
 
         @param info  contains width, height, SkAlphaType, SkColorType, SkColorSpace
     */
     void allocPixels(const SkImageInfo& info) {
         this->allocPixels(info, info.minRowBytes());
     }
 
-    /** Sets SkImageInfo to width, height, and native SkColorType; and allocates
+    /** Sets SkImageInfo to width, height, and native color type; and allocates
         pixel memory. If isOpaque is true, sets SkImageInfo to kOpaque_SkAlphaType;
         otherwise, sets to kPremul_SkAlphaType.
 
         Calls reset() and returns false if width exceeds 29 bits or is negative,
         or height is negative.
 
         Returns false if allocation fails.
 
@@ -553,17 +569,17 @@ public:
         @return          true if pixel storage is allocated
     */
     bool SK_WARN_UNUSED_RESULT tryAllocN32Pixels(int width, int height, bool isOpaque = false) {
         SkImageInfo info = SkImageInfo::MakeN32(width, height,
                                             isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
         return this->tryAllocPixels(info);
     }
 
-    /** Sets SkImageInfo to width, height, and the native SkColorType; and allocates
+    /** Sets SkImageInfo to width, height, and the native color type; and allocates
         pixel memory. If isOpaque is true, sets SkImageInfo to kPremul_SkAlphaType;
         otherwise, sets to kOpaque_SkAlphaType.
 
         Aborts if width exceeds 29 bits or is negative, or height is negative, or
         allocation fails. Abort steps may be provided by the user at compile time by
         defining SK_ABORT.
 
         Use to create SkBitmap that matches SkPMColor, the native pixel arrangement on
@@ -757,54 +773,43 @@ public:
     uint32_t getGenerationID() const;
 
     /** Marks that pixels in SkPixelRef have changed. Subsequent calls to
         getGenerationID() return a different value.
     */
     void notifyPixelsChanged() const;
 
     /** Replaces pixel values with c. All pixels contained by bounds() are affected.
-        If the colorType() is kGray_8_SkColorType or k565_SkColorType, then color alpha
+        If the colorType() is kGray_8_SkColorType or k565_SkColorType, then alpha
         is ignored; RGB is treated as opaque. If colorType() is kAlpha_8_SkColorType,
         then RGB is ignored.
 
         @param c  unpremultiplied color
     */
     void eraseColor(SkColor c) const;
 
     /** Replaces pixel values with unpremultiplied color built from a, r, g, and b.
         All pixels contained by bounds() are affected.
         If the colorType() is kGray_8_SkColorType or k565_SkColorType, then a
         is ignored; r, g, and b are treated as opaque. If colorType() is kAlpha_8_SkColorType,
         then r, g, and b are ignored.
 
-        @param a  amount of color alpha, from fully transparent (0) to fully opaque (255)
-        @param r  amount of color rgb red, from no red (0) to full red (255)
-        @param g  amount of color rgb green, from no green (0) to full green (255)
-        @param b  amount of color rgb blue, from no blue (0) to full blue (255)
+        @param a  amount of alpha, from fully transparent (0) to fully opaque (255)
+        @param r  amount of red, from no red (0) to full red (255)
+        @param g  amount of green, from no green (0) to full green (255)
+        @param b  amount of blue, from no blue (0) to full blue (255)
     */
     void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const {
         this->eraseColor(SkColorSetARGB(a, r, g, b));
     }
 
-    /** Deprecated. Use eraseARGB() or eraseColor().
-
-        @param r  amount of red
-        @param g  amount of green
-        @param b  amount of blue
-    */
-    SK_ATTR_DEPRECATED("use eraseARGB or eraseColor")
-    void eraseRGB(U8CPU r, U8CPU g, U8CPU b) const {
-        this->eraseARGB(0xFF, r, g, b);
-    }
-
     /** Replaces pixel values inside area with c. If area does not intersect bounds(),
         call has no effect.
 
-        If the colorType() is kGray_8_SkColorType or k565_SkColorType, then color alpha
+        If the colorType() is kGray_8_SkColorType or k565_SkColorType, then alpha
         is ignored; RGB is treated as opaque. If colorType() is kAlpha_8_SkColorType,
         then RGB is ignored.
 
         @param c     unpremultiplied color
         @param area  rectangle to fill
     */
     void erase(SkColor c, const SkIRect& area) const;
 
@@ -829,16 +834,28 @@ public:
         @param x  column index, zero or greater, and less than width()
         @param y  row index, zero or greater, and less than height()
         @return   pixel converted to unpremultiplied color
     */
     SkColor getColor(int x, int y) const {
         return this->pixmap().getColor(x, y);
     }
 
+    /** Look up the pixel at (x,y) and return its alpha component, normalized to [0..1].
+        This is roughly equivalent to SkGetColorA(getColor()), but can be more efficent
+        (and more precise if the pixels store more than 8 bits per component).
+
+        @param x  column index, zero or greater, and less than width()
+        @param y  row index, zero or greater, and less than height()
+        @return   alpha converted to normalized float
+     */
+    float getAlphaf(int x, int y) const {
+        return this->pixmap().getAlphaf(x, y);
+    }
+
     /** Returns pixel address at (x, y).
 
         Input is not validated: out of bounds values of x or y, or kUnknown_SkColorType,
         trigger an assert() if built with SK_DEBUG defined. Returns nullptr if
         SkColorType is kUnknown_SkColorType, or SkPixelRef is nullptr.
 
         Performs a lookup of pixel size; for better performance, call
         one of: getAddr8(), getAddr16(), or getAddr32().
@@ -906,54 +923,16 @@ public:
         - subset does not intersect bounds()
 
         @param dst     SkBitmap set to subset
         @param subset  rectangle of pixels to reference
         @return        true if dst is replaced by subset
     */
     bool extractSubset(SkBitmap* dst, const SkIRect& subset) const;
 
-    /** Copies SkRect of pixels from SkBitmap pixels to dstPixels. Copy starts at (srcX, srcY),
-        and does not exceed SkBitmap (width(), height()).
-
-        dstInfo specifies width, height, SkColorType, SkAlphaType, and
-        SkColorSpace of destination. dstRowBytes specifics the gap from one destination
-        row to the next. Returns true if pixels are copied. Returns false if:
-        - dstInfo.addr() equals nullptr
-        - dstRowBytes is less than dstInfo.minRowBytes()
-        - SkPixelRef is nullptr
-
-        Pixels are copied only if pixel conversion is possible. If SkBitmap colorType() is
-        kGray_8_SkColorType, or kAlpha_8_SkColorType; dstInfo.colorType() must match.
-        If SkBitmap colorType() is kGray_8_SkColorType, dstInfo.colorSpace() must match.
-        If SkBitmap alphaType() is kOpaque_SkAlphaType, dstInfo.alphaType() must
-        match. If SkBitmap colorSpace() is nullptr, dstInfo.colorSpace() must match. Returns
-        false if pixel conversion is not possible.
-
-        srcX and srcY may be negative to copy only top or left of source. Returns
-        false if width() or height() is zero or negative.
-        Returns false if abs(srcX) >= Bitmap width(), or if abs(srcY) >= Bitmap height().
-
-        If behavior is SkTransferFunctionBehavior::kRespect: converts source
-        pixels to a linear space before converting to dstInfo.
-        If behavior is SkTransferFunctionBehavior::kIgnore: source
-        pixels are treated as if they are linear, regardless of how they are encoded.
-
-        @param dstInfo      destination width, height, SkColorType, SkAlphaType, SkColorSpace
-        @param dstPixels    destination pixel storage
-        @param dstRowBytes  destination row length
-        @param srcX         column index whose absolute value is less than width()
-        @param srcY         row index whose absolute value is less than height()
-        @param behavior     one of: SkTransferFunctionBehavior::kRespect,
-                            SkTransferFunctionBehavior::kIgnore
-        @return             true if pixels are copied to dstPixels
-    */
-    bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
-                    int srcX, int srcY, SkTransferFunctionBehavior behavior) const;
-
     /** Copies a SkRect of pixels from SkBitmap to dstPixels. Copy starts at (srcX, srcY),
         and does not exceed SkBitmap (width(), height()).
 
         dstInfo specifies width, height, SkColorType, SkAlphaType, and SkColorSpace of
         destination. dstRowBytes specifics the gap from one destination row to the next.
         Returns true if pixels are copied. Returns false if:
         - dstInfo.addr() equals nullptr
         - dstRowBytes is less than dstInfo.minRowBytes()
@@ -973,20 +952,17 @@ public:
         @param dstInfo      destination width, height, SkColorType, SkAlphaType, SkColorSpace
         @param dstPixels    destination pixel storage
         @param dstRowBytes  destination row length
         @param srcX         column index whose absolute value is less than width()
         @param srcY         row index whose absolute value is less than height()
         @return             true if pixels are copied to dstPixels
     */
     bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
-                    int srcX, int srcY) const {
-        return this->readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY,
-                SkTransferFunctionBehavior::kRespect);
-    }
+                    int srcX, int srcY) const;
 
     /** Copies a SkRect of pixels from SkBitmap to dst. Copy starts at (srcX, srcY), and
         does not exceed SkBitmap (width(), height()).
 
         dst specifies width, height, SkColorType, SkAlphaType, SkColorSpace, pixel storage,
         and row bytes of destination. dst.rowBytes() specifics the gap from one destination
         row to the next. Returns true if pixels are copied. Returns false if:
         - dst pixel storage equals nullptr
@@ -1056,19 +1032,17 @@ public:
         false if width() or height() is zero or negative.
         Returns false if abs(dstX) >= Bitmap width(), or if abs(dstY) >= Bitmap height().
 
         @param src   source SkPixmap: SkImageInfo, pixels, row bytes
         @param dstX  column index whose absolute value is less than width()
         @param dstY  row index whose absolute value is less than height()
         @return      true if src pixels are copied to SkBitmap
     */
-    bool writePixels(const SkPixmap& src, int dstX, int dstY) {
-        return this->writePixels(src, dstX, dstY, SkTransferFunctionBehavior::kRespect);
-    }
+    bool writePixels(const SkPixmap& src, int dstX, int dstY);
 
     /** Copies a SkRect of pixels from src. Copy starts at (0, 0), and does not exceed
         (src.width(), src.height()).
 
         src specifies width, height, SkColorType, SkAlphaType, SkColorSpace, pixel storage,
         and row bytes of source. src.rowBytes() specifics the gap from one source
         row to the next. Returns true if pixels are copied. Returns false if:
         - src pixel storage equals nullptr
@@ -1084,58 +1058,26 @@ public:
 
         @param src  source SkPixmap: SkImageInfo, pixels, row bytes
         @return     true if src pixels are copied to SkBitmap
     */
     bool writePixels(const SkPixmap& src) {
         return this->writePixels(src, 0, 0);
     }
 
-    /** Copies a SkRect of pixels from src. Copy starts at (0, 0), and does not exceed
-        (src.width(), src.height()).
-
-        src specifies width, height, SkColorType, SkAlphaType, SkColorSpace, pixel storage,
-        and row bytes of source. src.rowBytes() specifics the gap from one source
-        row to the next. Returns true if pixels are copied. Returns false if:
-        - src pixel storage equals nullptr
-        - src.rowBytes is less than SkImageInfo::minRowBytes
-        - SkPixelRef is nullptr
-
-        Pixels are copied only if pixel conversion is possible. If SkBitmap colorType() is
-        kGray_8_SkColorType, or kAlpha_8_SkColorType; src SkColorType must match.
-        If SkBitmap colorType() is kGray_8_SkColorType, src SkColorSpace must match.
-        If SkBitmap alphaType() is kOpaque_SkAlphaType, src SkAlphaType must
-        match. If SkBitmap colorSpace() is nullptr, src SkColorSpace must match. Returns
-        false if pixel conversion is not possible. Returns false if width() or height()
-        is zero or negative.
-
-        If behavior is SkTransferFunctionBehavior::kRespect: converts src
-        pixels to a linear space before converting to SkImageInfo.
-        If behavior is SkTransferFunctionBehavior::kIgnore: src
-        pixels are treated as if they are linear, regardless of how they are encoded.
-
-        @param src       source SkPixmap: SkImageInfo, pixels, row bytes
-        @param x         column index whose absolute value is less than width()
-        @param y         row index whose absolute value is less than height()
-        @param behavior  one of: SkTransferFunctionBehavior::kRespect,
-                         SkTransferFunctionBehavior::kIgnore
-        @return          true if src pixels are copied to SkBitmap
-    */
-    bool writePixels(const SkPixmap& src, int x, int y, SkTransferFunctionBehavior behavior);
-
 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
-    /** Android framework only.
+    /** For use by Android framework only.
 
         @return  true if setHasHardwareMipMap() has been called with true
     */
     bool hasHardwareMipMap() const {
         return (fFlags & kHasHardwareMipMap_Flag) != 0;
     }
 
-    /** Android framework only.
+    /** For use by Android framework only.
 
         @param hasHardwareMipMap  sets state
     */
     void setHasHardwareMipMap(bool hasHardwareMipMap) {
         if (hasHardwareMipMap) {
             fFlags |= kHasHardwareMipMap_Flag;
         } else {
             fFlags &= ~kHasHardwareMipMap_Flag;
@@ -1179,17 +1121,17 @@ public:
         If paint is not nullptr and contains SkMaskFilter, SkMaskFilter
         generates mask alpha from SkBitmap. allocator may reference a custom allocation
         class or be set to nullptr to use HeapAllocator. Sets offset to top-left
         position for dst for alignment with SkBitmap; (0, 0) unless SkMaskFilter generates
         mask.
 
         @param dst        holds SkPixelRef to fill with alpha layer
         @param paint      holds optional SkMaskFilter; may be nullptr
-        @param allocator  method to reserve memory for SkPixelRef; may be nullptr
+        @param allocator  function to reserve memory for SkPixelRef; may be nullptr
         @param offset     top-left position for dst; may be nullptr
         @return           true if alpha layer was constructed in dst SkPixelRef
     */
     bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator,
                       SkIPoint* offset) const;
 
     /** Copies SkBitmap pixel address, row bytes, and SkImageInfo to pixmap, if address
         is available, and returns true. If pixel address is not available, return
@@ -1238,25 +1180,16 @@ public:
             or setPixelRef() was called.
 
             @param bitmap  SkBitmap containing SkImageInfo as input, and SkPixelRef as output
             @return        true if pixels are allocated
         */
         bool allocPixelRef(SkBitmap* bitmap) override;
     };
 
-    /** macro expands to: void toString(SkString* str) const;
-        Creates string representation of SkBitmap. The representation is read by
-        internal debugging tools. The interface and implementation may be
-        suppressed by defining SK_IGNORE_TO_STRING.
-
-        @param str  storage for string representation
-    */
-    SK_TO_STRING_NONVIRT()
-
 private:
     enum Flags {
         kImageIsVolatile_Flag   = 0x02,
 #ifdef SK_BUILD_FOR_ANDROID
         /* A hint for the renderer responsible for drawing this bitmap
          * indicating that it should attempt to use mipmaps when this bitmap
          * is drawn scaled down.
          */
--- a/gfx/skia/skia/include/core/SkBlendMode.h
+++ b/gfx/skia/skia/include/core/SkBlendMode.h
@@ -1,58 +1,75 @@
 /*
  * Copyright 2016 Google Inc.
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
+/* Generated by tools/bookmaker from include/core/SkBlendMode.h and docs/SkBlendMode_Reference.bmh
+   on 2018-07-13 08:15:10. Additional documentation and examples can be found at:
+   https://skia.org/user/api/SkBlendMode_Reference
+
+   You may edit either file directly. Structural changes to public interfaces require
+   editing both files. After editing docs/SkBlendMode_Reference.bmh, run:
+       bookmaker -b docs -i include/core/SkBlendMode.h -p
+   to create an updated version of this file.
+ */
+
 #ifndef SkBlendMode_DEFINED
 #define SkBlendMode_DEFINED
 
 #include "SkTypes.h"
 
 enum class SkBlendMode {
-    kClear,    //!< [0, 0]
-    kSrc,      //!< [Sa, Sc]
-    kDst,      //!< [Da, Dc]
-    kSrcOver,  //!< [Sa + Da * (1 - Sa), Sc + Dc * (1 - Sa)]
-    kDstOver,  //!< [Da + Sa * (1 - Da), Dc + Sc * (1 - Da)]
-    kSrcIn,    //!< [Sa * Da, Sc * Da]
-    kDstIn,    //!< [Da * Sa, Dc * Sa]
-    kSrcOut,   //!< [Sa * (1 - Da), Sc * (1 - Da)]
-    kDstOut,   //!< [Da * (1 - Sa), Dc * (1 - Sa)]
-    kSrcATop,  //!< [Da, Sc * Da + Dc * (1 - Sa)]
-    kDstATop,  //!< [Sa, Dc * Sa + Sc * (1 - Da)]
-    kXor,      //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + Dc * (1 - Sa)]
-    kPlus,     //!< [Sa + Da, Sc + Dc]
-    kModulate, // multiplies all components (= alpha and color)
-
-    // Following blend modes are defined in the CSS Compositing standard:
-    // https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending
-    kScreen,
-    kLastCoeffMode = kScreen,
-
-    kOverlay,
-    kDarken,
-    kLighten,
-    kColorDodge,
-    kColorBurn,
-    kHardLight,
-    kSoftLight,
-    kDifference,
-    kExclusion,
-    kMultiply,
-    kLastSeparableMode = kMultiply,
-
-    kHue,
-    kSaturation,
-    kColor,
-    kLuminosity,
-    kLastMode = kLuminosity
+    kClear,                           //!< replaces destination with zero: fully transparent
+    kSrc,                             //!< replaces destination
+    kDst,                             //!< preserves destination
+    kSrcOver,                         //!< source over destination
+    kDstOver,                         //!< destination over source
+    kSrcIn,                           //!< source trimmed inside destination
+    kDstIn,                           //!< destination trimmed by source
+    kSrcOut,                          //!< source trimmed outside destination
+    kDstOut,                          //!< destination trimmed outside source
+    kSrcATop,                         //!< source inside destination blended with destination
+    kDstATop,                         //!< destination inside source blended with source
+    kXor,                             //!< each of source and destination trimmed outside the other
+    kPlus,                            //!< sum of colors
+    kModulate,                        //!< product of premultiplied colors; darkens destination
+    kScreen,                //!< multiply inverse of pixels, inverting result; brightens destination
+    kLastCoeffMode     = kScreen,     //!< last porter duff blend mode
+    kOverlay,                         //!< multiply or screen, depending on destination
+    kDarken,                          //!< darker of source and destination
+    kLighten,                         //!< lighter of source and destination
+    kColorDodge,                      //!< brighten destination to reflect source
+    kColorBurn,                       //!< darken destination to reflect source
+    kHardLight,                       //!< multiply or screen, depending on source
+    kSoftLight,                       //!< lighten or darken, depending on source
+    kDifference,                      //!< subtract darker from lighter with higher contrast
+    kExclusion,                       //!< subtract darker from lighter with lower contrast
+    kMultiply,                        //!< multiply source with destination, darkening image
+    kLastSeparableMode = kMultiply,   //!< last blend mode operating separately on components
+    kHue,                           //!< hue of source with saturation and luminosity of destination
+    kSaturation,                    //!< saturation of source with hue and luminosity of destination
+    kColor,                         //!< hue and saturation of source with luminosity of destination
+    kLuminosity,                    //!< luminosity of source with hue and saturation of destination
+    kLastMode          = kLuminosity, //!< last valid value
 };
 
-/**
- *  Return the (c-string) name of the blendmode.
- */
-SK_API const char* SkBlendMode_Name(SkBlendMode);
+/** Returns name of blendMode as null-terminated C string.
+
+    @param blendMode  one of:
+                      SkBlendMode::kClear, SkBlendMode::kSrc, SkBlendMode::kDst, SkBlendMode::kSrcOver,
+                      SkBlendMode::kDstOver, SkBlendMode::kSrcIn, SkBlendMode::kDstIn,
+                      SkBlendMode::kSrcOut, SkBlendMode::kDstOut, SkBlendMode::kSrcATop,
+                      SkBlendMode::kDstATop, SkBlendMode::kXor, SkBlendMode::kPlus,
+                      SkBlendMode::kModulate, SkBlendMode::kScreen, SkBlendMode::kOverlay,
+                      SkBlendMode::kDarken, SkBlendMode::kLighten, SkBlendMode::kColorDodge,
+                      SkBlendMode::kColorBurn, SkBlendMode::kHardLight, SkBlendMode::kSoftLight,
+                      SkBlendMode::kDifference, SkBlendMode::kExclusion, SkBlendMode::kMultiply,
+                      SkBlendMode::kHue, SkBlendMode::kSaturation, SkBlendMode::kColor,
+                      SkBlendMode::kLuminosity
+    @return           C string
+*/
+SK_API const char* SkBlendMode_Name(SkBlendMode blendMode);
 
 #endif
--- a/gfx/skia/skia/include/core/SkBlurTypes.h
+++ b/gfx/skia/skia/include/core/SkBlurTypes.h
@@ -11,19 +11,12 @@
 #include "SkTypes.h"
 
 enum SkBlurStyle {
     kNormal_SkBlurStyle,  //!< fuzzy inside and outside
     kSolid_SkBlurStyle,   //!< solid inside, fuzzy outside
     kOuter_SkBlurStyle,   //!< nothing inside, fuzzy outside
     kInner_SkBlurStyle,   //!< fuzzy inside, nothing outside
 
-    kLastEnum_SkBlurStyle = kInner_SkBlurStyle
-};
-
-enum SkBlurQuality {
-    kLow_SkBlurQuality,     //!< e.g. box filter
-    kHigh_SkBlurQuality,    //!< e.g. 3-pass similar to gaussian
-
-    kLastEnum_SkBlurQuality
+    kLastEnum_SkBlurStyle = kInner_SkBlurStyle,
 };
 
 #endif
--- a/gfx/skia/skia/include/core/SkCanvas.h
+++ b/gfx/skia/skia/include/core/SkCanvas.h
@@ -1,50 +1,59 @@
 /*
  * 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.
  */
 
+/* Generated by tools/bookmaker from include/core/SkCanvas.h and docs/SkCanvas_Reference.bmh
+   on 2018-08-28 10:32:58. Additional documentation and examples can be found at:
+   https://skia.org/user/api/SkCanvas_Reference
+
+   You may edit either file directly. Structural changes to public interfaces require
+   editing both files. After editing docs/SkCanvas_Reference.bmh, run:
+       bookmaker -b docs -i include/core/SkCanvas.h -p
+   to create an updated version of this file.
+ */
+
 #ifndef SkCanvas_DEFINED
 #define SkCanvas_DEFINED
 
+#include "../private/SkMacros.h"
 #include "SkBlendMode.h"
 #include "SkClipOp.h"
 #include "SkDeque.h"
 #include "SkPaint.h"
 #include "SkRasterHandleAllocator.h"
 #include "SkSurfaceProps.h"
+#include "SkVertices.h"
 
 class GrContext;
 class GrRenderTargetContext;
 class SkAndroidFrameworkUtils;
 class SkBaseDevice;
 class SkBitmap;
-class SkClipStack;
 class SkData;
 class SkDraw;
 class SkDrawable;
-class SkDrawFilter;
 struct SkDrawShadowRec;
+class SkGlyphRunBuilder;
 class SkImage;
 class SkImageFilter;
 class SkMetaData;
 class SkPath;
 class SkPicture;
 class SkPixmap;
-class SkRasterClip;
 class SkRegion;
 class SkRRect;
 struct SkRSXform;
 class SkSurface;
 class SkSurface_Base;
 class SkTextBlob;
-class SkVertices;
 
 /** \class SkCanvas
     SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
     SkCanvas contains a stack of SkMatrix and clip values.
 
     SkCanvas and SkPaint together provide the state to draw into SkSurface or SkBaseDevice.
     Each SkCanvas draw call transforms the geometry of the object by the concatenation of all
     SkMatrix values in the stack. The transformed geometry is clipped by the intersection
@@ -52,23 +61,23 @@ class SkVertices;
     state such as color, SkTypeface, text size, stroke width, SkShader and so on.
 
     To draw to a pixel-based destination, create raster surface or GPU surface.
     Request SkCanvas from SkSurface to obtain the interface to draw.
     SkCanvas generated by raster surface draws to memory visible to the CPU.
     SkCanvas generated by GPU surface uses Vulkan or OpenGL to draw to the GPU.
 
     To draw to a document, obtain SkCanvas from svg canvas, document pdf, or SkPictureRecorder.
-    SkDocument based SkCanvas and other SkCanvas Subclasses reference SkBaseDevice describing the
+    SkDocument based SkCanvas and other SkCanvas subclasses reference SkBaseDevice describing the
     destination.
 
     SkCanvas can be constructed to draw to SkBitmap without first creating raster surface.
     This approach may be deprecated in the future.
 */
-class SK_API SkCanvas : SkNoncopyable {
+class SK_API SkCanvas {
     enum PrivateSaveLayerFlags {
         kDontClipToLayer_PrivateSaveLayerFlag   = 1U << 31,
     };
 
 public:
 
     /** Allocates raster SkCanvas that will draw directly into pixels.
 
@@ -132,17 +141,17 @@ public:
     /** Creates an empty SkCanvas with no backing device or pixels, with
         a width and height of zero.
 
         @return  empty SkCanvas
     */
     SkCanvas();
 
     /** Creates SkCanvas of the specified dimensions without a SkSurface.
-        Used by Subclasses with custom implementations for draw methods.
+        Used by subclasses with custom implementations for draw member functions.
 
         If props equals nullptr, SkSurfaceProps are created with
         SkSurfaceProps::InitType settings, which choose the pixel striping
         direction and order. Since a platform may dynamically change its direction when
         the device is rotated, and since a platform may have multiple monitors with
         different characteristics, it is best not to rely on this legacy behavior.
 
         @param width   zero or greater
@@ -150,61 +159,61 @@ public:
         @param props   LCD striping orientation and setting for device independent fonts;
                        may be nullptr
         @return        SkCanvas placeholder with dimensions
     */
     SkCanvas(int width, int height, const SkSurfaceProps* props = nullptr);
 
     /** To be deprecated soon.
     */
-    explicit SkCanvas(SkBaseDevice* device);
-
-    /** Construct a canvas that draws into bitmap.
+    explicit SkCanvas(sk_sp<SkBaseDevice> device);
+
+    /** Constructs a canvas that draws into bitmap.
         Sets SkSurfaceProps::kLegacyFontHost_InitType in constructed SkSurface.
 
         SkBitmap is copied so that subsequently editing bitmap will not affect
         constructed SkCanvas.
 
         May be deprecated in the future.
 
         @param bitmap  width, height, SkColorType, SkAlphaType, and pixel
                        storage of raster surface
         @return        SkCanvas that can be used to draw into bitmap
     */
     explicit SkCanvas(const SkBitmap& bitmap);
 
 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
     enum class ColorBehavior {
-        kLegacy, //!< Is a placeholder to allow specialized constructor; has no meaning.
+        kLegacy, //!< placeholder
     };
 
-    /** Android framework only.
+    /** For use by Android framework only.
 
         @param bitmap    specifies a bitmap for the canvas to draw into
         @param behavior  specializes this constructor; value is unused
         @return          SkCanvas that can be used to draw into bitmap
     */
     SkCanvas(const SkBitmap& bitmap, ColorBehavior behavior);
 #endif
 
-    /** Construct a canvas that draws into bitmap.
+    /** Constructs a canvas that draws into bitmap.
         Use props to match the device characteristics, like LCD striping.
 
         bitmap is copied so that subsequently editing bitmap will not affect
         constructed SkCanvas.
 
         @param bitmap  width, height, SkColorType, SkAlphaType,
                        and pixel storage of raster surface
         @param props   order and orientation of RGB striping; and whether to use
                        device independent fonts
         @return        SkCanvas that can be used to draw into bitmap
     */
     SkCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props);
 
-    /** Draws saved layer, if any.
+    /** Draws saved layers, if any.
         Frees up resources used by SkCanvas.
     */
     virtual ~SkCanvas();
 
     /** Returns storage to associate additional data with the canvas.
         The storage is freed when SkCanvas is deleted.
 
         @return  storage that can be read from and written to
@@ -213,19 +222,18 @@ public:
 
     /** Returns SkImageInfo for SkCanvas. If SkCanvas is not associated with raster surface or
         GPU surface, returned SkColorType is set to kUnknown_SkColorType.
 
         @return  dimensions and SkColorType of SkCanvas
     */
     SkImageInfo imageInfo() const;
 
-    /** If SkCanvas is associated with raster surface or
-        GPU surface, copies SkSurfaceProps and returns true. Otherwise,
-        return false and leave props unchanged.
+    /** Copies SkSurfaceProps, if SkCanvas is associated with raster surface or
+        GPU surface, and returns true. Otherwise, returns false and leave props unchanged.
 
         @param props  storage for writable SkSurfaceProps
         @return       true if SkSurfaceProps was copied
     */
     bool getProps(SkSurfaceProps* props) const;
 
     /** Triggers the immediate execution of all pending draw operations.
         If SkCanvas is associated with GPU surface, resolves all pending GPU operations.
@@ -286,17 +294,17 @@ public:
     */
     SkRasterHandleAllocator::Handle accessTopRasterHandle() const;
 
     /** Returns true if SkCanvas has direct access to its pixels.
 
         Pixels are readable when SkBaseDevice is raster. Pixels are not readable when SkCanvas
         is returned from GPU surface, returned by SkDocument::beginPage, returned by
         SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility class
-        like SkDumpCanvas.
+        like SkDebugCanvas.
 
         pixmap is valid only while SkCanvas is in scope and unchanged. Any
         SkCanvas or SkSurface call may invalidate the pixmap values.
 
         @param pixmap  storage for pixel state if pixels are readable; otherwise, ignored
         @return        true if SkCanvas has direct access to pixels
     */
     bool peekPixels(SkPixmap* pixmap);
@@ -307,17 +315,17 @@ public:
         Source SkRect corners are (srcX, srcY) and (imageInfo().width(), imageInfo().height()).
         Destination SkRect corners are (0, 0) and (dstInfo.width(), dstInfo.height()).
         Copies each readable pixel intersecting both rectangles, without scaling,
         converting to dstInfo.colorType() and dstInfo.alphaType() if required.
 
         Pixels are readable when SkBaseDevice is raster, or backed by a GPU.
         Pixels are not readable when SkCanvas is returned by SkDocument::beginPage,
         returned by SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility
-        class like SkDumpCanvas.
+        class like SkDebugCanvas.
 
         The destination pixel storage must be allocated by the caller.
 
         Pixel values are converted only if SkColorType and SkAlphaType
         do not match. Only pixels within both source and destination rectangles
         are copied. dstPixels contents outside SkRect intersection are unchanged.
 
         Pass negative values for srcX or srcY to offset pixels across or down destination.
@@ -326,35 +334,35 @@ public:
         - Source and destination rectangles do not intersect.
         - SkCanvas pixels could not be converted to dstInfo.colorType() or dstInfo.alphaType().
         - SkCanvas pixels are not readable; for instance, SkCanvas is document-based.
         - dstRowBytes is too small to contain one row of pixels.
 
         @param dstInfo      width, height, SkColorType, and SkAlphaType of dstPixels
         @param dstPixels    storage for pixels; dstInfo.height() times dstRowBytes, or larger
         @param dstRowBytes  size of one destination row; dstInfo.width() times pixel size, or larger
-        @param srcX         offset into readable pixels in x; may be negative
-        @param srcY         offset into readable pixels in y; may be negative
+        @param srcX         offset into readable pixels on x-axis; may be negative
+        @param srcY         offset into readable pixels on y-axis; may be negative
         @return             true if pixels were copied
     */
     bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
                     int srcX, int srcY);
 
     /** Copies SkRect of pixels from SkCanvas into pixmap. SkMatrix and clip are
         ignored.
 
         Source SkRect corners are (srcX, srcY) and (imageInfo().width(), imageInfo().height()).
         Destination SkRect corners are (0, 0) and (pixmap.width(), pixmap.height()).
         Copies each readable pixel intersecting both rectangles, without scaling,
         converting to pixmap.colorType() and pixmap.alphaType() if required.
 
         Pixels are readable when SkBaseDevice is raster, or backed by a GPU.
         Pixels are not readable when SkCanvas is returned by SkDocument::beginPage,
         returned by SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility
-        class like SkDumpCanvas.
+        class like SkDebugCanvas.
 
         Caller must allocate pixel storage in pixmap if needed.
 
         Pixel values are converted only if SkColorType and SkAlphaType
         do not match. Only pixels within both source and destination SkRect
         are copied. pixmap pixels contents outside SkRect intersection are unchanged.
 
         Pass negative values for srcX or srcY to offset pixels across or down pixmap.
@@ -362,34 +370,34 @@ public:
         Does not copy, and returns false if:
         - Source and destination rectangles do not intersect.
         - SkCanvas pixels could not be converted to pixmap.colorType() or pixmap.alphaType().
         - SkCanvas pixels are not readable; for instance, SkCanvas is document-based.
         - SkPixmap pixels could not be allocated.
         - pixmap.rowBytes() is too small to contain one row of pixels.
 
         @param pixmap  storage for pixels copied from SkCanvas
-        @param srcX    offset into readable pixels in x; may be negative
-        @param srcY    offset into readable pixels in y; may be negative
+        @param srcX    offset into readable pixels on x-axis; may be negative
+        @param srcY    offset into readable pixels on y-axis; may be negative
         @return        true if pixels were copied
     */
     bool readPixels(const SkPixmap& pixmap, int srcX, int srcY);
 
     /** Copies SkRect of pixels from SkCanvas into bitmap. SkMatrix and clip are
         ignored.
 
         Source SkRect corners are (srcX, srcY) and (imageInfo().width(), imageInfo().height()).
         Destination SkRect corners are (0, 0) and (bitmap.width(), bitmap.height()).
         Copies each readable pixel intersecting both rectangles, without scaling,
         converting to bitmap.colorType() and bitmap.alphaType() if required.
 
         Pixels are readable when SkBaseDevice is raster, or backed by a GPU.
         Pixels are not readable when SkCanvas is returned by SkDocument::beginPage,
         returned by SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility
-        class like SkDumpCanvas.
+        class like SkDebugCanvas.
 
         Caller must allocate pixel storage in bitmap if needed.
 
         SkBitmap values are converted only if SkColorType and SkAlphaType
         do not match. Only pixels within both source and destination rectangles
         are copied. SkBitmap pixels outside SkRect intersection are unchanged.
 
         Pass negative values for srcX or srcY to offset pixels across or down bitmap.
@@ -397,34 +405,34 @@ public:
         Does not copy, and returns false if:
         - Source and destination rectangles do not intersect.
         - SkCanvas pixels could not be converted to bitmap.colorType() or bitmap.alphaType().
         - SkCanvas pixels are not readable; for instance, SkCanvas is document-based.
         - bitmap pixels could not be allocated.
         - bitmap.rowBytes() is too small to contain one row of pixels.
 
         @param bitmap  storage for pixels copied from SkCanvas
-        @param srcX    offset into readable pixels in x; may be negative
-        @param srcY    offset into readable pixels in y; may be negative
+        @param srcX    offset into readable pixels on x-axis; may be negative
+        @param srcY    offset into readable pixels on y-axis; may be negative
         @return        true if pixels were copied
     */
     bool readPixels(const SkBitmap& bitmap, int srcX, int srcY);
 
     /** Copies SkRect from pixels to SkCanvas. SkMatrix and clip are ignored.
         Source SkRect corners are (0, 0) and (info.width(), info.height()).
         Destination SkRect corners are (x, y) and
         (imageInfo().width(), imageInfo().height()).
 
         Copies each readable pixel intersecting both rectangles, without scaling,
         converting to imageInfo().colorType() and imageInfo().alphaType() if required.
 
         Pixels are writable when SkBaseDevice is raster, or backed by a GPU.
         Pixels are not writable when SkCanvas is returned by SkDocument::beginPage,
         returned by SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility
-        class like SkDumpCanvas.
+        class like SkDebugCanvas.
 
         Pixel values are converted only if SkColorType and SkAlphaType
         do not match. Only pixels within both source and destination rectangles
         are copied. SkCanvas pixels outside SkRect intersection are unchanged.
 
         Pass negative values for x or y to offset pixels to the left or
         above SkCanvas pixels.
 
@@ -433,35 +441,35 @@ public:
         - pixels could not be converted to SkCanvas imageInfo().colorType() or
         imageInfo().alphaType().
         - SkCanvas pixels are not writable; for instance, SkCanvas is document-based.
         - rowBytes is too small to contain one row of pixels.
 
         @param info      width, height, SkColorType, and SkAlphaType of pixels
         @param pixels    pixels to copy, of size info.height() times rowBytes, or larger
         @param rowBytes  size of one row of pixels; info.width() times pixel size, or larger
-        @param x         offset into SkCanvas writable pixels in x; may be negative
-        @param y         offset into SkCanvas writable pixels in y; may be negative
+        @param x         offset into SkCanvas writable pixels on x-axis; may be negative
+        @param y         offset into SkCanvas writable pixels on y-axis; may be negative
         @return          true if pixels were written to SkCanvas
     */
     bool writePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, int x, int y);
 
     /** Copies SkRect from pixels to SkCanvas. SkMatrix and clip are ignored.
         Source SkRect corners are (0, 0) and (bitmap.width(), bitmap.height()).
 
         Destination SkRect corners are (x, y) and
         (imageInfo().width(), imageInfo().height()).
 
         Copies each readable pixel intersecting both rectangles, without scaling,
         converting to imageInfo().colorType() and imageInfo().alphaType() if required.
 
         Pixels are writable when SkBaseDevice is raster, or backed by a GPU.
         Pixels are not writable when SkCanvas is returned by SkDocument::beginPage,
         returned by SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility
-        class like SkDumpCanvas.
+        class like SkDebugCanvas.
 
         Pixel values are converted only if SkColorType and SkAlphaType
         do not match. Only pixels within both source and destination rectangles
         are copied. SkCanvas pixels outside SkRect intersection are unchanged.
 
         Pass negative values for x or y to offset pixels to the left or
         above SkCanvas pixels.
 
@@ -475,113 +483,106 @@ public:
 
         @param bitmap  contains pixels copied to SkCanvas
         @param x       offset into SkCanvas writable pixels in x; may be negative
         @param y       offset into SkCanvas writable pixels in y; may be negative
         @return        true if pixels were written to SkCanvas
     */
     bool writePixels(const SkBitmap& bitmap, int x, int y);
 
-    /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms).
-        Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
-        restoring the SkMatrix, clip, and SkDrawFilter to their state when save() was called.
+    /** Saves SkMatrix and clip.
+        Calling restore() discards changes to SkMatrix and clip,
+        restoring the SkMatrix and clip to their state when save() was called.
 
         SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(), setMatrix(),
         and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), clipPath(), clipRegion().
 
         Saved SkCanvas state is put on a stack; multiple calls to save() should be balance
         by an equal number of calls to restore().
 
         Call restoreToCount() with result to restore this and subsequent saves.
 
         @return  depth of saved stack
     */
     int save();
 
-    /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
-        and allocates a SkBitmap for subsequent drawing.
-        Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
-        and draws the SkBitmap.
+    /** Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
+        Calling restore() discards changes to SkMatrix and clip, and draws the SkBitmap.
 
         SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
         setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
         clipPath(), clipRegion().
 
         SkRect bounds suggests but does not define the SkBitmap size. To clip drawing to
         a specific rectangle, use clipRect().
 
-        Optional SkPaint paint applies color alpha, SkColorFilter, SkImageFilter, and
+        Optional SkPaint paint applies alpha, SkColorFilter, SkImageFilter, and
         SkBlendMode when restore() is called.
 
         Call restoreToCount() with returned value to restore this and subsequent saves.
 
         @param bounds  hint to limit the size of the layer; may be nullptr
         @param paint   graphics state for layer; may be nullptr
         @return        depth of saved stack
     */
     int saveLayer(const SkRect* bounds, const SkPaint* paint);
 
-    /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
-        and allocates a SkBitmap for subsequent drawing.
-        Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
-        and draws the SkBitmap.
+    /** Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
+        Calling restore() discards changes to SkMatrix and clip, and draws the SkBitmap.
 
         SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
         setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
         clipPath(), clipRegion().
 
         SkRect bounds suggests but does not define the layer size. To clip drawing to
         a specific rectangle, use clipRect().
 
-        Optional SkPaint paint applies color alpha, SkColorFilter, SkImageFilter, and
+        Optional SkPaint paint applies alpha, SkColorFilter, SkImageFilter, and
         SkBlendMode when restore() is called.
 
         Call restoreToCount() with returned value to restore this and subsequent saves.
 
         @param bounds  hint to limit the size of layer; may be nullptr
         @param paint   graphics state for layer; may be nullptr
         @return        depth of saved stack
     */
     int saveLayer(const SkRect& bounds, const SkPaint* paint) {
         return this->saveLayer(&bounds, paint);
     }
 
-    /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
-        and allocates a SkBitmap for subsequent drawing.
+    /** Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
         LCD text is preserved when the layer is drawn to the prior layer.
 
-        Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
-        and draws layer.
+        Calling restore() discards changes to SkMatrix and clip, and draws layer.
 
         SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
         setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
         clipPath(), clipRegion().
 
         SkRect bounds suggests but does not define the layer size. To clip drawing to
         a specific rectangle, use clipRect().
 
-        Optional SkPaint paint applies color alpha, SkColorFilter, SkImageFilter, and
+        Optional SkPaint paint applies alpha, SkColorFilter, SkImageFilter, and
         SkBlendMode when restore() is called.
 
         Call restoreToCount() with returned value to restore this and subsequent saves.
 
         Draw text on an opaque background so that LCD text blends correctly with the
         prior layer. LCD text drawn on a background with transparency may result in
         incorrect blending.
 
         @param bounds  hint to limit the size of layer; may be nullptr
         @param paint   graphics state for layer; may be nullptr
         @return        depth of saved stack
     */
     int saveLayerPreserveLCDTextRequests(const SkRect* bounds, const SkPaint* paint);
 
-    /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
-        and allocates SkBitmap for subsequent drawing.
-
-        Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
+    /** Saves SkMatrix and clip, and allocates SkBitmap for subsequent drawing.
+
+        Calling restore() discards changes to SkMatrix and clip,
         and blends layer with alpha opacity onto prior layer.
 
         SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
         setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
         clipPath(), clipRegion().
 
         SkRect bounds suggests but does not define layer size. To clip drawing to
         a specific rectangle, use clipRect().
@@ -591,32 +592,30 @@ public:
         Call restoreToCount() with returned value to restore this and subsequent saves.
 
         @param bounds  hint to limit the size of layer; may be nullptr
         @param alpha   opacity of layer
         @return        depth of saved stack
     */
     int saveLayerAlpha(const SkRect* bounds, U8CPU alpha);
 
-    /** \enum
+    /** \enum SkCanvas::SaveLayerFlagsSet
         SaveLayerFlags provides options that may be used in any combination in SaveLayerRec,
-        defining how layer allocated by saveLayer() operates.
+        defining how layer allocated by saveLayer() operates. It may be set to zero,
+        kPreserveLCDText_SaveLayerFlag, kInitWithPrevious_SaveLayerFlag, or both flags.
     */
-    enum {
-        /** Creates layer for LCD text. Flag is ignored if layer SkPaint contains
-            SkImageFilter or SkColorFilter.
-        */
-        kPreserveLCDText_SaveLayerFlag        = 1 << 1,
-
-        /** Initializes layer with the contents of the previous layer. */
-        kInitWithPrevious_SaveLayerFlag       = 1 << 2,
+    enum SaveLayerFlagsSet {
+        kPreserveLCDText_SaveLayerFlag  = 1 << 1, //!< creates layer for LCD text
+        kInitWithPrevious_SaveLayerFlag = 1 << 2, //!< initializes with previous contents
+        kMaskAgainstCoverage_EXPERIMENTAL_DONT_USE_SaveLayerFlag =
+                                          1 << 3, //!< experimental: do not use
 
 #ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
-        /** To be deprecated soon. */
-        kDontClipToLayer_Legacy_SaveLayerFlag = kDontClipToLayer_PrivateSaveLayerFlag,
+        kDontClipToLayer_Legacy_SaveLayerFlag =
+           kDontClipToLayer_PrivateSaveLayerFlag, //!< to be deprecated soon
 #endif
     };
 
     typedef uint32_t SaveLayerFlags;
 
     /** \struct SkCanvas::SaveLayerRec
         SaveLayerRec contains the state used to create the layer.
     */
@@ -653,19 +652,19 @@ public:
         SaveLayerRec(const SkRect* bounds, const SkPaint* paint, const SkImageFilter* backdrop,
                      SaveLayerFlags saveLayerFlags)
             : fBounds(bounds)
             , fPaint(paint)
             , fBackdrop(backdrop)
             , fSaveLayerFlags(saveLayerFlags)
         {}
 
-        /** EXPERIMENTAL: Not ready for general use.
+        /** Experimental. Not ready for general use.
             Sets fBounds, fPaint, fBackdrop, fClipMask, fClipMatrix, and fSaveLayerFlags.
-            clipMatrix uses color alpha channel of image, transformed by clipMatrix, to clip
+            clipMatrix uses alpha channel of image, transformed by clipMatrix, to clip
             layer when drawn to SkCanvas.
 
             Implementation is not complete; has no effect if SkBaseDevice is GPU-backed.
 
             @param bounds          layer dimensions; may be nullptr
             @param paint           graphics state applied to layer when overlaying prior
                                    layer; may be nullptr
             @param backdrop        prior layer copied with SkImageFilter;
@@ -682,208 +681,189 @@ public:
             : fBounds(bounds)
             , fPaint(paint)
             , fBackdrop(backdrop)
             , fClipMask(clipMask)
             , fClipMatrix(clipMatrix)
             , fSaveLayerFlags(saveLayerFlags)
         {}
 
-        /** fBounds is used as a hint to limit the size of layer; may be nullptr.
-            fBounds suggests but does not define layer size. To clip drawing to
-            a specific rectangle, use clipRect().
-        */
+        /** hints at layer size limit */
         const SkRect*        fBounds         = nullptr;
 
-        /** fPaint modifies how layer overlays the prior layer; may be nullptr.
-            color alpha, SkBlendMode, SkColorFilter, SkDrawLooper, SkImageFilter, and
-            SkMaskFilter affect layer draw.
-        */
+        /** modifies overlay */
         const SkPaint*       fPaint          = nullptr;
 
-        /** fBackdrop applies SkImageFilter to the prior layer when copying to the layer;
-            may be nullptr. Use kInitWithPrevious_SaveLayerFlag to copy the
-            prior layer without an SkImageFilter.
-        */
+        /** applies SkImageFilter to prior layer */
         const SkImageFilter* fBackdrop       = nullptr;
 
-        /** restore() clips layer by the color alpha channel of fClipMask when
-            layer is copied to SkBaseDevice. fClipMask may be nullptr.    .
-        */
+        /** clips layer with mask alpha */
         const SkImage*       fClipMask       = nullptr;
 
-        /** fClipMatrix transforms fClipMask before it clips layer. If
-            fClipMask describes a translucent gradient, it may be scaled and rotated
-            without introducing artifacts. fClipMatrix may be nullptr.
-        */
+        /** transforms mask alpha used to clip */
         const SkMatrix*      fClipMatrix     = nullptr;
 
-        /** fSaveLayerFlags are used to create layer without transparency,
-            create layer for LCD text, and to create layer with the
-            contents of the previous layer.
-        */
+        /** preserves LCD text, creates with prior layer contents */
         SaveLayerFlags       fSaveLayerFlags = 0;
-
     };
 
-    /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
-        and allocates SkBitmap for subsequent drawing.
-
-        Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
-        and blends SkBitmap with color alpha opacity onto the prior layer.
+    /** Saves SkMatrix and clip, and allocates SkBitmap for subsequent drawing.
+
+        Calling restore() discards changes to SkMatrix and clip,
+        and blends SkBitmap with alpha opacity onto the prior layer.
 
         SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
         setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
         clipPath(), clipRegion().
 
         SaveLayerRec contains the state used to create the layer.
 
         Call restoreToCount() with returned value to restore this and subsequent saves.
 
         @param layerRec  layer state
         @return          depth of save state stack
     */
     int saveLayer(const SaveLayerRec& layerRec);
 
-    /** Removes changes to SkMatrix, clip, and SkDrawFilter since SkCanvas state was
+    /** Removes changes to SkMatrix and clip since SkCanvas state was
         last saved. The state is removed from the stack.
 
         Does nothing if the stack is empty.
     */
     void restore();
 
-    /** Returns the number of saved states, each containing: SkMatrix, clip, and SkDrawFilter.
+    /** Returns the number of saved states, each containing: SkMatrix and clip.
         Equals the number of save() calls less the number of restore() calls plus one.
         The save count of a new canvas is one.
 
         @return  depth of save state stack
     */
     int getSaveCount() const;
 
-    /** Restores state to SkMatrix, clip, and SkDrawFilter values when save(), saveLayer(),
+    /** Restores state to SkMatrix and clip values when save(), saveLayer(),
         saveLayerPreserveLCDTextRequests(), or saveLayerAlpha() returned saveCount.
 
         Does nothing if saveCount is greater than state stack count.
         Restores state to initial values if saveCount is less than or equal to one.
 
         @param saveCount  depth of state stack to restore
     */
     void restoreToCount(int saveCount);
 
-    /** Translate SkMatrix by dx along the x-axis and dy along the y-axis.
-
-        Mathematically, replace SkMatrix with a translation matrix
+    /** Translates SkMatrix by dx along the x-axis and dy along the y-axis.
+
+        Mathematically, replaces SkMatrix with a translation matrix
         premultiplied with SkMatrix.
 
         This has the effect of moving the drawing by (dx, dy) before transforming
         the result with SkMatrix.
 
         @param dx  distance to translate in x
         @param dy  distance to translate in y
     */
     void translate(SkScalar dx, SkScalar dy);
 
-    /** Scale SkMatrix by sx on the x-axis and sy on the y-axis.
-
-        Mathematically, replace SkMatrix with a scale matrix
+    /** Scales SkMatrix by sx on the x-axis and sy on the y-axis.
+
+        Mathematically, replaces SkMatrix with a scale matrix
         premultiplied with SkMatrix.
 
         This has the effect of scaling the drawing by (sx, sy) before transforming
         the result with SkMatrix.
 
         @param sx  amount to scale in x
         @param sy  amount to scale in y
     */
     void scale(SkScalar sx, SkScalar sy);
 
-    /** Rotate SkMatrix by degrees. Positive degrees rotates clockwise.
-
-        Mathematically, replace SkMatrix with a rotation matrix
+    /** Rotates SkMatrix by degrees. Positive degrees rotates clockwise.
+
+        Mathematically, replaces SkMatrix with a rotation matrix
         premultiplied with SkMatrix.
 
         This has the effect of rotating the drawing by degrees before transforming
         the result with SkMatrix.
 
         @param degrees  amount to rotate, in degrees
     */
     void rotate(SkScalar degrees);
 
-    /** Rotate SkMatrix by degrees about a point at (px, py). Positive degrees rotates
+    /** Rotates SkMatrix by degrees about a point at (px, py). Positive degrees rotates
         clockwise.
 
-        Mathematically, construct a rotation matrix. Premultiply the rotation matrix by
-        a translation matrix, then replace SkMatrix with the resulting matrix
+        Mathematically, constructs a rotation matrix; premultiplies the rotation matrix by
+        a translation matrix; then replaces SkMatrix with the resulting matrix
         premultiplied with SkMatrix.
 
         This has the effect of rotating the drawing about a given point before
         transforming the result with SkMatrix.
 
         @param degrees  amount to rotate, in degrees
-        @param px       x-coordinate of the point to rotate about
-        @param py       y-coordinate of the point to rotate about
+        @param px       x-axis value of the point to rotate about
+        @param py       y-axis value of the point to rotate about
     */
     void rotate(SkScalar degrees, SkScalar px, SkScalar py);
 
-    /** Skew SkMatrix by sx on the x-axis and sy on the y-axis. A positive value of sx
-        skews the drawing right as y increases; a positive value of sy skews the drawing
-        down as x increases.
-
-        Mathematically, replace SkMatrix with a skew matrix premultiplied with SkMatrix.
+    /** Skews SkMatrix by sx on the x-axis and sy on the y-axis. A positive value of sx
+        skews the drawing right as y-axis values increase; a positive value of sy skews
+        the drawing down as x-axis values increase.
+
+        Mathematically, replaces SkMatrix with a skew matrix premultiplied with SkMatrix.
 
         This has the effect of skewing the drawing by (sx, sy) before transforming
         the result with SkMatrix.
 
-        @param sx  amount to skew in x
-        @param sy  amount to skew in y
+        @param sx  amount to skew on x-axis
+        @param sy  amount to skew on y-axis
     */
     void skew(SkScalar sx, SkScalar sy);
 
-    /** Replace SkMatrix with matrix premultiplied with existing SkMatrix.
+    /** Replaces SkMatrix with matrix premultiplied with existing SkMatrix.
 
         This has the effect of transforming the drawn geometry by matrix, before
         transforming the result with existing SkMatrix.
 
         @param matrix  matrix to premultiply with existing SkMatrix
     */
     void concat(const SkMatrix& matrix);
 
-    /** Replace SkMatrix with matrix.
+    /** Replaces SkMatrix with matrix.
         Unlike concat(), any prior matrix state is overwritten.
 
         @param matrix  matrix to copy, replacing existing SkMatrix
     */
     void setMatrix(const SkMatrix& matrix);
 
     /** Sets SkMatrix to the identity matrix.
         Any prior matrix state is overwritten.
     */
     void resetMatrix();
 
-    /** Replace clip with the intersection or difference of clip and rect,
+    /** Replaces clip with the intersection or difference of clip and rect,
         with an aliased or anti-aliased clip edge. rect is transformed by SkMatrix
         before it is combined with clip.
 
         @param rect         SkRect to combine with clip
         @param op           SkClipOp to apply to clip
         @param doAntiAlias  true if clip is to be anti-aliased
     */
     void clipRect(const SkRect& rect, SkClipOp op, bool doAntiAlias);
 
-    /** Replace clip with the intersection or difference of clip and rect.
+    /** Replaces clip with the intersection or difference of clip and rect.
         Resulting clip is aliased; pixels are fully contained by the clip.
         rect is transformed by SkMatrix before it is combined with clip.
 
         @param rect  SkRect to combine with clip
         @param op    SkClipOp to apply to clip
     */
     void clipRect(const SkRect& rect, SkClipOp op) {
         this->clipRect(rect, op, false);
     }
 
-    /** Replace clip with the intersection of clip and rect.
+    /** Replaces clip with the intersection of clip and rect.
         Resulting clip is aliased; pixels are fully contained by the clip.
         rect is transformed by SkMatrix
         before it is combined with clip.
 
         @param rect         SkRect to combine with clip
         @param doAntiAlias  true if clip is to be anti-aliased
     */
     void clipRect(const SkRect& rect, bool doAntiAlias = false) {
@@ -891,228 +871,228 @@ public:
     }
 
     /** Sets the maximum clip rectangle, which can be set by clipRect(), clipRRect() and
         clipPath() and intersect the current clip with the specified rect.
         The maximum clip affects only future clipping operations; it is not retroactive.
         The clip restriction is not recorded in pictures.
 
         Pass an empty rect to disable maximum clip.
-        This is private API to be used only by Android framework.
+        This private API is for use by Android framework only.
 
         @param rect  maximum allowed clip in device coordinates
     */
     void androidFramework_setDeviceClipRestriction(const SkIRect& rect);
 
-    /** Replace clip with the intersection or difference of clip and rrect,
+    /** Replaces clip with the intersection or difference of clip and rrect,
         with an aliased or anti-aliased clip edge.
         rrect is transformed by SkMatrix
         before it is combined with clip.
 
         @param rrect        SkRRect to combine with clip
         @param op           SkClipOp to apply to clip
         @param doAntiAlias  true if clip is to be anti-aliased
     */
     void clipRRect(const SkRRect& rrect, SkClipOp op, bool doAntiAlias);
 
-    /** Replace clip with the intersection or difference of clip and rrect.
+    /** Replaces clip with the intersection or difference of clip and rrect.
         Resulting clip is aliased; pixels are fully contained by the clip.
         rrect is transformed by SkMatrix before it is combined with clip.
 
         @param rrect  SkRRect to combine with clip
         @param op     SkClipOp to apply to clip
     */
     void clipRRect(const SkRRect& rrect, SkClipOp op) {
         this->clipRRect(rrect, op, false);
     }
 
-    /** Replace clip with the intersection of clip and rrect,
+    /** Replaces clip with the intersection of clip and rrect,
         with an aliased or anti-aliased clip edge.
         rrect is transformed by SkMatrix before it is combined with clip.
 
         @param rrect        SkRRect to combine with clip
         @param doAntiAlias  true if clip is to be anti-aliased
     */
     void clipRRect(const SkRRect& rrect, bool doAntiAlias = false) {
         this->clipRRect(rrect, SkClipOp::kIntersect, doAntiAlias);
     }
 
-    /** Replace clip with the intersection or difference of clip and path,
+    /** Replaces clip with the intersection or difference of clip and path,
         with an aliased or anti-aliased clip edge. SkPath::FillType determines if path
         describes the area inside or outside its contours; and if path contour overlaps
         itself or another path contour, whether the overlaps form part of the area.
         path is transformed by SkMatrix before it is combined with clip.
 
         @param path         SkPath to combine with clip
         @param op           SkClipOp to apply to clip
         @param doAntiAlias  true if clip is to be anti-aliased
     */
     void clipPath(const SkPath& path, SkClipOp op, bool doAntiAlias);
 
-    /** Replace clip with the intersection or difference of clip and path.
+    /** Replaces clip with the intersection or difference of clip and path.
         Resulting clip is aliased; pixels are fully contained by the clip.
         SkPath::FillType determines if path
         describes the area inside or outside its contours; and if path contour overlaps
         itself or another path contour, whether the overlaps form part of the area.
         path is transformed by SkMatrix
         before it is combined with clip.
 
         @param path  SkPath to combine with clip
         @param op    SkClipOp to apply to clip
     */
     void clipPath(const SkPath& path, SkClipOp op) {
         this->clipPath(path, op, false);
     }
 
-    /** Replace clip with the intersection of clip and path.
+    /** Replaces clip with the intersection of clip and path.
         Resulting clip is aliased; pixels are fully contained by the clip.
         SkPath::FillType determines if path
         describes the area inside or outside its contours; and if path contour overlaps
         itself or another path contour, whether the overlaps form part of the area.
         path is transformed by SkMatrix before it is combined with clip.
 
         @param path         SkPath to combine with clip
         @param doAntiAlias  true if clip is to be anti-aliased
     */
     void clipPath(const SkPath& path, bool doAntiAlias = false) {
         this->clipPath(path, SkClipOp::kIntersect, doAntiAlias);
     }
 
-    /** EXPERIMENTAL: Only used for testing.
+    /** Experimental. For testing only.
         Set to simplify clip stack using PathOps.
     */
     void setAllowSimplifyClip(bool allow) {
         fAllowSimplifyClip = allow;
     }
 
-    /** Replace clip with the intersection or difference of clip and SkRegion deviceRgn.
+    /** Replaces clip with the intersection or difference of clip and SkRegion deviceRgn.
         Resulting clip is aliased; pixels are fully contained by the clip.
         deviceRgn is unaffected by SkMatrix.
 
         @param deviceRgn  SkRegion to combine with clip
         @param op         SkClipOp to apply to clip
     */
     void clipRegion(const SkRegion& deviceRgn, SkClipOp op = SkClipOp::kIntersect);
 
-    /** Return true if SkRect rect, transformed by SkMatrix, can be quickly determined to be
+    /** Returns true if SkRect rect, transformed by SkMatrix, can be quickly determined to be
         outside of clip. May return false even though rect is outside of clip.
 
         Use to check if an area to be drawn is clipped out, to skip subsequent draw calls.
 
         @param rect  SkRect to compare with clip
         @return      true if rect, transformed by SkMatrix, does not intersect clip
     */
     bool quickReject(const SkRect& rect) const;
 
-    /** Return true if path, transformed by SkMatrix, can be quickly determined to be
+    /** Returns true if path, transformed by SkMatrix, can be quickly determined to be
         outside of clip. May return false even though path is outside of clip.
 
         Use to check if an area to be drawn is clipped out, to skip subsequent draw calls.
 
         @param path  SkPath to compare with clip
         @return      true if path, transformed by SkMatrix, does not intersect clip
     */
     bool quickReject(const SkPath& path) const;
 
-    /** Return bounds of clip, transformed by inverse of SkMatrix. If clip is empty,
+    /** Returns bounds of clip, transformed by inverse of SkMatrix. If clip is empty,
         return SkRect::MakeEmpty, where all SkRect sides equal zero.
 
         SkRect returned is outset by one to account for partial pixel coverage if clip
         is anti-aliased.
 
         @return  bounds of clip in local coordinates
     */
     SkRect getLocalClipBounds() const;
 
-    /** Return bounds of clip, transformed by inverse of SkMatrix. If clip is empty,
+    /** Returns bounds of clip, transformed by inverse of SkMatrix. If clip is empty,
         return false, and set bounds to SkRect::MakeEmpty, where all SkRect sides equal zero.
 
         bounds is outset by one to account for partial pixel coverage if clip
         is anti-aliased.
 
         @param bounds  SkRect of clip in local coordinates
         @return        true if clip bounds is not empty
     */
     bool getLocalClipBounds(SkRect* bounds) const {
         *bounds = this->getLocalClipBounds();
         return !bounds->isEmpty();
     }
 
-    /** Return SkIRect bounds of clip, unaffected by SkMatrix. If clip is empty,
+    /** Returns SkIRect bounds of clip, unaffected by SkMatrix. If clip is empty,
         return SkRect::MakeEmpty, where all SkRect sides equal zero.
 
         Unlike getLocalClipBounds(), returned SkIRect is not outset.
 
         @return  bounds of clip in SkBaseDevice coordinates
     */
     SkIRect getDeviceClipBounds() const;
 
-    /** Return SkIRect bounds of clip, unaffected by SkMatrix. If clip is empty,
+    /** Returns SkIRect bounds of clip, unaffected by SkMatrix. If clip is empty,
         return false, and set bounds to SkRect::MakeEmpty, where all SkRect sides equal zero.
 
         Unlike getLocalClipBounds(), bounds is not outset.
 
         @param bounds  SkRect of clip in device coordinates
         @return        true if clip bounds is not empty
     */
     bool getDeviceClipBounds(SkIRect* bounds) const {
         *bounds = this->getDeviceClipBounds();
         return !bounds->isEmpty();
     }
 
-    /** Fill clip with color color.
+    /** Fills clip with color color.
         mode determines how ARGB is combined with destination.
 
         @param color  unpremultiplied ARGB
         @param mode   SkBlendMode used to combine source color and destination
     */
     void drawColor(SkColor color, SkBlendMode mode = SkBlendMode::kSrcOver);
 
-    /** Fill clip with color color using SkBlendMode::kSrc.
+    /** Fills clip with color color using SkBlendMode::kSrc.
         This has the effect of replacing all pixels contained by clip with color.
 
         @param color  unpremultiplied ARGB
     */
     void clear(SkColor color) {
         this->drawColor(color, SkBlendMode::kSrc);
     }
 
-    /** Make SkCanvas contents undefined. Subsequent calls that read SkCanvas pixels,
+    /** Makes SkCanvas contents undefined. Subsequent calls that read SkCanvas pixels,
         such as drawing with SkBlendMode, return undefined results. discard() does
         not change clip or SkMatrix.
 
         discard() may do nothing, depending on the implementation of SkSurface or SkBaseDevice
         that created SkCanvas.
 
         discard() allows optimized performance on subsequent draws by removing
         cached data associated with SkSurface or SkBaseDevice.
         It is not necessary to call discard() once done with SkCanvas;
         any cached data is deleted when owning SkSurface or SkBaseDevice is deleted.
     */
     void discard() { this->onDiscard(); }
 
-    /** Fill clip with SkPaint paint. SkPaint components SkMaskFilter, SkShader,
+    /** Fills clip with SkPaint paint. SkPaint components SkMaskFilter, SkShader,
         SkColorFilter, SkImageFilter, and SkBlendMode affect drawing;
         SkPathEffect in paint is ignored.
 
         @param paint  graphics state used to fill SkCanvas
     */
     void drawPaint(const SkPaint& paint);
 
     /** \enum SkCanvas::PointMode
         Selects if an array of points are drawn as discrete points, as lines, or as
         an open polygon.
     */
     enum PointMode {
-        kPoints_PointMode,  //!< Draw each point separately.
-        kLines_PointMode,   //!< Draw each pair of points as a line segment.
-        kPolygon_PointMode, //!< Draw the array of points as a open polygon.
+        kPoints_PointMode,  //!< draw each point separately
+        kLines_PointMode,   //!< draw each pair of points as a line segment
+        kPolygon_PointMode, //!< draw the array of points as a open polygon
     };
 
-    /** Draw pts using clip, SkMatrix and SkPaint paint.
+    /** Draws pts using clip, SkMatrix and SkPaint paint.
         count is the number of points; if count is less than one, has no effect.
         mode may be one of: kPoints_PointMode, kLines_PointMode, or kPolygon_PointMode.
 
         If mode is kPoints_PointMode, the shape of point drawn depends on paint
         SkPaint::Cap. If paint is set to SkPaint::kRound_Cap, each point draws a
         circle of diameter SkPaint stroke width. If paint is set to SkPaint::kSquare_Cap
         or SkPaint::kButt_Cap, each point draws a square of width and height
         SkPaint stroke width.
@@ -1133,31 +1113,31 @@ public:
 
         @param mode   whether pts draws points or lines
         @param count  number of points in the array
         @param pts    array of points to draw
         @param paint  stroke, blend, color, and so on, used to draw
     */
     void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint);
 
-    /** Draw point at (x, y) using clip, SkMatrix and SkPaint paint.
+    /** Draws point at (x, y) using clip, SkMatrix and SkPaint paint.
 
         The shape of point drawn depends on paint SkPaint::Cap.
         If paint is set to SkPaint::kRound_Cap, draw a circle of diameter
         SkPaint stroke width. If paint is set to SkPaint::kSquare_Cap or SkPaint::kButt_Cap,
         draw a square of width and height SkPaint stroke width.
         SkPaint::Style is ignored, as if were set to SkPaint::kStroke_Style.
 
         @param x      left edge of circle or square
         @param y      top edge of circle or square
         @param paint  stroke, blend, color, and so on, used to draw
     */
     void drawPoint(SkScalar x, SkScalar y, const SkPaint& paint);
 
-    /** Draw point p using clip, SkMatrix and SkPaint paint.
+    /** Draws point p using clip, SkMatrix and SkPaint paint.
 
         The shape of point drawn depends on paint SkPaint::Cap.
         If paint is set to SkPaint::kRound_Cap, draw a circle of diameter
         SkPaint stroke width. If paint is set to SkPaint::kSquare_Cap or SkPaint::kButt_Cap,
         draw a square of width and height SkPaint stroke width.
         SkPaint::Style is ignored, as if were set to SkPaint::kStroke_Style.
 
         @param p      top-left edge of circle or square
@@ -1188,72 +1168,72 @@ public:
         @param p0     start of line segment
         @param p1     end of line segment
         @param paint  stroke, blend, color, and so on, used to draw
     */
     void drawLine(SkPoint p0, SkPoint p1, const SkPaint& paint) {
         this->drawLine(p0.x(), p0.y(), p1.x(), p1.y(), paint);
     }
 
-    /** Draw SkRect rect using clip, SkMatrix, and SkPaint paint.
+    /** Draws SkRect rect using clip, SkMatrix, and SkPaint paint.
         In paint: SkPaint::Style determines if rectangle is stroked or filled;
         if stroked, SkPaint stroke width describes the line thickness, and
         SkPaint::Join draws the corners rounded or square.
 
         @param rect   rectangle to draw
         @param paint  stroke or fill, blend, color, and so on, used to draw
     */
     void drawRect(const SkRect& rect, const SkPaint& paint);
 
-    /** Draw SkIRect rect using clip, SkMatrix, and SkPaint paint.
+    /** Draws SkIRect rect using clip, SkMatrix, and SkPaint paint.
         In paint: SkPaint::Style determines if rectangle is stroked or filled;
         if stroked, SkPaint stroke width describes the line thickness, and
         SkPaint::Join draws the corners rounded or square.
 
         @param rect   rectangle to draw
         @param paint  stroke or fill, blend, color, and so on, used to draw
     */
     void drawIRect(const SkIRect& rect, const SkPaint& paint) {
         SkRect r;
         r.set(rect);    // promotes the ints to scalars
         this->drawRect(r, paint);
     }
 
-    /** Draw SkRegion region using clip, SkMatrix, and SkPaint paint.
+    /** Draws SkRegion region using clip, SkMatrix, and SkPaint paint.
         In paint: SkPaint::Style determines if rectangle is stroked or filled;
         if stroked, SkPaint stroke width describes the line thickness, and
         SkPaint::Join draws the corners rounded or square.
 
         @param region  region to draw
         @param paint   SkPaint stroke or fill, blend, color, and so on, used to draw
     */
     void drawRegion(const SkRegion& region, const SkPaint& paint);
 
-    /** Draw oval oval using clip, SkMatrix, and SkPaint.
+    /** Draws oval oval using clip, SkMatrix, and SkPaint.
         In paint: SkPaint::Style determines if oval is stroked or filled;
         if stroked, SkPaint stroke width describes the line thickness.
 
         @param oval   SkRect bounds of oval
         @param paint  SkPaint stroke or fill, blend, color, and so on, used to draw
     */
     void drawOval(const SkRect& oval, const SkPaint& paint);
 
-    /** Draw SkRRect rrect using clip, SkMatrix, and SkPaint paint.
+    /** Draws SkRRect rrect using clip, SkMatrix, and SkPaint paint.
         In paint: SkPaint::Style determines if rrect is stroked or filled;
         if stroked, SkPaint stroke width describes the line thickness.
 
         rrect may represent a rectangle, circle, oval, uniformly rounded rectangle, or
         may have any combination of positive non-square radii for the four corners.
 
         @param rrect  SkRRect with up to eight corner radii to draw
         @param paint  SkPaint stroke or fill, blend, color, and so on, used to draw
     */
     void drawRRect(const SkRRect& rrect, const SkPaint& paint);
 
-    /** Draw SkRRect outer and inner
+    /** Draws SkRRect outer and inner
         using clip, SkMatrix, and SkPaint paint.
         outer must contain inner or the drawing is undefined.
         In paint: SkPaint::Style determines if SkRRect is stroked or filled;
         if stroked, SkPaint stroke width describes the line thickness.
         If stroked and SkRRect corner has zero length radii, SkPaint::Join can
         draw corners rounded or square.
 
         GPU-backed platforms optimize drawing when both outer and inner are
@@ -1261,42 +1241,42 @@ public:
         SkPath built with identical data as fast.
 
         @param outer  SkRRect outer bounds to draw
         @param inner  SkRRect inner bounds to draw
         @param paint  SkPaint stroke or fill, blend, color, and so on, used to draw
     */
     void drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint);
 
-    /** Draw circle at (cx, cy) with radius using clip, SkMatrix, and SkPaint paint.
+    /** Draws circle at (cx, cy) with radius using clip, SkMatrix, and SkPaint paint.
         If radius is zero or less, nothing is drawn.
         In paint: SkPaint::Style determines if circle is stroked or filled;
         if stroked, SkPaint stroke width describes the line thickness.
 
         @param cx      circle center on the x-axis
         @param cy      circle center on the y-axis
         @param radius  half the diameter of circle
         @param paint   SkPaint stroke or fill, blend, color, and so on, used to draw
     */
     void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint& paint);
 
-    /** Draw circle at center with radius using clip, SkMatrix, and SkPaint paint.
+    /** Draws circle at center with radius using clip, SkMatrix, and SkPaint paint.
         If radius is zero or less, nothing is drawn.
         In paint: SkPaint::Style determines if circle is stroked or filled;
         if stroked, SkPaint stroke width describes the line thickness.
 
         @param center  circle center
         @param radius  half the diameter of circle
         @param paint   SkPaint stroke or fill, blend, color, and so on, used to draw
     */
     void drawCircle(SkPoint center, SkScalar radius, const SkPaint& paint) {
         this->drawCircle(center.x(), center.y(), radius, paint);
     }
 
-    /** Draw arc using clip, SkMatrix, and SkPaint paint.
+    /** Draws arc using clip, SkMatrix, and SkPaint paint.
 
         Arc is part of oval bounded by oval, sweeping from startAngle to startAngle plus
         sweepAngle. startAngle and sweepAngle are in degrees.
 
         startAngle of zero places start point at the right middle edge of oval.
         A positive sweepAngle places arc end point clockwise from start point;
         a negative sweepAngle places arc end point counterclockwise from start point.
         sweepAngle may exceed 360 degrees, a full circle.
@@ -1309,70 +1289,70 @@ public:
         @param startAngle  angle in degrees where arc begins
         @param sweepAngle  sweep angle in degrees; positive is clockwise
         @param useCenter   if true, include the center of the oval
         @param paint       SkPaint stroke or fill, blend, color, and so on, used to draw
     */
     void drawArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle,
                  bool useCenter, const SkPaint& paint);
 
-    /** Draw SkRRect bounded by SkRect rect, with corner radii (rx, ry) using clip,
+    /** Draws SkRRect bounded by SkRect rect, with corner radii (rx, ry) using clip,
         SkMatrix, and SkPaint paint.
 
         In paint: SkPaint::Style determines if SkRRect is stroked or filled;
         if stroked, SkPaint stroke width describes the line thickness.
         If rx or ry are less than zero, they are treated as if they are zero.
         If rx plus ry exceeds rect width or rect height, radii are scaled down to fit.
         If rx and ry are zero, SkRRect is drawn as SkRect and if stroked is affected by
         SkPaint::Join.
 
         @param rect   SkRect bounds of SkRRect to draw
-        @param rx     axis length in x of oval describing rounded corners
-        @param ry     axis length in y of oval describing rounded corners
+        @param rx     axis length on x-axis of oval describing rounded corners
+        @param ry     axis length on y-axis of oval describing rounded corners
         @param paint  stroke, blend, color, and so on, used to draw
     */
     void drawRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, const SkPaint& paint);
 
-    /** Draw SkPath path using clip, SkMatrix, and SkPaint paint.
+    /** Draws SkPath path using clip, SkMatrix, and SkPaint paint.
         SkPath contains an array of path contour, each of which may be open or closed.
 
         In paint: SkPaint::Style determines if SkRRect is stroked or filled:
         if filled, SkPath::FillType determines whether path contour describes inside or
         outside of fill; if stroked, SkPaint stroke width describes the line thickness,
         SkPaint::Cap describes line ends, and SkPaint::Join describes how
         corners are drawn.
 
         @param path   SkPath to draw
         @param paint  stroke, blend, color, and so on, used to draw
     */
     void drawPath(const SkPath& path, const SkPaint& paint);
 
-    /** Draw SkImage image, with its top-left corner at (left, top),
+    /** Draws SkImage image, with its top-left corner at (left, top),
         using clip, SkMatrix, and optional SkPaint paint.
 
-        If paint is supplied, apply SkColorFilter, color alpha, SkImageFilter, SkBlendMode,
+        If paint is supplied, apply SkColorFilter, alpha, SkImageFilter, SkBlendMode,
         and SkDrawLooper. If image is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from image bounds. If generated
         mask extends beyond image bounds, replicate image edge colors, just as SkShader
         made from SkImage::makeShader with SkShader::kClamp_TileMode set replicates the
         image edge color when it samples outside of its bounds.
 
         @param image  uncompressed rectangular map of pixels
         @param left   left side of image
         @param top    top side of image
         @param paint  SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                       and so on; or nullptr
     */
     void drawImage(const SkImage* image, SkScalar left, SkScalar top,
                    const SkPaint* paint = nullptr);
 
-    /** Draw SkImage image, with its top-left corner at (left, top),
+    /** Draws SkImage image, with its top-left corner at (left, top),
         using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If image is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from image bounds. If generated
         mask extends beyond image bounds, replicate image edge colors, just as SkShader
         made from SkImage::makeShader with SkShader::kClamp_TileMode set replicates the
         image edge color when it samples outside of its bounds.
 
         @param image  uncompressed rectangular map of pixels
         @param left   left side of image
@@ -1391,29 +1371,24 @@ public:
 
         SkImageFilter in SkPaint may sample multiple pixels in the image. Source SkRect
         restricts the bounds of pixels that may be read. SkImageFilter may slow down if
         it cannot read outside the bounds, when sampling near the edge of source SkRect.
         SrcRectConstraint specifies whether an SkImageFilter is allowed to read pixels
         outside source SkRect.
     */
     enum SrcRectConstraint {
-        /** sampling only inside of its bounds, possibly with a performance penalty. */
-        kStrict_SrcRectConstraint,
-
-        /** by half the width of SkImageFilter, permitting it to run faster but with
-            error at the image edges.
-        */
-        kFast_SrcRectConstraint,
+        kStrict_SrcRectConstraint, //!< sample only inside bounds; slower
+        kFast_SrcRectConstraint,   //!< sample outside bounds; faster
     };
 
-    /** Draw SkRect src of SkImage image, scaled and translated to fill SkRect dst.
+    /** Draws SkRect src of SkImage image, scaled and translated to fill SkRect dst.
         Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If image is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from image bounds.
 
         If generated mask extends beyond image bounds, replicate image edge colors, just
         as SkShader made from SkImage::makeShader with SkShader::kClamp_TileMode set
         replicates the image edge color when it samples outside of its bounds.
 
         constraint set to kStrict_SrcRectConstraint limits SkPaint SkFilterQuality to
@@ -1426,22 +1401,22 @@ public:
         @param paint       SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                            and so on; or nullptr
         @param constraint  filter strictly within src or draw faster
     */
     void drawImageRect(const SkImage* image, const SkRect& src, const SkRect& dst,
                        const SkPaint* paint,
                        SrcRectConstraint constraint = kStrict_SrcRectConstraint);
 
-    /** Draw SkIRect isrc of SkImage image, scaled and translated to fill SkRect dst.
+    /** Draws SkIRect isrc of SkImage image, scaled and translated to fill SkRect dst.
         Note that isrc is on integer pixel boundaries; dst may include fractional
         boundaries. Additionally transform draw using clip, SkMatrix, and optional SkPaint
         paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If image is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from image bounds.
 
         If generated mask extends beyond image bounds, replicate image edge colors, just
         as SkShader made from SkImage::makeShader with SkShader::kClamp_TileMode set
         replicates the image edge color when it samples outside of its bounds.
 
         constraint set to kStrict_SrcRectConstraint limits SkPaint SkFilterQuality to
@@ -1454,20 +1429,20 @@ public:
         @param paint       SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                            and so on; or nullptr
         @param constraint  filter strictly within isrc or draw faster
     */
     void drawImageRect(const SkImage* image, const SkIRect& isrc, const SkRect& dst,
                        const SkPaint* paint,
                        SrcRectConstraint constraint = kStrict_SrcRectConstraint);
 
-    /** Draw SkImage image, scaled and translated to fill SkRect dst, using clip, SkMatrix,
+    /** Draws SkImage image, scaled and translated to fill SkRect dst, using clip, SkMatrix,
         and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If image is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from image bounds.
 
         If generated mask extends beyond image bounds, replicate image edge colors, just
         as SkShader made from SkImage::makeShader with SkShader::kClamp_TileMode set
         replicates the image edge color when it samples outside of its bounds.
 
         constraint set to kStrict_SrcRectConstraint limits SkPaint SkFilterQuality to
@@ -1478,20 +1453,20 @@ public:
         @param dst         destination SkRect of image to draw to
         @param paint       SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                            and so on; or nullptr
         @param constraint  filter strictly within image or draw faster
     */
     void drawImageRect(const SkImage* image, const SkRect& dst, const SkPaint* paint,
                        SrcRectConstraint constraint = kStrict_SrcRectConstraint);
 
-    /** Draw SkRect src of SkImage image, scaled and translated to fill SkRect dst.
+    /** Draws SkRect src of SkImage image, scaled and translated to fill SkRect dst.
         Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If image is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from image bounds.
 
         If generated mask extends beyond image bounds, replicate image edge colors, just
         as SkShader made from SkImage::makeShader with SkShader::kClamp_TileMode set
         replicates the image edge color when it samples outside of its bounds.
 
         constraint set to kStrict_SrcRectConstraint limits SkPaint SkFilterQuality to
@@ -1506,21 +1481,21 @@ public:
         @param constraint  filter strictly within src or draw faster
     */
     void drawImageRect(const sk_sp<SkImage>& image, const SkRect& src, const SkRect& dst,
                        const SkPaint* paint,
                        SrcRectConstraint constraint = kStrict_SrcRectConstraint) {
         this->drawImageRect(image.get(), src, dst, paint, constraint);
     }
 
-    /** Draw SkIRect isrc of SkImage image, scaled and translated to fill SkRect dst.
+    /** Draws SkIRect isrc of SkImage image, scaled and translated to fill SkRect dst.
         isrc is on integer pixel boundaries; dst may include fractional boundaries.
         Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If image is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from image bounds.
 
         If generated mask extends beyond image bounds, replicate image edge colors, just
         as SkShader made from SkImage::makeShader with SkShader::kClamp_TileMode set
         replicates the image edge color when it samples outside of its bounds.
 
         constraint set to kStrict_SrcRectConstraint limits SkPaint SkFilterQuality to
@@ -1535,20 +1510,20 @@ public:
         @param constraint  filter strictly within image or draw faster
     */
     void drawImageRect(const sk_sp<SkImage>& image, const SkIRect& isrc, const SkRect& dst,
                        const SkPaint* paint,
                        SrcRectConstraint constraint = kStrict_SrcRectConstraint) {
         this->drawImageRect(image.get(), isrc, dst, paint, constraint);
     }
 
-    /** Draw SkImage image, scaled and translated to fill SkRect dst,
+    /** Draws SkImage image, scaled and translated to fill SkRect dst,
         using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If image is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from image bounds.
 
         If generated mask extends beyond image bounds, replicate image edge colors, just
         as SkShader made from SkImage::makeShader with SkShader::kClamp_TileMode set
         replicates the image edge color when it samples outside of its bounds.
 
         constraint set to kStrict_SrcRectConstraint limits SkPaint SkFilterQuality to
@@ -1561,70 +1536,76 @@ public:
                            and so on; or nullptr
         @param constraint  filter strictly within image or draw faster
     */
     void drawImageRect(const sk_sp<SkImage>& image, const SkRect& dst, const SkPaint* paint,
                        SrcRectConstraint constraint = kStrict_SrcRectConstraint) {
         this->drawImageRect(image.get(), dst, paint, constraint);
     }
 
-    /** Draw SkImage image stretched proportionally to fit into SkRect dst.
+    /** Draws SkImage image stretched proportionally to fit into SkRect dst.
         SkIRect center divides the image into nine sections: four sides, four corners, and
         the center. Corners are unmodified or scaled down proportionately if their sides
         are larger than dst; center and four sides are scaled to fit remaining space, if any.
 
         Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If image is kAlpha_8_SkColorType, apply SkShader.
-        If paint contains SkMaskFilter, generate mask from image bounds.
+        If paint contains SkMaskFilter, generate mask from image bounds. If paint
+        SkFilterQuality set to kNone_SkFilterQuality, disable pixel filtering. For all
+        other values of paint SkFilterQuality, use kLow_SkFilterQuality to filter pixels.
+        Any SkMaskFilter on paint is ignored as is paint anti-aliasing state.
 
         If generated mask extends beyond image bounds, replicate image edge colors, just
         as SkShader made from SkImage::makeShader with SkShader::kClamp_TileMode set
         replicates the image edge color when it samples outside of its bounds.
 
         @param image   SkImage containing pixels, dimensions, and format
         @param center  SkIRect edge of image corners and sides
         @param dst     destination SkRect of image to draw to
         @param paint   SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                        and so on; or nullptr
     */
     void drawImageNine(const SkImage* image, const SkIRect& center, const SkRect& dst,
                        const SkPaint* paint = nullptr);
 
-    /** Draw SkImage image stretched proportionally to fit into SkRect dst.
+    /** Draws SkImage image stretched proportionally to fit into SkRect dst.
         SkIRect center divides the image into nine sections: four sides, four corners, and
         the center. Corners are not scaled, or scaled down proportionately if their sides
         are larger than dst; center and four sides are scaled to fit remaining space, if any.
 
         Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If image is kAlpha_8_SkColorType, apply SkShader.
-        If paint contains SkMaskFilter, generate mask from image bounds.
+        If paint contains SkMaskFilter, generate mask from image bounds. If paint
+        SkFilterQuality set to kNone_SkFilterQuality, disable pixel filtering. For all
+        other values of paint SkFilterQuality, use kLow_SkFilterQuality to filter pixels.
+        Any SkMaskFilter on paint is ignored as is paint anti-aliasing state.
 
         If generated mask extends beyond image bounds, replicate image edge colors, just
         as SkShader made from SkImage::makeShader with SkShader::kClamp_TileMode set
         replicates the image edge color when it samples outside of its bounds.
 
         @param image   SkImage containing pixels, dimensions, and format
         @param center  SkIRect edge of image corners and sides
         @param dst     destination SkRect of image to draw to
         @param paint   SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                        and so on; or nullptr
     */
     void drawImageNine(const sk_sp<SkImage>& image, const SkIRect& center, const SkRect& dst,
                        const SkPaint* paint = nullptr) {
         this->drawImageNine(image.get(), center, dst, paint);
     }
 
-    /** Draw SkBitmap bitmap, with its top-left corner at (left, top),
+    /** Draws SkBitmap bitmap, with its top-left corner at (left, top),
         using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is not nullptr, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is not nullptr, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from bitmap bounds.
 
         If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
         just as SkShader made from SkShader::MakeBitmapShader with
         SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
         outside of its bounds.
 
@@ -1632,20 +1613,20 @@ public:
         @param left    left side of bitmap
         @param top     top side of bitmap
         @param paint   SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                        and so on; or nullptr
     */
     void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
                     const SkPaint* paint = nullptr);
 
-    /** Draw SkRect src of SkBitmap bitmap, scaled and translated to fill SkRect dst.
+    /** Draws SkRect src of SkBitmap bitmap, scaled and translated to fill SkRect dst.
         Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from bitmap bounds.
 
         If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
         just as SkShader made from SkShader::MakeBitmapShader with
         SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
         outside of its bounds.
 
@@ -1659,21 +1640,21 @@ public:
         @param paint       SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                            and so on; or nullptr
         @param constraint  filter strictly within src or draw faster
     */
     void drawBitmapRect(const SkBitmap& bitmap, const SkRect& src, const SkRect& dst,
                         const SkPaint* paint,
                         SrcRectConstraint constraint = kStrict_SrcRectConstraint);
 
-    /** Draw SkIRect isrc of SkBitmap bitmap, scaled and translated to fill SkRect dst.
+    /** Draws SkIRect isrc of SkBitmap bitmap, scaled and translated to fill SkRect dst.
         isrc is on integer pixel boundaries; dst may include fractional boundaries.
         Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from bitmap bounds.
 
         If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
         just as SkShader made from SkShader::MakeBitmapShader with
         SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
         outside of its bounds.
 
@@ -1687,21 +1668,21 @@ public:
         @param paint       SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                            and so on; or nullptr
         @param constraint  sample strictly within isrc, or draw faster
     */
     void drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, const SkRect& dst,
                         const SkPaint* paint,
                         SrcRectConstraint constraint = kStrict_SrcRectConstraint);
 
-    /** Draw SkBitmap bitmap, scaled and translated to fill SkRect dst.
+    /** Draws SkBitmap bitmap, scaled and translated to fill SkRect dst.
         bitmap bounds is on integer pixel boundaries; dst may include fractional boundaries.
         Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
         If paint contains SkMaskFilter, generate mask from bitmap bounds.
 
         If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
         just as SkShader made from SkShader::MakeBitmapShader with
         SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
         outside of its bounds.
 
@@ -1713,27 +1694,30 @@ public:
         @param dst         destination SkRect of image to draw to
         @param paint       SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                            and so on; or nullptr
         @param constraint  filter strictly within bitmap or draw faster
     */
     void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, const SkPaint* paint,
                         SrcRectConstraint constraint = kStrict_SrcRectConstraint);
 
-    /** Draw SkBitmap bitmap stretched proportionally to fit into SkRect dst.
+    /** Draws SkBitmap bitmap stretched proportionally to fit into SkRect dst.
         SkIRect center divides the bitmap into nine sections: four sides, four corners,
         and the center. Corners are not scaled, or scaled down proportionately if their
         sides are larger than dst; center and four sides are scaled to fit remaining
         space, if any.
 
         Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
-        If paint contains SkMaskFilter, generate mask from bitmap bounds.
+        If paint contains SkMaskFilter, generate mask from bitmap bounds. If paint
+        SkFilterQuality set to kNone_SkFilterQuality, disable pixel filtering. For all
+        other values of paint SkFilterQuality, use kLow_SkFilterQuality to filter pixels.
+        Any SkMaskFilter on paint is ignored as is paint anti-aliasing state.
 
         If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
         just as SkShader made from SkShader::MakeBitmapShader with
         SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
         outside of its bounds.
 
         @param bitmap  SkBitmap containing pixels, dimensions, and format
         @param center  SkIRect edge of image corners and sides
@@ -1755,129 +1739,93 @@ public:
     */
     struct Lattice {
 
         /** \enum SkCanvas::Lattice::RectType
             Optional setting per rectangular grid entry to make it transparent,
             or to fill the grid entry with a color.
         */
         enum RectType : uint8_t {
-            kDefault     = 0, //!< Draws SkBitmap into lattice rectangle.
-            kTransparent,     //!< Skips lattice rectangle by making it transparent.
-            kFixedColor,      //!< Draws one of fColors into lattice rectangle.
+            kDefault     = 0, //!< draws SkBitmap into lattice rectangle
+            kTransparent,     //!< skips lattice rectangle by making it transparent
+            kFixedColor,      //!< draws one of fColors into lattice rectangle
         };
 
-        /** Array of x-coordinates that divide the bitmap vertically.
-            Array entries must be unique, increasing, greater than or equal to
-            fBounds left edge, and less than fBounds right edge.
-            Set the first element to fBounds left to collapse the left column of
-            fixed grid entries.
-        */
-        const int*      fXDivs;
-
-        /** Array of y-coordinates that divide the bitmap horizontally.
-            Array entries must be unique, increasing, greater than or equal to
-            fBounds top edge, and less than fBounds bottom edge.
-            Set the first element to fBounds top to collapse the top row of fixed
-            grid entries.
-        */
-        const int*      fYDivs;
-
-        /** Optional array of fill types, one per rectangular grid entry:
-            array length must be (fXCount + 1) * (fYCount + 1).
-
-            Each RectType is one of: kDefault, kTransparent, kFixedColor.
-
-            Array entries correspond to the rectangular grid entries, ascending
-            left to right and then top to bottom.
-        */
-        const RectType* fRectTypes;
-
-        /** Number of entries in fXDivs array; one less than the number of
-            horizontal divisions.
-        */
-        int             fXCount;
-
-        /** Number of entries in fYDivs array; one less than the number of vertical
-            divisions.
-        */
-        int             fYCount;
-
-        /** Optional subset SkIRect source to draw from.
-            If nullptr, source bounds is dimensions of SkBitmap or SkImage.
-        */
-        const SkIRect*  fBounds;
-
-        /** Optional array of colors, one per rectangular grid entry.
-            Array length must be (fXCount + 1) * (fYCount + 1).
-
-            Array entries correspond to the rectangular grid entries, ascending
-            left to right, then top to bottom.
-        */
-        const SkColor*  fColors;
-
+        const int*      fXDivs;     //!< x-axis values dividing bitmap
+        const int*      fYDivs;     //!< y-axis values dividing bitmap
+        const RectType* fRectTypes; //!< array of fill types
+        int             fXCount;    //!< number of x-coordinates
+        int             fYCount;    //!< number of y-coordinates
+        const SkIRect*  fBounds;    //!< source bounds to draw from
+        const SkColor*  fColors;    //!< array of colors
     };
 
-    /** Draw SkBitmap bitmap stretched proportionally to fit into SkRect dst.
+    /** Draws SkBitmap bitmap stretched proportionally to fit into SkRect dst.
 
         SkCanvas::Lattice lattice divides bitmap into a rectangular grid.
         Each intersection of an even-numbered row and column is fixed; like the corners
         of drawBitmapNine(), fixed lattice elements never scale larger than their initial
         size and shrink proportionately when all fixed elements exceed the bitmap
         dimension. All other grid elements scale to fill the available space, if any.
 
         Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
         SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
-        If paint contains SkMaskFilter, generate mask from bitmap bounds.
+        If paint contains SkMaskFilter, generate mask from bitmap bounds. If paint
+        SkFilterQuality set to kNone_SkFilterQuality, disable pixel filtering. For all
+        other values of paint SkFilterQuality, use kLow_SkFilterQuality to filter pixels.
+        Any SkMaskFilter on paint is ignored as is paint anti-aliasing state.
 
         If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
         just as SkShader made from SkShader::MakeBitmapShader with
         SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
         outside of its bounds.
 
         @param bitmap   SkBitmap containing pixels, dimensions, and format
         @param lattice  division of bitmap into fixed and variable rectangles
         @param dst      destination SkRect of image to draw to
         @param paint    SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                         and so on; or nullptr
     */
     void drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice, const SkRect& dst,
                            const SkPaint* paint = nullptr);
 
-    /** Draw SkImage image stretched proportionally to fit into SkRect dst.
+    /** Draws SkImage image stretched proportionally to fit into SkRect dst.
 
         SkCanvas::Lattice lattice divides image into a rectangular grid.
         Each intersection of an even-numbered row and column is fixed; like the corners
         of drawBitmapNine(), fixed lattice elements never scale larger than their initial
         size and shrink proportionately when all fixed elements exceed the bitmap
         dimension. All other grid elements scale to fill the available space, if any.
 
         Additionally transform draw using clip, SkMatrix, and optional SkPaint paint.
 
-        If SkPaint paint is supplied, apply SkColorFilter, color alpha, SkImageFilter,
-        SkBlendMode, and SkDrawLooper. If bitmap is kAlpha_8_SkColorType, apply SkShader.
-        If paint contains SkMaskFilter, generate mask from bitmap bounds.
+        If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter,
+        SkBlendMode, and SkDrawLooper. If image is kAlpha_8_SkColorType, apply SkShader.
+        If paint contains SkMaskFilter, generate mask from image bounds. If paint
+        SkFilterQuality set to kNone_SkFilterQuality, disable pixel filtering. For all
+        other values of paint SkFilterQuality, use kLow_SkFilterQuality to filter pixels.
+        Any SkMaskFilter on paint is ignored as is paint anti-aliasing state.
 
         If generated mask extends beyond bitmap bounds, replicate bitmap edge colors,
         just as SkShader made from SkShader::MakeBitmapShader with
         SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples
         outside of its bounds.
 
         @param image    SkImage containing pixels, dimensions, and format
         @param lattice  division of bitmap into fixed and variable rectangles
         @param dst      destination SkRect of image to draw to
         @param paint    SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter,
                         and so on; or nullptr
     */
     void drawImageLattice(const SkImage* image, const Lattice& lattice, const SkRect& dst,
                           const SkPaint* paint = nullptr);
 
-    /** Draw text, with origin at (x, y), using clip, SkMatrix, and SkPaint paint.
+    /** Draws text, with origin at (x, y), using clip, SkMatrix, and SkPaint paint.
 
         text meaning depends on SkPaint::TextEncoding; by default, text is encoded as
         UTF-8.
 
         x and y meaning depends on SkPaint::Align and SkPaint vertical text; by default
         text draws left to right, positioning the first glyph left side bearing at x
         and its baseline at y. Text size is affected by SkMatrix and SkPaint text size.
 
@@ -1889,17 +1837,17 @@ public:
         @param byteLength  byte length of text array
         @param x           start of text on x-axis
         @param y           start of text on y-axis
         @param paint       text size, blend, color, and so on, used to draw
     */
     void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
                   const SkPaint& paint);
 
-    /** Draw null terminated string, with origin at (x, y), using clip, SkMatrix, and
+    /** Draws null terminated string, with origin at (x, y), using clip, SkMatrix, and
         SkPaint paint.
 
         string meaning depends on SkPaint::TextEncoding; by default, strings are encoded
         as UTF-8. Other values of SkPaint::TextEncoding are unlikely to produce the desired
         results, since zero bytes may be embedded in the string.
 
         x and y meaning depends on SkPaint::Align and SkPaint vertical text; by default
         string draws left to right, positioning the first glyph left side bearing at x
@@ -1917,17 +1865,17 @@ public:
     */
     void drawString(const char* string, SkScalar x, SkScalar y, const SkPaint& paint) {
         if (!string) {
             return;
         }
         this->drawText(string, strlen(string), x, y, paint);
     }
 
-    /** Draw null terminated string, with origin at (x, y), using clip, SkMatrix, and
+    /** Draws null terminated string, with origin at (x, y), using clip, SkMatrix, and
         SkPaint paint.
 
         string meaning depends on SkPaint::TextEncoding; by default, strings are encoded
         as UTF-8. Other values of SkPaint::TextEncoding are unlikely to produce the desired
         results, since zero bytes may be embedded in the string.
 
         x and y meaning depends on SkPaint::Align and SkPaint vertical text; by default
         string draws left to right, positioning the first glyph left side bearing at x
@@ -1940,127 +1888,72 @@ public:
         @param string  character code points or glyphs drawn,
                        ending with a char value of zero
         @param x       start of string on x-axis
         @param y       start of string on y-axis
         @param paint   text size, blend, color, and so on, used to draw
     */
     void drawString(const SkString& string, SkScalar x, SkScalar y, const SkPaint& paint);
 
-    /** Draw each glyph in text with the origin in pos array, using clip, SkMatrix, and
+    /** Draws each glyph in text with the origin in pos array, using clip, SkMatrix, and
         SkPaint paint. The number of entries in pos array must match the number of glyphs
         described by byteLength of text.
 
         text meaning depends on SkPaint::TextEncoding; by default, text is encoded as
-        UTF-8. pos elements' meaning depends on SkPaint::Align and SkPaint vertical text;
-        by default each glyph left side bearing is positioned at x and its
-        baseline is positioned at y. Text size is affected by SkMatrix and
-        SkPaint text size.
+        UTF-8. pos elements meaning depends on SkPaint vertical text; by default
+        glyph left side bearing and baseline are relative to SkPoint in pos array.
+        Text size is affected by SkMatrix and SkPaint text size.
 
         All elements of paint: SkPathEffect, SkMaskFilter, SkShader,
         SkColorFilter, SkImageFilter, and SkDrawLooper; apply to text. By default, draws
         filled 12 point black glyphs.
 
         Layout engines such as Harfbuzz typically position each glyph
         rather than using the font advance widths.
 
         @param text        character code points or glyphs drawn
         @param byteLength  byte length of text array
         @param pos         array of glyph origins
         @param paint       text size, blend, color, and so on, used to draw
     */
     void drawPosText(const void* text, size_t byteLength, const SkPoint pos[],
                      const SkPaint& paint);
 
-    /** Draw each glyph in text with its (x, y) origin composed from xpos array and
+    /** Draws each glyph in text with its (x, y) origin composed from xpos array and
         constY, using clip, SkMatrix, and SkPaint paint. The number of entries in xpos array
         must match the number of glyphs described by byteLength of text.
 
         text meaning depends on SkPaint::TextEncoding; by default, text is encoded as
-        UTF-8. xpos elements' meaning depends on SkPaint::Align and SkPaint vertical text;
+        UTF-8. xpos elements meaning depends on SkPaint vertical text;
         by default each glyph left side bearing is positioned at an xpos element and
         its baseline is positioned at constY. Text size is affected by SkMatrix and
         SkPaint text size.
 
         All elements of paint: SkPathEffect, SkMaskFilter, SkShader,
         SkColorFilter, SkImageFilter, and SkDrawLooper; apply to text. By default, draws
         filled 12 point black glyphs.
 
         Layout engines such as Harfbuzz typically position each glyph
         rather than using the font advance widths if all glyphs share the same
         baseline.
 
         @param text        character code points or glyphs drawn
         @param byteLength  byte length of text array
-        @param xpos        array of x positions, used to position each glyph
-        @param constY      shared y coordinate for all of x positions
+        @param xpos        array of x-axis positions, used to position each glyph
+        @param constY      shared y-axis value for all of x-axis positions
         @param paint       text size, blend, color, and so on, used to draw
     */
     void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY,
                       const SkPaint& paint);
 
-    /** Draw text on SkPath path, using clip, SkMatrix, and SkPaint paint.
-
-        Origin of text is at distance hOffset along the path, offset by a perpendicular
-        vector of length vOffset. If the path section corresponding the glyph advance is
-        curved, the glyph is drawn curved to match; control points in the glyph are
-        mapped to projected points parallel to the path. If the text advance is larger
-        than the path length, the excess text is clipped.
-
-        text meaning depends on SkPaint::TextEncoding; by default, text is encoded as
-        UTF-8. Origin meaning depends on SkPaint::Align and SkPaint vertical text; by
-        default text positions the first glyph left side bearing at origin x and its
-        baseline at origin y. Text size is affected by SkMatrix and SkPaint text size.
-
-        All elements of paint: SkPathEffect, SkMaskFilter, SkShader,
-        SkColorFilter, SkImageFilter, and SkDrawLooper; apply to text. By default, draws
-        filled 12 point black glyphs.
-
-        @param text        character code points or glyphs drawn
-        @param byteLength  byte length of text array
-        @param path        SkPath providing text baseline
-        @param hOffset     distance along path to offset origin
-        @param vOffset     offset of text above (if negative) or below (if positive) the path
-        @param paint       text size, blend, color, and so on, used to draw
-    */
-    void drawTextOnPathHV(const void* text, size_t byteLength, const SkPath& path, SkScalar hOffset,
-                          SkScalar vOffset, const SkPaint& paint);
-
-    /** Draw text on SkPath path, using clip, SkMatrix, and SkPaint paint.
-
-        Origin of text is at beginning of path offset by matrix, if provided, before it
-        is mapped to path. If the path section corresponding the glyph advance is
-        curved, the glyph is drawn curved to match; control points in the glyph are
-        mapped to projected points parallel to the path. If the text advance is larger
-        than the path length, the excess text is clipped.
-
-        text meaning depends on SkPaint::TextEncoding; by default, text is encoded as
-        UTF-8. Origin meaning depends on SkPaint::Align and SkPaint vertical text; by
-        default text positions the first glyph left side bearing at origin x and its
-        baseline at origin y. Text size is affected by SkMatrix and SkPaint text size.
-
-        All elements of paint: SkPathEffect, SkMaskFilter, SkShader,
-        SkColorFilter, SkImageFilter, and SkDrawLooper; apply to text. By default, draws
-        filled 12 point black glyphs.
-
-        @param text        character code points or glyphs drawn
-        @param byteLength  byte length of text array
-        @param path        SkPath providing text baseline
-        @param matrix      transform of glyphs before mapping to path; may be nullptr
-                           to use identity SkMatrix
-        @param paint       text size, blend, color, and so on, used to draw
-    */
-    void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
-                        const SkMatrix* matrix, const SkPaint& paint);
-
-    /** Draw text, transforming each glyph by the corresponding SkRSXform,
+    /** Draws text, transforming each glyph by the corresponding SkRSXform,
         using clip, SkMatrix, and SkPaint paint.
 
-        SkRSXform array specifies a separate square scale, rotation, and translation for
-        each glyph.
+        SkRSXform xform array specifies a separate square scale, rotation, and translation
+        for each glyph. xform does not affect paint SkShader.
 
         Optional SkRect cullRect is a conservative bounds of text, taking into account
         SkRSXform and paint. If cullRect is outside of clip, canvas can skip drawing.
 
         All elements of paint: SkPathEffect, SkMaskFilter, SkShader,
         SkColorFilter, SkImageFilter, and SkDrawLooper; apply to text. By default, draws
         filled 12 point black glyphs.
 
@@ -2068,136 +1961,176 @@ public:
         @param byteLength  byte length of text array
         @param xform       SkRSXform rotates, scales, and translates each glyph individually
         @param cullRect    SkRect bounds of text for efficient clipping; or nullptr
         @param paint       text size, blend, color, and so on, used to draw
     */
     void drawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[],
                          const SkRect* cullRect, const SkPaint& paint);
 
-    /** Draw SkTextBlob blob at (x, y), using clip, SkMatrix, and SkPaint paint.
+    /** Draws SkTextBlob blob at (x, y), using clip, SkMatrix, and SkPaint paint.
 
         blob contains glyphs, their positions, and paint attributes specific to text:
-        SkTypeface, SkPaint text size, SkPaint text scale x, SkPaint text skew x,
-        SkPaint::Align, SkPaint::Hinting, SkPaint anti-alias, SkPaint fake bold,
+        SkTypeface, SkPaint text size, SkPaint text scale x,
+        SkPaint text skew x, SkPaint::Align, SkPaint::Hinting, anti-alias, SkPaint fake bold,
         SkPaint font embedded bitmaps, SkPaint full hinting spacing, LCD text, SkPaint linear text,
-        SkPaint subpixel text, and SkPaint vertical text.
+        and SkPaint subpixel text.
 
         SkPaint::TextEncoding must be set to SkPaint::kGlyphID_TextEncoding.
 
-        Elements of paint: SkPathEffect, SkMaskFilter, SkShader, SkColorFilter,
-        SkImageFilter, and SkDrawLooper; apply to blob.
+        Elements of paint: anti-alias, SkBlendMode, color including alpha,
+        SkColorFilter, SkPaint dither, SkDrawLooper, SkMaskFilter, SkPathEffect, SkShader, and
+        SkPaint::Style; apply to blob. If SkPaint contains SkPaint::kStroke_Style:
+        SkPaint miter limit, SkPaint::Cap, SkPaint::Join, and SkPaint stroke width;
+        apply to SkPath created from blob.
 
         @param blob   glyphs, positions, and their paints' text size, typeface, and so on
         @param x      horizontal offset applied to blob
         @param y      vertical offset applied to blob
         @param paint  blend, color, stroking, and so on, used to draw
     */
     void drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint);
 
-    /** Draw SkTextBlob blob at (x, y), using clip, SkMatrix, and SkPaint paint.
+    /** Draws SkTextBlob blob at (x, y), using clip, SkMatrix, and SkPaint paint.
 
         blob contains glyphs, their positions, and paint attributes specific to text:
-        SkTypeface, SkPaint text size, SkPaint text scale x, SkPaint text skew x,
-        SkPaint::Align, SkPaint::Hinting, SkPaint anti-alias, SkPaint fake bold,
+        SkTypeface, SkPaint text size, SkPaint text scale x,
+        SkPaint text skew x, SkPaint::Align, SkPaint::Hinting, anti-alias, SkPaint fake bold,
         SkPaint font embedded bitmaps, SkPaint full hinting spacing, LCD text, SkPaint linear text,
-        SkPaint subpixel text, and SkPaint vertical text.
+        and SkPaint subpixel text.
 
         SkPaint::TextEncoding must be set to SkPaint::kGlyphID_TextEncoding.
 
         Elements of paint: SkPathEffect, SkMaskFilter, SkShader, SkColorFilter,
         SkImageFilter, and SkDrawLooper; apply to blob.
 
         @param blob   glyphs, positions, and their paints' text size, typeface, and so on
         @param x      horizontal offset applied to blob
         @param y      vertical offset applied to blob
         @param paint  blend, color, stroking, and so on, used to draw
     */
     void drawTextBlob(const sk_sp<SkTextBlob>& blob, SkScalar x, SkScalar y, const SkPaint& paint) {
         this->drawTextBlob(blob.get(), x, y, paint);
     }
 
-    /** Draw SkPicture picture, using clip and SkMatrix.
+    /** Draws SkPicture picture, using clip and SkMatrix.
         Clip and SkMatrix are unchanged by picture contents, as if
         save() was called before and restore() was called after drawPicture().
 
         SkPicture records a series of draw commands for later playback.
 
         @param picture  recorded drawing commands to play
     */
     void drawPicture(const SkPicture* picture) {
         this->drawPicture(picture, nullptr, nullptr);
     }
 
-    /** Draw SkPicture picture, using clip and SkMatrix.
+    /** Draws SkPicture picture, using clip and SkMatrix.
         Clip and SkMatrix are unchanged by picture contents, as if
         save() was called before and restore() was called after drawPicture().
 
         SkPicture records a series of draw commands for later playback.
 
         @param picture  recorded drawing commands to play
     */
     void drawPicture(const sk_sp<SkPicture>& picture) {
         this->drawPicture(picture.get());
     }
 
-    /** Draw SkPicture picture, using clip and SkMatrix; transforming picture with
-        SkMatrix matrix, if provided; and use SkPaint paint color alpha, SkColorFilter,
+    /** Draws SkPicture picture, using clip and SkMatrix; transforming picture with
+        SkMatrix matrix, if provided; and use SkPaint paint alpha, SkColorFilter,
         SkImageFilter, and SkBlendMode, if provided.
 
         matrix transformation is equivalent to: save(), concat(), drawPicture(), restore().
         paint use is equivalent to: saveLayer(), drawPicture(), restore().
 
         @param picture  recorded drawing commands to play
         @param matrix   SkMatrix to rotate, scale, translate, and so on; may be nullptr
         @param paint    SkPaint to apply transparency, filtering, and so on; may be nullptr
     */
     void drawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint);
 
-    /** Draw SkPicture picture, using clip and SkMatrix; transforming picture with
-        SkMatrix matrix, if provided; and use SkPaint paint color alpha, SkColorFilter,
+    /** Draws SkPicture picture, using clip and SkMatrix; transforming picture with
+        SkMatrix matrix, if provided; and use SkPaint paint alpha, SkColorFilter,
         SkImageFilter, and SkBlendMode, if provided.
 
         matrix transformation is equivalent to: save(), concat(), drawPicture(), restore().
         paint use is equivalent to: saveLayer(), drawPicture(), restore().
 
         @param picture  recorded drawing commands to play
         @param matrix   SkMatrix to rotate, scale, translate, and so on; may be nullptr
         @param paint    SkPaint to apply transparency, filtering, and so on; may be nullptr
     */
-    void drawPicture(const sk_sp<SkPicture>& picture, const SkMatrix* matrix, const SkPaint* paint) {
+    void drawPicture(const sk_sp<SkPicture>& picture, const SkMatrix* matrix,
+                     const SkPaint* paint) {
         this->drawPicture(picture.get(), matrix, paint);
     }
 
-    /** Draw vertices vertices, a triangle mesh, using clip and SkMatrix.
+    /** Draws SkVertices vertices, a triangle mesh, using clip and SkMatrix.
+        If vertices texs and vertices colors are defined in vertices, and SkPaint paint
+        contains SkShader, SkBlendMode mode combines vertices colors with SkShader.
+
+        @param vertices  triangle mesh to draw
+        @param mode      combines vertices colors with SkShader, if both are present
+        @param paint     specifies the SkShader, used as SkVertices texture; may be nullptr
+    */
+    void drawVertices(const SkVertices* vertices, SkBlendMode mode, const SkPaint& paint);
+
+    /** Draws SkVertices vertices, a triangle mesh, using clip and SkMatrix.
         If vertices texs and vertices colors are defined in vertices, and SkPaint paint
         contains SkShader, SkBlendMode mode combines vertices colors with SkShader.
 
         @param vertices  triangle mesh to draw
         @param mode      combines vertices colors with SkShader, if both are present
-        @param paint     specifies the SkShader, used as vertices texture; may be nullptr
+        @param paint     specifies the SkShader, used as SkVertices texture, may be nullptr
     */
-    void drawVertices(const SkVertices* vertices, SkBlendMode mode, const SkPaint& paint);
-
-    /** Draw vertices vertices, a triangle mesh, using clip and SkMatrix.
+    void drawVertices(const sk_sp<SkVertices>& vertices, SkBlendMode mode, const SkPaint& paint);
+
+    /** Draws SkVertices vertices, a triangle mesh, using clip and SkMatrix. Bone data is used to
+        deform vertices with bone weights.
         If vertices texs and vertices colors are defined in vertices, and SkPaint paint
         contains SkShader, SkBlendMode mode combines vertices colors with SkShader.
-
-        @param vertices  triangle mesh to draw
-        @param mode      combines vertices colors with SkShader, if both are present
-        @param paint     specifies the SkShader, used as vertices texture, may be nullptr
+        The first element of bones should be an object to world space transformation matrix that
+        will be applied before performing mesh deformations. If no such transformation is needed,
+        it should be the identity matrix.
+        boneCount must be at most 80, and thus the size of bones should be at most 80.
+
+        @param vertices   triangle mesh to draw
+        @param bones      bone matrix data
+        @param boneCount  number of bone matrices
+        @param mode       combines vertices colors with SkShader, if both are present
+        @param paint      specifies the SkShader, used as SkVertices texture, may be nullptr
     */
-    void drawVertices(const sk_sp<SkVertices>& vertices, SkBlendMode mode, const SkPaint& paint);
-
-    /** Draws a Coons_Patch: the interpolation of four cubics with shared corners,
-        associating a color, and optionally a texture coordinate, with each corner.
-
-        Coons_Patch uses clip and SkMatrix, paint SkShader, SkColorFilter,
-        color alpha, SkImageFilter, and SkBlendMode. If SkShader is provided it is treated
-        as Coons_Patch texture; SkBlendMode mode combines color colors and SkShader if
+    void drawVertices(const SkVertices* vertices, const SkVertices::Bone bones[], int boneCount,
+                      SkBlendMode mode, const SkPaint& paint);
+
+    /** Draws SkVertices vertices, a triangle mesh, using clip and SkMatrix. Bone data is used to
+        deform vertices with bone weights.
+        If vertices texs and vertices colors are defined in vertices, and SkPaint paint
+        contains SkShader, SkBlendMode mode combines vertices colors with SkShader.
+        The first element of bones should be an object to world space transformation matrix that
+        will be applied before performing mesh deformations. If no such transformation is needed,
+        it should be the identity matrix.
+        boneCount must be at most 80, and thus the size of bones should be at most 80.
+
+        @param vertices   triangle mesh to draw
+        @param bones      bone matrix data
+        @param boneCount  number of bone matrices
+        @param mode       combines vertices colors with SkShader, if both are present
+        @param paint      specifies the SkShader, used as SkVertices texture, may be nullptr
+    */
+    void drawVertices(const sk_sp<SkVertices>& vertices, const SkVertices::Bone bones[],
+                      int boneCount, SkBlendMode mode, const SkPaint& paint);
+
+    /** Draws a Coons patch: the interpolation of four cubics with shared corners,
+        associating a color, and optionally a texture SkPoint, with each corner.
+
+        Coons patch uses clip and SkMatrix, paint SkShader, SkColorFilter,
+        alpha, SkImageFilter, and SkBlendMode. If SkShader is provided it is treated
+        as Coons patch texture; SkBlendMode mode combines color colors and SkShader if
         both are provided.
 
         SkPoint array cubics specifies four SkPath cubic starting at the top-left corner,
         in clockwise order, sharing every fourth point. The last SkPath cubic ends at the
         first point.
 
         Color array color associates colors with corners in top-left, top-right,
         bottom-right, bottom-left order.
@@ -2210,22 +2143,22 @@ public:
         @param texCoords  SkPoint array of texture coordinates, mapping SkShader to corners;
                           may be nullptr
         @param mode       SkBlendMode for colors, and for SkShader if paint has one
         @param paint      SkShader, SkColorFilter, SkBlendMode, used to draw
     */
     void drawPatch(const SkPoint cubics[12], const SkColor colors[4],
                    const SkPoint texCoords[4], SkBlendMode mode, const SkPaint& paint);
 
-    /** Draws SkPath cubic Coons_Patch: the interpolation of four cubics with shared corners,
-        associating a color, and optionally a texture coordinate, with each corner.
-
-        Coons_Patch uses clip and SkMatrix, paint SkShader, SkColorFilter,
-        color alpha, SkImageFilter, and SkBlendMode. If SkShader is provided it is treated
-        as Coons_Patch texture; SkBlendMode mode combines color colors and SkShader if
+    /** Draws SkPath cubic Coons patch: the interpolation of four cubics with shared corners,
+        associating a color, and optionally a texture SkPoint, with each corner.
+
+        Coons patch uses clip and SkMatrix, paint SkShader, SkColorFilter,
+        alpha, SkImageFilter, and SkBlendMode. If SkShader is provided it is treated
+        as Coons patch texture; SkBlendMode mode combines color colors and SkShader if
         both are provided.
 
         SkPoint array cubics specifies four SkPath cubic starting at the top-left corner,
         in clockwise order, sharing every fourth point. The last SkPath cubic ends at the
         first point.
 
         Color array color associates colors with corners in top-left, top-right,
         bottom-right, bottom-left order.
@@ -2239,41 +2172,42 @@ public:
                           may be nullptr
         @param paint      SkShader, SkColorFilter, SkBlendMode, used to draw
     */
     void drawPatch(const SkPoint cubics[12], const SkColor colors[4],
                    const SkPoint texCoords[4], const SkPaint& paint) {
         this->drawPatch(cubics, colors, texCoords, SkBlendMode::kModulate, paint);
     }
 
-    /** Draw a set of sprites from atlas, using clip, SkMatrix, and optional SkPaint paint.
-        paint uses SkPaint anti-alias, color alpha, SkColorFilter, SkImageFilter, and SkBlendMode
+    /** Draws a set of sprites from atlas, using clip, SkMatrix, and optional SkPaint paint.
+        paint uses anti-alias, alpha, SkColorFilter, SkImageFilter, and SkBlendMode
         to draw, if present. For each entry in the array, SkRect tex locates sprite in
         atlas, and SkRSXform xform transforms it into destination space.
 
         xform, text, and colors if present, must contain count entries.
-        Optional colors are applied for each sprite using SkBlendMode.
+        Optional colors are applied for each sprite using SkBlendMode mode, treating
+        sprite as source and colors as destination.
         Optional cullRect is a conservative bounds of all transformed sprites.
         If cullRect is outside of clip, canvas can skip drawing.
 
         @param atlas     SkImage containing sprites
         @param xform     SkRSXform mappings for sprites in atlas
         @param tex       SkRect locations of sprites in atlas
         @param colors    one per sprite, blended with sprite using SkBlendMode; may be nullptr
         @param count     number of sprites to draw
         @param mode      SkBlendMode combining colors and sprites
         @param cullRect  bounds of transformed sprites for efficient clipping; may be nullptr
         @param paint     SkColorFilter, SkImageFilter, SkBlendMode, and so on; may be nullptr
     */
     void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[],
                    const SkColor colors[], int count, SkBlendMode mode, const SkRect* cullRect,
                    const SkPaint* paint);
 
-    /** Draw a set of sprites from atlas, using clip, SkMatrix, and optional SkPaint paint.
-        paint uses SkPaint anti-alias, color alpha, SkColorFilter, SkImageFilter, and SkBlendMode
+    /** Draws a set of sprites from atlas, using clip, SkMatrix, and optional SkPaint paint.
+        paint uses anti-alias, alpha, SkColorFilter, SkImageFilter, and SkBlendMode
         to draw, if present. For each entry in the array, SkRect tex locates sprite in
         atlas, and SkRSXform xform transforms it into destination space.
 
         xform, text, and colors if present, must contain count entries.
         Optional colors is applied for each sprite using SkBlendMode.
         Optional cullRect is a conservative bounds of all transformed sprites.
         If cullRect is outside of clip, canvas can skip drawing.
 
@@ -2287,18 +2221,18 @@ public:
         @param paint     SkColorFilter, SkImageFilter, SkBlendMode, and so on; may be nullptr
     */
     void drawAtlas(const sk_sp<SkImage>& atlas, const SkRSXform xform[], const SkRect tex[],
                    const SkColor colors[], int count, SkBlendMode mode, const SkRect* cullRect,
                    const SkPaint* paint) {
         this->drawAtlas(atlas.get(), xform, tex, colors, count, mode, cullRect, paint);
     }
 
-    /** Draw a set of sprites from atlas, using clip, SkMatrix, and optional SkPaint paint.
-        paint uses SkPaint anti-alias, color alpha, SkColorFilter, SkImageFilter, and SkBlendMode
+    /** Draws a set of sprites from atlas, using clip, SkMatrix, and optional SkPaint paint.
+        paint uses anti-alias, alpha, SkColorFilter, SkImageFilter, and SkBlendMode
         to draw, if present. For each entry in the array, SkRect tex locates sprite in
         atlas, and SkRSXform xform transforms it into destination space.
 
         xform and text must contain count entries.
         Optional cullRect is a conservative bounds of all transformed sprites.
         If cullRect is outside of clip, canvas can skip drawing.
 
         @param atlas     SkImage containing sprites
@@ -2308,18 +2242,18 @@ public:
         @param cullRect  bounds of transformed sprites for efficient clipping; may be nullptr
         @param paint     SkColorFilter, SkImageFilter, SkBlendMode, and so on; may be nullptr
     */
     void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[], int count,
                    const SkRect* cullRect, const SkPaint* paint) {
         this->drawAtlas(atlas, xform, tex, nullptr, count, SkBlendMode::kDst, cullRect, paint);
     }
 
-    /** Draw a set of sprites from atlas, using clip, SkMatrix, and optional SkPaint paint.
-        paint uses SkPaint anti-alias, color alpha, SkColorFilter, SkImageFilter, and SkBlendMode
+    /** Draws a set of sprites from atlas, using clip, SkMatrix, and optional SkPaint paint.
+        paint uses anti-alias, alpha, SkColorFilter, SkImageFilter, and SkBlendMode
         to draw, if present. For each entry in the array, SkRect tex locates sprite in
         atlas, and SkRSXform xform transforms it into destination space.
 
         xform and text must contain count entries.
         Optional cullRect is a conservative bounds of all transformed sprites.
         If cullRect is outside of clip, canvas can skip drawing.
 
         @param atlas     SkImage containing sprites
@@ -2330,80 +2264,68 @@ public:
         @param paint     SkColorFilter, SkImageFilter, SkBlendMode, and so on; may be nullptr
     */
     void drawAtlas(const sk_sp<SkImage>& atlas, const SkRSXform xform[], const SkRect tex[],
                    int count, const SkRect* cullRect, const SkPaint* paint) {
         this->drawAtlas(atlas.get(), xform, tex, nullptr, count, SkBlendMode::kDst,
                         cullRect, paint);
     }
 
-    /** Draw SkDrawable drawable using clip and SkMatrix, concatenated with
+    /** Draws SkDrawable drawable using clip and SkMatrix, concatenated with
         optional matrix.
 
         If SkCanvas has an asynchronous implementation, as is the case
         when it is recording into SkPicture, then drawable will be referenced,
         so that SkDrawable::draw() can be called when the operation is finalized. To force
         immediate drawing, call SkDrawable::draw() instead.
 
         @param drawable  custom struct encapsulating drawing commands
         @param matrix    transformation applied to drawing; may be nullptr
     */
     void drawDrawable(SkDrawable* drawable, const SkMatrix* matrix = nullptr);
 
-    /** Draw SkDrawable drawable using clip and SkMatrix, offset by (x, y).
+    /** Draws SkDrawable drawable using clip and SkMatrix, offset by (x, y).
 
         If SkCanvas has an asynchronous implementation, as is the case
         when it is recording into SkPicture, then drawable will be referenced,
         so that SkDrawable::draw() can be called when the operation is finalized. To force
         immediate drawing, call SkDrawable::draw() instead.
 
         @param drawable  custom struct encapsulating drawing commands
-        @param x         offset into SkCanvas writable pixels in x
-        @param y         offset into SkCanvas writable pixels in y
+        @param x         offset into SkCanvas writable pixels on x-axis
+        @param y         offset into SkCanvas writable pixels on y-axis
     */
     void drawDrawable(SkDrawable* drawable, SkScalar x, SkScalar y);
 
-    /** Associate SkRect on SkCanvas with an annotation; a key-value pair, where the key is
+    /** Associates SkRect on SkCanvas with an annotation; a key-value pair, where the key is
         a null-terminated utf8 string, and optional value is stored as SkData.
 
         Only some canvas implementations, such as recording to SkPicture, or drawing to
         document pdf, use annotations.
 
         @param rect   SkRect extent of canvas to annotate
         @param key    string used for lookup
         @param value  data holding value stored in annotation
     */
     void drawAnnotation(const SkRect& rect, const char key[], SkData* value);
 
-    /** Associate SkRect on SkCanvas when an annotation; a key-value pair, where the key is
+    /** Associates SkRect on SkCanvas when an annotation; a key-value pair, where the key is
         a null-terminated utf8 string, and optional value is stored as SkData.
 
         Only some canvas implementations, such as recording to SkPicture, or drawing to
         document pdf, use annotations.
 
         @param rect   SkRect extent of canvas to annotate
         @param key    string used for lookup
         @param value  data holding value stored in annotation
     */
     void drawAnnotation(const SkRect& rect, const char key[], const sk_sp<SkData>& value) {
         this->drawAnnotation(rect, key, value.get());
     }
 
-    //////////////////////////////////////////////////////////////////////////
-
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
-    /** To be deprecated soon.
-    */
-    SkDrawFilter* getDrawFilter() const;
-
-    /** To be deprecated soon.
-    */
-    virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter);
-#endif
-
     /** Returns true if clip is empty; that is, nothing will draw.
 
         May do work when called; it should not be called
         more often than needed. However, once called, subsequent calls perform no
         work until clip changes.
 
         @return  true if clip is empty
     */
@@ -2422,22 +2344,17 @@ public:
         @return  SkMatrix in SkCanvas
     */
     const SkMatrix& getTotalMatrix() const;
 
     ///////////////////////////////////////////////////////////////////////////
 
     // don't call
     virtual GrRenderTargetContext* internal_private_accessTopLayerRenderTargetContext();
-
-    // don't call
-    static void Internal_Private_SetIgnoreSaveLayerBounds(bool);
-    static bool Internal_Private_GetIgnoreSaveLayerBounds();
-    static void Internal_Private_SetTreatSpriteAsBitmap(bool);
-    static bool Internal_Private_GetTreatSpriteAsBitmap();
+    SkIRect internal_private_getTopLayerBounds() const { return getTopLayerBounds(); }
 
     // TEMP helpers until we switch virtual over to const& for src-rect
     void legacy_drawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
                               const SkPaint* paint,
                               SrcRectConstraint constraint = kStrict_SrcRectConstraint);
     void legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
                                const SkPaint* paint,
                                SrcRectConstraint constraint = kStrict_SrcRectConstraint);
@@ -2445,16 +2362,17 @@ public:
     /**
      *  Returns the global clip as a region. If the clip contains AA, then only the bounds
      *  of the clip may be returned.
      */
     void temporary_internal_getRgnClip(SkRegion* region);
 
     void private_draw_shadow_rec(const SkPath&, const SkDrawShadowRec&);
 
+
 protected:
     // default impl defers to getDevice()->newSurface(info)
     virtual sk_sp<SkSurface> onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props);
 
     // default impl defers to its device
     virtual bool onPeekPixels(SkPixmap* pixmap);
     virtual bool onAccessTopLayerPixels(SkPixmap* pixmap);
     virtual SkImageInfo onImageInfo() const;
@@ -2477,98 +2395,103 @@ protected:
     virtual void willRestore() {}
     virtual void didRestore() {}
     virtual void didConcat(const SkMatrix& ) {}
     virtual void didSetMatrix(const SkMatrix& ) {}
     virtual void didTranslate(SkScalar dx, SkScalar dy) {
         this->didConcat(SkMatrix::MakeTrans(dx, dy));
     }
 
-    virtual void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value);
+    // NOTE: If you are adding a new onDraw virtual to SkCanvas, PLEASE add an override to
+    // SkCanvasVirtualEnforcer (in SkCanvasVirtualEnforcer.h). This ensures that subclasses using
+    // that mechanism  will be required to implement the new function.
+    virtual void onDrawPaint(const SkPaint& paint);
+    virtual void onDrawRect(const SkRect& rect, const SkPaint& paint);
+    virtual void onDrawRRect(const SkRRect& rrect, const SkPaint& paint);
     virtual void onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint);
+    virtual void onDrawOval(const SkRect& rect, const SkPaint& paint);
+    virtual void onDrawArc(const SkRect& rect, SkScalar startAngle, SkScalar sweepAngle,
+                           bool useCenter, const SkPaint& paint);
+    virtual void onDrawPath(const SkPath& path, const SkPaint& paint);
+    virtual void onDrawRegion(const SkRegion& region, const SkPaint& paint);
 
     virtual void onDrawText(const void* text, size_t byteLength, SkScalar x,
                             SkScalar y, const SkPaint& paint);
-
     virtual void onDrawPosText(const void* text, size_t byteLength,
                                const SkPoint pos[], const SkPaint& paint);
-
     virtual void onDrawPosTextH(const void* text, size_t byteLength,
                                 const SkScalar xpos[], SkScalar constY,
                                 const SkPaint& paint);
-
-    virtual void onDrawTextOnPath(const void* text, size_t byteLength,
-                                  const SkPath& path, const SkMatrix* matrix,
-                                  const SkPaint& paint);
     virtual void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[],
                                    const SkRect* cullRect, const SkPaint& paint);
-
     virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
                                 const SkPaint& paint);
 
     virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
                            const SkPoint texCoords[4], SkBlendMode mode, const SkPaint& paint);
-
-    virtual void onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix);
-
-    virtual void onDrawPaint(const SkPaint& paint);
-    virtual void onDrawRect(const SkRect& rect, const SkPaint& paint);
-    virtual void onDrawRegion(const SkRegion& region, const SkPaint& paint);
-    virtual void onDrawOval(const SkRect& rect, const SkPaint& paint);
-    virtual void onDrawArc(const SkRect& rect, SkScalar startAngle, SkScalar sweepAngle,
-                           bool useCenter, const SkPaint& paint);
-    virtual void onDrawRRect(const SkRRect& rrect, const SkPaint& paint);
     virtual void onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
                               const SkPaint& paint);
+
+    // TODO: Remove old signature
     virtual void onDrawVerticesObject(const SkVertices* vertices, SkBlendMode mode,
-                                      const SkPaint& paint);
-    virtual void onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect rect[],
-                             const SkColor colors[], int count, SkBlendMode mode,
-                             const SkRect* cull, const SkPaint* paint);
-    virtual void onDrawPath(const SkPath& path, const SkPaint& paint);
+                                      const SkPaint& paint) {
+        this->onDrawVerticesObject(vertices, nullptr, 0, mode, paint);
+    }
+    virtual void onDrawVerticesObject(const SkVertices* vertices, const SkVertices::Bone bones[],
+                                      int boneCount, SkBlendMode mode, const SkPaint& paint);
+
     virtual void onDrawImage(const SkImage* image, SkScalar dx, SkScalar dy, const SkPaint* paint);
     virtual void onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
                                  const SkPaint* paint, SrcRectConstraint constraint);
     virtual void onDrawImageNine(const SkImage* image, const SkIRect& center, const SkRect& dst,
                                  const SkPaint* paint);
     virtual void onDrawImageLattice(const SkImage* image, const Lattice& lattice, const SkRect& dst,
                                     const SkPaint* paint);
 
     virtual void onDrawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy,
                               const SkPaint* paint);
     virtual void onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
                                   const SkPaint* paint, SrcRectConstraint constraint);
     virtual void onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
                                   const SkPaint* paint);
     virtual void onDrawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
                                      const SkRect& dst, const SkPaint* paint);
+
+    virtual void onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect rect[],
+                             const SkColor colors[], int count, SkBlendMode mode,
+                             const SkRect* cull, const SkPaint* paint);
+
+    virtual void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value);
     virtual void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&);
 
+    virtual void onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix);
+    virtual void onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
+                               const SkPaint* paint);
+
     enum ClipEdgeStyle {
         kHard_ClipEdgeStyle,
         kSoft_ClipEdgeStyle
     };
 
     virtual void onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle);
     virtual void onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle);
     virtual void onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle);
     virtual void onClipRegion(const SkRegion& deviceRgn, SkClipOp op);
 
     virtual void onDiscard();
 
-    virtual void onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
-                               const SkPaint* paint);
-
     // Clip rectangle bounds. Called internally by saveLayer.
     // returns false if the entire rectangle is entirely clipped out
     // If non-NULL, The imageFilter parameter will be used to expand the clip
     // and offscreen bounds for any margin required by the filter DAG.
     bool clipRectBounds(const SkRect* bounds, SaveLayerFlags flags, SkIRect* intersection,
                         const SkImageFilter* imageFilter = nullptr);
 
+    SkBaseDevice* getTopDevice() const;
+
 private:
     /** After calling saveLayer(), there can be any number of devices that make
      up the top-most drawing area. LayerIter can be used to iterate through
      those devices. Note that the iterator is only valid until the next API
      call made on the canvas. Ownership of all pointers in the iterator stays
      with the canvas, so none of them should be modified or deleted.
      */
     class LayerIter /*: SkNoncopyable*/ {
@@ -2581,17 +2504,17 @@ private:
         bool done() const { return fDone; }
         /** Cycle to the next device */
         void next();
 
         // These reflect the current device in the iterator
 
         SkBaseDevice*   device() const;
         const SkMatrix& matrix() const;
-        void clip(SkRegion*) const;
+        SkIRect clipBounds() const;
         const SkPaint&  paint() const;
         int             x() const;
         int             y() const;
 
     private:
         // used to embed the SkDrawIter object directly in our instance, w/o
         // having to expose that class def to the public. There is an assert
         // in our constructor to ensure that fStorage is large enough
@@ -2599,17 +2522,16 @@ private:
         // safely with 32 and 64 bit machines (to ensure the storage is enough)
         intptr_t          fStorage[32];
         class SkDrawIter* fImpl;    // this points at fStorage
         SkPaint           fDefaultPaint;
         bool              fDone;
     };
 
     static bool BoundsAffectsClip(SaveLayerFlags);
-    static SaveLayerFlags LegacySaveFlagsToSaveLayerFlags(uint32_t legacySaveFlags);
 
     static void DrawDeviceWithFilter(SkBaseDevice* src, const SkImageFilter* filter,
                                      SkBaseDevice* dst, const SkIPoint& dstOrigin,
                                      const SkMatrix& ctm);
 
     enum ShaderOverrideOpacity {
         kNone_ShaderOverrideOpacity,        //!< there is no overriding shader (bitmap or image)
         kOpaque_ShaderOverrideOpacity,      //!< the overriding shader is opaque
@@ -2620,32 +2542,29 @@ private:
     // can perform copy-on-write or invalidate any cached images
     void predrawNotify(bool willOverwritesEntireSurface = false);
     void predrawNotify(const SkRect* rect, const SkPaint* paint, ShaderOverrideOpacity);
     void predrawNotify(const SkRect* rect, const SkPaint* paint, bool shaderOverrideIsOpaque) {
         this->predrawNotify(rect, paint, shaderOverrideIsOpaque ? kOpaque_ShaderOverrideOpacity
                                                                 : kNotOpaque_ShaderOverrideOpacity);
     }
 
-public:
     SkBaseDevice* getDevice() const;
-    SkBaseDevice* getTopDevice() const;
-private:
 
     class MCRec;
 
     SkDeque     fMCStack;
     // points to top of stack
     MCRec*      fMCRec;
+
     // the first N recs that can fit here mean we won't call malloc
-    enum {
-        kMCRecSize      = 128,  // most recent measurement
-        kMCRecCount     = 32,   // common depth for save/restores
-        kDeviceCMSize   = 224,  // most recent measurement
-    };
+    static constexpr int kMCRecSize      = 128;  // most recent measurement
+    static constexpr int kMCRecCount     = 32;   // common depth for save/restores
+    static constexpr int kDeviceCMSize   = 224;  // most recent measurement
+
     intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)];
     intptr_t fDeviceCMStorage[kDeviceCMSize / sizeof(intptr_t)];
 
     const SkSurfaceProps fProps;
 
     int         fSaveCount;         // value returned by getSaveCount()
 
     SkMetaData* fMetaData;
@@ -2661,47 +2580,49 @@ private:
 
     SkIRect fClipRestrictionRect = SkIRect::MakeEmpty();
 
     void doSave();
     void checkForDeferredSave();
     void internalSetMatrix(const SkMatrix&);
 
     friend class SkAndroidFrameworkUtils;
+    friend class SkCanvasPriv;      // needs kDontClipToLayer_PrivateSaveLayerFlag
     friend class SkDrawIter;        // needs setupDrawForLayerDevice()
     friend class AutoDrawLooper;
     friend class SkDebugCanvas;     // needs experimental fAllowSimplifyClip
     friend class SkSurface_Raster;  // needs getDevice()
-    friend class SkNoDrawCanvas;    // InitFlags
-    friend class SkPictureImageFilter;  // SkCanvas(SkBaseDevice*, SkSurfaceProps*, InitFlags)
+    friend class SkNoDrawCanvas;    // needs resetForNextPicture()
     friend class SkPictureRecord;   // predrawNotify (why does it need it? <reed>)
-    friend class SkPicturePlayback; // SaveFlagsToSaveLayerFlags
     friend class SkOverdrawCanvas;
     friend class SkRasterHandleAllocator;
 
-    enum InitFlags {
-        kDefault_InitFlags                  = 0,
-        kConservativeRasterClip_InitFlag    = 1 << 0,
-    };
-    SkCanvas(const SkIRect& bounds, InitFlags);
-    SkCanvas(SkBaseDevice* device, InitFlags);
+protected:
+    // For use by SkNoDrawCanvas (via SkCanvasVirtualEnforcer, which can't be a friend)
+    SkCanvas(const SkIRect& bounds);
+private:
     SkCanvas(const SkBitmap&, std::unique_ptr<SkRasterHandleAllocator>,
              SkRasterHandleAllocator::Handle);
 
+    SkCanvas(SkCanvas&&) = delete;
+    SkCanvas(const SkCanvas&) = delete;
+    SkCanvas& operator=(SkCanvas&&) = delete;
+    SkCanvas& operator=(const SkCanvas&) = delete;
+
     void resetForNextPicture(const SkIRect& bounds);
 
     // needs gettotalclip()
     friend class SkCanvasStateUtils;
 
     // call this each time we attach ourselves to a device
     //  - constructor
     //  - internalSaveLayer
     void setupDevice(SkBaseDevice*);
 
-    SkBaseDevice* init(SkBaseDevice*, InitFlags);
+    void init(sk_sp<SkBaseDevice>);
 
     /**
      * Gets the bounds of the top level layer in global canvas coordinates. We don't want this
      * to be public because it exposes decisions about layer sizes that are internal to the canvas.
      */
     SkIRect getTopLayerBounds() const;
 
     void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
@@ -2739,42 +2660,49 @@ private:
      *  us to do a fast quick reject in the common case.
      */
     bool   fIsScaleTranslate;
     SkRect fDeviceClipBounds;
 
     bool fAllowSoftClip;
     bool fAllowSimplifyClip;
 
-    class AutoValidateClip : ::SkNoncopyable {
+    class AutoValidateClip {
     public:
         explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) {
             fCanvas->validateClip();
         }
         ~AutoValidateClip() { fCanvas->validateClip(); }
 
     private:
         const SkCanvas* fCanvas;
+
+        AutoValidateClip(AutoValidateClip&&) = delete;
+        AutoValidateClip(const AutoValidateClip&) = delete;
+        AutoValidateClip& operator=(AutoValidateClip&&) = delete;
+        AutoValidateClip& operator=(const AutoValidateClip&) = delete;
     };
 
 #ifdef SK_DEBUG
     void validateClip() const;
 #else
     void validateClip() const {}
 #endif
 
+    std::unique_ptr<SkGlyphRunBuilder> fScratchGlyphRunBuilder;
+
     typedef SkRefCnt INHERITED;
 };
 
 /** \class SkAutoCanvasRestore
-    Stack helper class calls SkCanvas::restoreToCount() when SkAutoCanvasRestore
+    Stack helper class calls SkCanvas::restoreToCount when SkAutoCanvasRestore
     goes out of scope. Use this to guarantee that the canvas is restored to a known
     state.
 */
-class SkAutoCanvasRestore : SkNoncopyable {
+class SkAutoCanvasRestore {
 public:
 
     /** Preserves SkCanvas save count. Optionally saves SkCanvas clip and SkCanvas matrix.
 
         @param canvas  SkCanvas to guard
         @param doSave  call SkCanvas::save()
         @return        utility to restore SkCanvas state on destructor
     */
@@ -2804,12 +2732,17 @@ public:
             fCanvas->restoreToCount(fSaveCount);
             fCanvas = nullptr;
         }
     }
 
 private:
     SkCanvas*   fCanvas;
     int         fSaveCount;
+
+    SkAutoCanvasRestore(SkAutoCanvasRestore&&) = delete;
+    SkAutoCanvasRestore(const SkAutoCanvasRestore&) = delete;
+    SkAutoCanvasRestore& operator=(SkAutoCanvasRestore&&) = delete;
+    SkAutoCanvasRestore& operator=(const SkAutoCanvasRestore&) = delete;
 };
 #define SkAutoCanvasRestore(...) SK_REQUIRE_LOCAL_VAR(SkAutoCanvasRestore)
 
 #endif
new file mode 100644
--- /dev/null
+++ b/gfx/skia/skia/include/core/SkCanvasVirtualEnforcer.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkCanvasVirtualEnforcer_DEFINED
+#define SkCanvasVirtualEnforcer_DEFINED
+
+#include "SkCanvas.h"
+
+// If you would ordinarily want to inherit from Base (eg SkCanvas, SkNWayCanvas), instead
+// inherit from SkCanvasVirtualEnforcer<Base>, which will make the build fail if you forget
+// to override one of SkCanvas' key virtual hooks.
+template <typename Base>
+class SkCanvasVirtualEnforcer : public Base {
+public:
+    using Base::Base;
+
+protected:
+    void onDrawPaint(const SkPaint& paint) override = 0;
+    void onDrawRect(const SkRect& rect, const SkPaint& paint) override = 0;
+    void onDrawRRect(const SkRRect& rrect, const SkPaint& paint) override = 0;
+    void onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
+                      const SkPaint& paint) override = 0;
+    void onDrawOval(const SkRect& rect, const SkPaint& paint) override = 0;
+    void onDrawArc(const SkRect& rect, SkScalar startAngle, SkScalar sweepAngle, bool useCenter,
+                   const SkPaint& paint) override = 0;
+    void onDrawPath(const SkPath& path, const SkPaint& paint) override = 0;
+    void onDrawRegion(const SkRegion& region, const SkPaint& paint) override = 0;
+
+    void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
+                    const SkPaint& paint) override = 0;
+    void onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
+                       const SkPaint& paint) override = 0;
+    void onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
+                        SkScalar constY, const SkPaint& paint) override = 0;
+    void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[],
+                           const SkRect* cullRect, const SkPaint& paint) override = 0;
+    void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
+                        const SkPaint& paint) override = 0;
+
+    void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
+                     const SkPoint texCoords[4], SkBlendMode mode,
+                     const SkPaint& paint) override = 0;
+    void onDrawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint pts[],
+                      const SkPaint& paint) override = 0;
+    void onDrawVerticesObject(const SkVertices*, const SkVertices::Bone bones[], int boneCount,
+                              SkBlendMode, const SkPaint&) override = 0;
+
+    void onDrawImage(const SkImage* image, SkScalar dx, SkScalar dy,
+                     const SkPaint* paint) override = 0;
+    void onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+                         const SkPaint* paint, SkCanvas::SrcRectConstraint constraint) override = 0;
+    void onDrawImageNine(const SkImage* image, const SkIRect& center, const SkRect& dst,
+                         const SkPaint* paint) override = 0;
+    void onDrawImageLattice(const SkImage* image, const SkCanvas::Lattice& lattice,
+                            const SkRect& dst, const SkPaint* paint) override = 0;
+
+    void onDrawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy,
+                      const SkPaint* paint) override = 0;
+    void onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+                          const SkPaint* paint,
+                          SkCanvas::SrcRectConstraint constraint) override = 0;
+    void onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
+                          const SkPaint* paint) override = 0;
+    void onDrawBitmapLattice(const SkBitmap& bitmap, const SkCanvas::Lattice& lattice,
+                             const SkRect& dst, const SkPaint* paint) override = 0;
+
+    void onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect rect[],
+                     const SkColor colors[], int count, SkBlendMode mode, const SkRect* cull,
+                     const SkPaint* paint) override = 0;
+
+    void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) override = 0;
+    void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override = 0;
+
+    void onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) override = 0;
+    void onDrawPicture(const SkPicture* picture, const SkMatrix* matrix,
+                       const SkPaint* paint) override = 0;
+};
+
+#endif
--- a/gfx/skia/skia/include/core/SkColor.h
+++ b/gfx/skia/skia/include/core/SkColor.h
@@ -1,191 +1,300 @@
 /*
  * 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.
  */
 
+/* Generated by tools/bookmaker from include/core/SkColor.h and docs/SkColor_Reference.bmh
+   on 2018-06-14 13:13:34. Additional documentation and examples can be found at:
+   https://skia.org/user/api/SkColor_Reference
+
+   You may edit either file directly. Structural changes to public interfaces require
+   editing both files. After editing docs/SkColor_Reference.bmh, run:
+       bookmaker -b docs -i include/core/SkColor.h -p
+   to create an updated version of this file.
+ */
+
 #ifndef SkColor_DEFINED
 #define SkColor_DEFINED
 
+#include "SkImageInfo.h"
 #include "SkScalar.h"
 #include "SkTypes.h"
 
 /** \file SkColor.h
 
-    Types and macros for colors
+    Types, consts, functions, and macros for colors.
 */
 
-/** 8-bit type for an alpha value. 0xFF is 100% opaque, 0x00 is 100% transparent.
+/** 8-bit type for an alpha value. 255 is 100% opaque, zero is 100% transparent.
 */
 typedef uint8_t SkAlpha;
-/** 32 bit ARGB color value, not premultiplied. The color components are always in
+
+/** 32-bit ARGB color value, unpremultiplied. Color components are always in
     a known order. This is different from SkPMColor, which has its bytes in a configuration
-    dependent order, to match the format of kARGB32 bitmaps. SkColor is the type used to
-    specify colors in SkPaint and in gradients.
+    dependent order, to match the format of kBGRA_8888_SkColorType bitmaps. SkColor
+    is the type used to specify colors in SkPaint and in gradients.
+
+    Color that is premultiplied has the same component values as color
+    that is unpremultiplied if alpha is 255, fully opaque, although may have the
+    component values in a different order.
 */
 typedef uint32_t SkColor;
 
-/** Return a SkColor value from 8 bit component values
+/** Returns color value from 8-bit component values. Asserts if SK_DEBUG is defined
+    if a, r, g, or b exceed 255. Since color is unpremultiplied, a may be smaller
+    than the largest of r, g, and b.
+
+    @param a  amount of alpha, from fully transparent (0) to fully opaque (255)
+    @param r  amount of red, from no red (0) to full red (255)
+    @param g  amount of green, from no green (0) to full green (255)
+    @param b  amount of blue, from no blue (0) to full blue (255)
+    @return   color and alpha, unpremultiplied
 */
 static constexpr inline SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) {
     return SkASSERT(a <= 255 && r <= 255 && g <= 255 && b <= 255),
            (a << 24) | (r << 16) | (g << 8) | (b << 0);
 }
-// Legacy aliases.
-#define SkColorSetARGBInline SkColorSetARGB
-#define SkColorSetARGBMacro  SkColorSetARGB
 
-/** Return a SkColor value from 8 bit component values, with an implied value
-    of 0xFF for alpha (fully opaque)
+/** Returns color value from 8-bit component values, with alpha set
+    fully opaque to 255.
 */
 #define SkColorSetRGB(r, g, b)  SkColorSetARGB(0xFF, r, g, b)
 
-/** return the alpha byte from a SkColor value */
+/** Returns alpha byte from color value.
+*/
 #define SkColorGetA(color)      (((color) >> 24) & 0xFF)
-/** return the red byte from a SkColor value */
+
+/** Returns red component of color, from zero to 255.
+*/
 #define SkColorGetR(color)      (((color) >> 16) & 0xFF)
-/** return the green byte from a SkColor value */
+
+/** Returns green component of color, from zero to 255.
+*/
 #define SkColorGetG(color)      (((color) >>  8) & 0xFF)
-/** return the blue byte from a SkColor value */
+
+/** Returns blue component of color, from zero to 255.
+*/
 #define SkColorGetB(color)      (((color) >>  0) & 0xFF)
 
+/** Returns unpremultiplied color with red, blue, and green set from c; and alpha set
+    from a. Alpha component of c is ignored and is replaced by a in result.
+
+    @param c  packed RGB, eight bits per component
+    @param a  alpha: transparent at zero, fully opaque at 255
+    @return   color with transparency
+*/
 static constexpr inline SkColor SkColorSetA(SkColor c, U8CPU a) {
     return (c & 0x00FFFFFF) | (a << 24);
 }
 
-// common colors
+/** Represents fully transparent SkAlpha value. SkAlpha ranges from zero,
+    fully transparent; to 255, fully opaque.
+*/
+constexpr SkAlpha SK_AlphaTRANSPARENT = 0x00;
 
-/** transparent SkAlpha value */
-#define SK_AlphaTRANSPARENT static_cast<SkAlpha>(0x00)
-/** opaque SkAlpha value */
-#define SK_AlphaOPAQUE      static_cast<SkAlpha>(0xFF)
+/** Represents fully opaque SkAlpha value. SkAlpha ranges from zero,
+    fully transparent; to 255, fully opaque.
+*/
+constexpr SkAlpha SK_AlphaOPAQUE      = 0xFF;
 
-/** transparent SkColor value */
-#define SK_ColorTRANSPARENT static_cast<SkColor>(0x00000000)
+/** Represents fully transparent SkColor. May be used to initialize a destination
+    containing a mask or a non-rectangular image.
+*/
+constexpr SkColor SK_ColorTRANSPARENT = SkColorSetARGB(0x00, 0x00, 0x00, 0x00);
 
-/** black SkColor value */
-#define SK_ColorBLACK       static_cast<SkColor>(0xFF000000)
-/** dark gray SkColor value */
-#define SK_ColorDKGRAY      static_cast<SkColor>(0xFF444444)
-/** gray SkColor value */
-#define SK_ColorGRAY        static_cast<SkColor>(0xFF888888)
-/** light gray SkColor value */
-#define SK_ColorLTGRAY      static_cast<SkColor>(0xFFCCCCCC)
-/** white SkColor value */
-#define SK_ColorWHITE       static_cast<SkColor>(0xFFFFFFFF)
+/** Represents fully opaque black.
+*/
+constexpr SkColor SK_ColorBLACK       = SkColorSetARGB(0xFF, 0x00, 0x00, 0x00);
+
+/** Represents fully opaque dark gray.
+    Note that SVG dark gray is equivalent to 0xFFA9A9A9.
+*/
+constexpr SkColor SK_ColorDKGRAY      = SkColorSetARGB(0xFF, 0x44, 0x44, 0x44);
+
+/** Represents fully opaque gray.
+    Note that HTML gray is equivalent to 0xFF808080.
+*/
+constexpr SkColor SK_ColorGRAY        = SkColorSetARGB(0xFF, 0x88, 0x88, 0x88);
+
+/** Represents fully opaque light gray. HTML silver is equivalent to 0xFFC0C0C0.
+    Note that SVG light gray is equivalent to 0xFFD3D3D3.
+*/
+constexpr SkColor SK_ColorLTGRAY      = SkColorSetARGB(0xFF, 0xCC, 0xCC, 0xCC);
 
-/** red SkColor value */
-#define SK_ColorRED         static_cast<SkColor>(0xFFFF0000)
-/** green SkColor value */
-#define SK_ColorGREEN       static_cast<SkColor>(0xFF00FF00)
-/** blue SkColor value */
-#define SK_ColorBLUE        static_cast<SkColor>(0xFF0000FF)
-/** yellow SkColor value */
-#define SK_ColorYELLOW      static_cast<SkColor>(0xFFFFFF00)
-/** cyan SkColor value */
-#define SK_ColorCYAN        static_cast<SkColor>(0xFF00FFFF)
-/** magenta SkColor value */
-#define SK_ColorMAGENTA     static_cast<SkColor>(0xFFFF00FF)
+/** Represents fully opaque white.
+*/
+constexpr SkColor SK_ColorWHITE       = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0xFF);
+
+/** Represents fully opaque red.
+*/
+constexpr SkColor SK_ColorRED         = SkColorSetARGB(0xFF, 0xFF, 0x00, 0x00);
+
+/** Represents fully opaque green. HTML lime is equivalent.
+    Note that HTML green is equivalent to 0xFF008000.
+*/
+constexpr SkColor SK_ColorGREEN       = SkColorSetARGB(0xFF, 0x00, 0xFF, 0x00);
+
+/** Represents fully opaque blue.
+*/
+constexpr SkColor SK_ColorBLUE        = SkColorSetARGB(0xFF, 0x00, 0x00, 0xFF);
 
-////////////////////////////////////////////////////////////////////////
+/** Represents fully opaque yellow.
+*/
+constexpr SkColor SK_ColorYELLOW      = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0x00);
+
+/** Represents fully opaque cyan. HTML aqua is equivalent.
+*/
+constexpr SkColor SK_ColorCYAN        = SkColorSetARGB(0xFF, 0x00, 0xFF, 0xFF);
 
-/** Convert RGB components to HSV.
-        hsv[0] is Hue [0 .. 360)
-        hsv[1] is Saturation [0...1]
-        hsv[2] is Value [0...1]
-    @param red  red component value [0..255]
-    @param green  green component value [0..255]
-    @param blue  blue component value [0..255]
-    @param hsv  3 element array which holds the resulting HSV components.
+/** Represents fully opaque magenta. HTML fuchsia is equivalent.
+*/
+constexpr SkColor SK_ColorMAGENTA     = SkColorSetARGB(0xFF, 0xFF, 0x00, 0xFF);
+
+/** Converts RGB to its HSV components.
+    hsv[0] contains hsv hue, a value from zero to less than 360.
+    hsv[1] contains hsv saturation, a value from zero to one.
+    hsv[2] contains hsv value, a value from zero to one.
+
+    @param red    red component value from zero to 255
+    @param green  green component value from zero to 255
+    @param blue   blue component value from zero to 255
+    @param hsv    three element array which holds the resulting HSV components
 */
 SK_API void SkRGBToHSV(U8CPU red, U8CPU green, U8CPU blue, SkScalar hsv[3]);
 
-/** Convert the argb color to its HSV components.
-        hsv[0] is Hue [0 .. 360)
-        hsv[1] is Saturation [0...1]
-        hsv[2] is Value [0...1]
-    @param color the argb color to convert. Note: the alpha component is ignored.
-    @param hsv  3 element array which holds the resulting HSV components.
+/** Converts ARGB to its HSV components. Alpha in ARGB is ignored.
+    hsv[0] contains hsv hue, and is assigned a value from zero to less than 360.
+    hsv[1] contains hsv saturation, a value from zero to one.
+    hsv[2] contains hsv value, a value from zero to one.
+
+    @param color  ARGB color to convert
+    @param hsv    three element array which holds the resulting HSV components
 */
 static inline void SkColorToHSV(SkColor color, SkScalar hsv[3]) {
     SkRGBToHSV(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color), hsv);
 }
 
-/** Convert HSV components to an ARGB color. The alpha component is passed through unchanged.
-        hsv[0] is Hue [0 .. 360)
-        hsv[1] is Saturation [0...1]
-        hsv[2] is Value [0...1]
-    If hsv values are out of range, they are pinned.
-    @param alpha the alpha component of the returned argb color.
-    @param hsv  3 element array which holds the input HSV components.
-    @return the resulting argb color
+/** Converts HSV components to an ARGB color. Alpha is passed through unchanged.
+    hsv[0] represents hsv hue, an angle from zero to less than 360.
+    hsv[1] represents hsv saturation, and varies from zero to one.
+    hsv[2] represents hsv value, and varies from zero to one.
+
+    Out of range hsv values are pinned.
+
+    @param alpha  alpha component of the returned ARGB color
+    @param hsv    three element array which holds the input HSV components
+    @return       ARGB equivalent to HSV
 */
 SK_API SkColor SkHSVToColor(U8CPU alpha, const SkScalar hsv[3]);
 
-/** Convert HSV components to an ARGB color. The alpha component set to 0xFF.
-        hsv[0] is Hue [0 .. 360)
-        hsv[1] is Saturation [0...1]
-        hsv[2] is Value [0...1]
-    If hsv values are out of range, they are pinned.
-    @param hsv  3 element array which holds the input HSV components.
-    @return the resulting argb color
+/** Converts HSV components to an ARGB color. Alpha is set to 255.
+    hsv[0] represents hsv hue, an angle from zero to less than 360.
+    hsv[1] represents hsv saturation, and varies from zero to one.
+    hsv[2] represents hsv value, and varies from zero to one.
+
+    Out of range hsv values are pinned.
+
+    @param hsv  three element array which holds the input HSV components
+    @return     RGB equivalent to HSV
 */
 static inline SkColor SkHSVToColor(const SkScalar hsv[3]) {
     return SkHSVToColor(0xFF, hsv);
 }
 
-////////////////////////////////////////////////////////////////////////
-
-/** 32 bit ARGB color value, premultiplied. The byte order for this value is
-    configuration dependent, matching the format of kARGB32 bitmaps. This is different
-    from SkColor, which is nonpremultiplied, and is always in the same byte order.
+/** 32-bit ARGB color value, premultiplied. The byte order for this value is
+    configuration dependent, matching the format of kBGRA_8888_SkColorType bitmaps.
+    This is different from SkColor, which is unpremultiplied, and is always in the
+    same byte order.
 */
 typedef uint32_t SkPMColor;
 
-/** Return a SkPMColor value from unpremultiplied 8 bit component values
+/** Returns a SkPMColor value from unpremultiplied 8-bit component values.
+
+    @param a  amount of alpha, from fully transparent (0) to fully opaque (255)
+    @param r  amount of red, from no red (0) to full red (255)
+    @param g  amount of green, from no green (0) to full green (255)
+    @param b  amount of blue, from no blue (0) to full blue (255)
+    @return   premultiplied color
 */
 SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b);
-/** Return a SkPMColor value from a SkColor value. This is done by multiplying the color
-    components by the color's alpha, and by arranging the bytes in a configuration
-    dependent order, to match the format of kARGB32 bitmaps.
+
+/** Returns pmcolor closest to color c. Multiplies c RGB components by the c alpha,
+    and arranges the bytes to match the format of kN32_SkColorType.
+
+    @param c  unpremultiplied ARGB color
+    @return   premultiplied color
 */
 SK_API SkPMColor SkPreMultiplyColor(SkColor c);
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-struct SkPM4f;
-
-/*
- *  The float values are 0...1 unpremultiplied
- */
-struct SK_API SkColor4f {
+template <SkAlphaType kAT>
+struct SkRGBA4f {
     float fR;
     float fG;
     float fB;
     float fA;
 
-    bool operator==(const SkColor4f& other) const {
+    bool operator==(const SkRGBA4f& other) const {
         return fA == other.fA && fR == other.fR && fG == other.fG && fB == other.fB;
     }
-    bool operator!=(const SkColor4f& other) const {
+    bool operator!=(const SkRGBA4f& other) const {
         return !(*this == other);
     }
 
+    SkRGBA4f operator*(float scale) const {
+        return { fR * scale, fG * scale, fB * scale, fA * scale };
+    }
+
+    SkRGBA4f operator*(const SkRGBA4f& scale) const {
+        return { fR * scale.fR, fG * scale.fG, fB * scale.fB, fA * scale.fA };
+    }
+
     const float* vec() const { return &fR; }
-    float* vec() { return &fR; }
+          float* vec()       { return &fR; }
+
+    float operator[](int index) const {
+        SkASSERT(index >= 0 && index < 4);
+        return this->vec()[index];
+    }
 
-    static SkColor4f Pin(float r, float g, float b, float a);
-    /** Convert to SkColor4f, assuming SkColor is sRGB */
-    static SkColor4f FromColor(SkColor);
+    float& operator[](int index) {
+        SkASSERT(index >= 0 && index < 4);
+        return this->vec()[index];
+    }
 
-    SkColor toSkColor() const;
-
-    SkColor4f pin() const {
-        return Pin(fR, fG, fB, fA);
+    bool isOpaque() const {
+        SkASSERT(fA <= 1.0f && fA >= 0.0f);
+        return fA == 1.0f;
     }
 
-    SkPM4f premul() const;
+    static SkRGBA4f Pin(float r, float g, float b, float a);  // impl. depends on kAT
+    SkRGBA4f pin() const { return Pin(fR, fG, fB, fA); }
+
+    static SkRGBA4f FromColor(SkColor);  // impl. depends on kAT
+    SkColor toSkColor() const;  // impl. depends on kAT
+
+    static SkRGBA4f FromPMColor(SkPMColor);  // impl. depends on kAT
+
+    SkRGBA4f<kPremul_SkAlphaType> premul() const {
+        static_assert(kAT == kUnpremul_SkAlphaType, "");
+        return { fR * fA, fG * fA, fB * fA, fA };
+    }
+
+    SkRGBA4f<kUnpremul_SkAlphaType> unpremul() const {
+        static_assert(kAT == kPremul_SkAlphaType, "");
+
+        if (fA == 0.0f) {
+            return { 0, 0, 0, 0 };
+        } else {
+            float invAlpha = 1 / fA;
+            return { fR * invAlpha, fG * invAlpha, fB * invAlpha, fA };
+        }
+    }
 };
 
+using SkColor4f = SkRGBA4f<kUnpremul_SkAlphaType>;
+template <> SK_API SkColor4f SkColor4f::FromColor(SkColor);
+template <> SK_API SkColor   SkColor4f::toSkColor() const;
+
 #endif
--- a/gfx/skia/skia/include/core/SkColorFilter.h
+++ b/gfx/skia/skia/include/core/SkColorFilter.h
@@ -16,16 +16,17 @@
 class GrContext;
 class GrColorSpaceInfo;
 class GrFragmentProcessor;
 class SkArenaAlloc;
 class SkBitmap;
 class SkColorSpace;
 class SkColorSpaceXformer;
 class SkRasterPipeline;
+class SkString;
 
 /**
  *  ColorFilters are optional objects in the drawing pipeline. When present in
  *  a paint, they are called with the "src" colors, and return new colors, which
  *  are then passed onto the next stage (either ImageFilter or Xfermode).
  *
  *  All subclasses are required to be reentrant-safe : it must be legal to share
  *  the same instance between several threads.
@@ -72,17 +73,17 @@ public:
         kAlphaUnchanged_Flag = 1 << 0,
     };
 
     /** Returns the flags for this filter. Override in subclasses to return custom flags.
     */
     virtual uint32_t getFlags() const { return 0; }
 
     SkColor filterColor(SkColor) const;
-    SkColor4f filterColor4f(const SkColor4f&) const;
+    SkColor4f filterColor4f(const SkColor4f&, SkColorSpace*) const;
 
     /** Create a colorfilter that uses the specified color and mode.
         If the Mode is DST, this function will return NULL (since that
         mode will have no effect on the result).
         @param c    The source color used with the specified mode
         @param mode The blend that is applied to each color in
                         the colorfilter's filterSpan[16,32] methods
         @return colorfilter object that applies the src color and mode,
@@ -129,23 +130,35 @@ public:
      *
      *  A null return indicates that the color filter isn't implemented for the GPU backend.
      */
     virtual std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(
             GrContext*, const GrColorSpaceInfo& dstColorSpaceInfo) const;
 #endif
 
     bool affectsTransparentBlack() const {
-        return this->filterColor(0) != 0;
+        return this->filterColor(SK_ColorTRANSPARENT) != SK_ColorTRANSPARENT;
+    }
+
+    static void InitializeFlattenables();
+
+    static SkFlattenable::Type GetFlattenableType() {
+        return kSkColorFilter_Type;
     }
 
-    SK_TO_STRING_PUREVIRT()
+    SkFlattenable::Type getFlattenableType() const override {
+        return kSkColorFilter_Type;
+    }
 
-    SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
-    SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter)
+    static sk_sp<SkColorFilter> Deserialize(const void* data, size_t size,
+                                          const SkDeserialProcs* procs = nullptr) {
+        return sk_sp<SkColorFilter>(static_cast<SkColorFilter*>(
+                                  SkFlattenable::Deserialize(
+                                  kSkColorFilter_Type, data, size, procs).release()));
+    }
 
 protected:
     SkColorFilter() {}
 
     sk_sp<SkColorFilter> makeColorSpace(SkColorSpaceXformer* xformer) const {
         return this->onMakeColorSpace(xformer);
     }
     virtual sk_sp<SkColorFilter> onMakeColorSpace(SkColorSpaceXformer*) const {
--- a/gfx/skia/skia/include/core/SkColorPriv.h
+++ b/gfx/skia/skia/include/core/SkColorPriv.h
@@ -3,16 +3,17 @@
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 #ifndef SkColorPriv_DEFINED
 #define SkColorPriv_DEFINED
 
+#include "../private/SkTo.h"
 #include "SkColor.h"
 #include "SkMath.h"
 
 /** Turn 0..255 into 0..256 by adding 1 at the half-way point. Used to turn a
     byte into a scale value, so that we can say scale * value >> 8 instead of
     alpha * value / 255.
 
     In debugging, asserts that alpha is 0..255
--- a/gfx/skia/skia/include/core/SkColorSpace.h
+++ b/gfx/skia/skia/include/core/SkColorSpace.h
@@ -3,86 +3,71 @@
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 #ifndef SkColorSpace_DEFINED
 #define SkColorSpace_DEFINED
 
+#include "../private/SkOnce.h"
 #include "SkMatrix44.h"
 #include "SkRefCnt.h"
+#include <memory>
 
 class SkData;
+struct skcms_ICCProfile;
 
 enum SkGammaNamed {
     kLinear_SkGammaNamed,
     kSRGB_SkGammaNamed,
     k2Dot2Curve_SkGammaNamed,
     kNonStandard_SkGammaNamed,
 };
 
 /**
  *  Describes a color gamut with primaries and a white point.
  */
 struct SK_API SkColorSpacePrimaries {
-    float fRX, fRY;
-    float fGX, fGY;
-    float fBX, fBY;
-    float fWX, fWY;
+    float fRX;
+    float fRY;
+    float fGX;
+    float fGY;
+    float fBX;
+    float fBY;
+    float fWX;
+    float fWY;
 
     /**
      *  Convert primaries and a white point to a toXYZD50 matrix, the preferred color gamut
      *  representation of SkColorSpace.
      */
     bool toXYZD50(SkMatrix44* toXYZD50) const;
 };
 
 /**
  *  Contains the coefficients for a common transfer function equation, specified as
  *  a transformation from a curved space to linear.
  *
- *  LinearVal = C*InputVal + F        , for 0.0f <= InputVal <  D
- *  LinearVal = (A*InputVal + B)^G + E, for D    <= InputVal <= 1.0f
+ *  LinearVal = sign(InputVal) * (  C*|InputVal| + F       ), for 0.0f <= |InputVal| <  D
+ *  LinearVal = sign(InputVal) * ( (A*|InputVal| + B)^G + E), for D    <= |InputVal|
  *
- *  Function is undefined if InputVal is not in [ 0.0f, 1.0f ].
- *  Resulting LinearVals must be in [ 0.0f, 1.0f ].
  *  Function must be positive and increasing.
  */
 struct SK_API SkColorSpaceTransferFn {
     float fG;
     float fA;
     float fB;
     float fC;
     float fD;
     float fE;
     float fF;
-
-    /**
-     * Produces a new parametric transfer function equation that is the mathematical inverse of
-     * this one.
-     */
-    SkColorSpaceTransferFn invert() const;
-
-    /**
-     * Transform a single float by this transfer function.
-     * For negative inputs, returns sign(x) * f(abs(x)).
-     */
-    float operator()(float x) {
-        SkScalar s = SkScalarSignAsScalar(x);
-        x = sk_float_abs(x);
-        if (x >= fD) {
-            return s * (powf(fA * x + fB, fG) + fE);
-        } else {
-            return s * (fC * x + fF);
-        }
-    }
 };
 
-class SK_API SkColorSpace : public SkRefCnt {
+class SK_API SkColorSpace : public SkNVRefCnt<SkColorSpace> {
 public:
     /**
      *  Create the sRGB color space.
      */
     static sk_sp<SkColorSpace> MakeSRGB();
 
     /**
      *  Colorspace with the sRGB primaries, but a linear (1.0) gamma. Commonly used for
@@ -117,100 +102,80 @@ public:
     static sk_sp<SkColorSpace> MakeRGB(RenderTargetGamma gamma, const SkMatrix44& toXYZD50);
     static sk_sp<SkColorSpace> MakeRGB(const SkColorSpaceTransferFn& coeffs, Gamut gamut);
     static sk_sp<SkColorSpace> MakeRGB(const SkColorSpaceTransferFn& coeffs,
                                        const SkMatrix44& toXYZD50);
 
     static sk_sp<SkColorSpace> MakeRGB(SkGammaNamed gammaNamed, const SkMatrix44& toXYZD50);
 
     /**
-     *  Create an SkColorSpace from an ICC profile.
+     *  Create an SkColorSpace from a parsed (skcms) ICC profile.
      */
-    static sk_sp<SkColorSpace> MakeICC(const void*, size_t);
+    static sk_sp<SkColorSpace> Make(const skcms_ICCProfile&);
 
     /**
-     *  Types of colorspaces.
+     *  Convert this color space to an skcms ICC profile struct.
      */
-    enum Type {
-        kRGB_Type,
-        kCMYK_Type,
-        kGray_Type,
-    };
-    Type type() const;
+    void toProfile(skcms_ICCProfile*) const;
 
-    SkGammaNamed gammaNamed() const;
+    SkGammaNamed gammaNamed() const { return fGammaNamed; }
 
     /**
      *  Returns true if the color space gamma is near enough to be approximated as sRGB.
-     *  This includes the canonical sRGB transfer function as well as a 2.2f exponential
-     *  transfer function.
      */
-    bool gammaCloseToSRGB() const;
+    bool gammaCloseToSRGB() const { return kSRGB_SkGammaNamed == fGammaNamed; }
 
     /**
      *  Returns true if the color space gamma is linear.
      */
-    bool gammaIsLinear() const;
+    bool gammaIsLinear() const { return kLinear_SkGammaNamed == fGammaNamed; }
 
     /**
      *  If the transfer function can be represented as coefficients to the standard
      *  equation, returns true and sets |fn| to the proper values.
      *
      *  If not, returns false.
      */
     bool isNumericalTransferFn(SkColorSpaceTransferFn* fn) const;
 
     /**
      *  Returns true and sets |toXYZD50| if the color gamut can be described as a matrix.
      *  Returns false otherwise.
      */
     bool toXYZD50(SkMatrix44* toXYZD50) const;
 
     /**
-     *  Describes color space gamut as a transformation to XYZ D50.
-     *  Returns nullptr if color gamut cannot be described in terms of XYZ D50.
-     */
-    const SkMatrix44* toXYZD50() const;
-
-    /**
-     *  Describes color space gamut as a transformation from XYZ D50
-     *  Returns nullptr if color gamut cannot be described in terms of XYZ D50.
+     *  Returns a hash of the gamut transformation to XYZ D50. Allows for fast equality checking
+     *  of gamuts, at the (very small) risk of collision.
      */
-    const SkMatrix44* fromXYZD50() const;
-
-    /**
-     *  Returns a hash of the gamut transofmration to XYZ D50. Allows for fast equality checking
-     *  of gamuts, at the (very small) risk of collision.
-     *  Returns 0 if color gamut cannot be described in terms of XYZ D50.
-     */
-    uint32_t toXYZD50Hash() const;
+    uint32_t toXYZD50Hash() const { return fToXYZD50Hash; }
 
     /**
      *  Returns a color space with the same gamut as this one, but with a linear gamma.
      *  For color spaces whose gamut can not be described in terms of XYZ D50, returns
      *  linear sRGB.
      */
-    virtual sk_sp<SkColorSpace> makeLinearGamma() const = 0;
+    sk_sp<SkColorSpace> makeLinearGamma() const;
 
     /**
      *  Returns a color space with the same gamut as this one, with with the sRGB transfer
      *  function. For color spaces whose gamut can not be described in terms of XYZ D50, returns
      *  sRGB.
      */
-    virtual sk_sp<SkColorSpace> makeSRGBGamma() const = 0;
+    sk_sp<SkColorSpace> makeSRGBGamma() const;
 
     /**
      *  Returns a color space with the same transfer function as this one, but with the primary
      *  colors rotated. For any XYZ space, this produces a new color space that maps RGB to GBR
      *  (when applied to a source), and maps RGB to BRG (when applied to a destination). For other
      *  types of color spaces, returns nullptr.
      *
      *  This is used for testing, to construct color spaces that have severe and testable behavior.
      */
-    virtual sk_sp<SkColorSpace> makeColorSpin() const { return nullptr; }
+    sk_sp<SkColorSpace> makeColorSpin() const;
 
     /**
      *  Returns true if the color space is sRGB.
      *  Returns false otherwise.
      *
      *  This allows a little bit of tolerance, given that we might see small numerical error
      *  in some cases: converting ICC fixed point to float, converting white point to D50,
      *  rounding decisions on transfer function and matrix.
@@ -234,40 +199,39 @@ public:
     size_t writeToMemory(void* memory) const;
 
     static sk_sp<SkColorSpace> Deserialize(const void* data, size_t length);
 
     /**
      *  If both are null, we return true.  If one is null and the other is not, we return false.
      *  If both are non-null, we do a deeper compare.
      */
-    static bool Equals(const SkColorSpace* src, const SkColorSpace* dst);
+    static bool Equals(const SkColorSpace*, const SkColorSpace*);
+
+    void       transferFn(float gabcdef[7]) const;
+    void    invTransferFn(float gabcdef[7]) const;
+    void gamutTransformTo(const SkColorSpace* dst, float src_to_dst_row_major[9]) const;
+
+    uint32_t transferFnHash() const { return fTransferFnHash; }
+    uint64_t           hash() const { return (uint64_t)fTransferFnHash << 32 | fToXYZD50Hash; }
 
 private:
-    virtual const SkMatrix44* onToXYZD50() const = 0;
-    virtual uint32_t onToXYZD50Hash() const = 0;
-    virtual const SkMatrix44* onFromXYZD50() const = 0;
+    friend class SkColorSpaceSingletonFactory;
 
-    virtual SkGammaNamed onGammaNamed() const = 0;
-    virtual bool onGammaCloseToSRGB() const = 0;
-    virtual bool onGammaIsLinear() const = 0;
-    virtual bool onIsNumericalTransferFn(SkColorSpaceTransferFn* coeffs) const = 0;
-    virtual bool onIsCMYK() const { return false; }
+    SkColorSpace(SkGammaNamed gammaNamed,
+                 const float transferFn[7],
+                 const SkMatrix44& toXYZ);
 
-    virtual const SkData* onProfileData() const { return nullptr; }
+    void computeLazyDstFields() const;
 
-    using INHERITED = SkRefCnt;
-};
+    SkGammaNamed                        fGammaNamed;         // TODO: 2-bit, pack tightly?  drop?
+    uint32_t                            fTransferFnHash;
+    uint32_t                            fToXYZD50Hash;
 
-enum class SkTransferFunctionBehavior {
-    /**
-     *  Converts to a linear space before premultiplying, unpremultiplying, or blending.
-     */
-    kRespect,
+    float                               fTransferFn[7];
+    float                               fToXYZD50_3x3[9];    // row-major
 
-    /**
-     *  Premultiplies, unpremultiplies, and blends ignoring the transfer function.  Pixels are
-     *  treated as if they are linear, regardless of their transfer function encoding.
-     */
-    kIgnore,
+    mutable float                       fInvTransferFn[7];
+    mutable float                       fFromXYZD50_3x3[9];  // row-major
+    mutable SkOnce                      fLazyDstFieldsOnce;
 };
 
 #endif
deleted file mode 100644
--- a/gfx/skia/skia/include/core/SkColorSpaceXform.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkColorSpaceXform_DEFINED
-#define SkColorSpaceXform_DEFINED
-
-#include "SkImageInfo.h"
-
-class SkColorSpace;
-
-class SK_API SkColorSpaceXform : SkNoncopyable {
-public:
-
-    /**
-     *  Create an object to handle color space conversions.
-     *
-     *  @param srcSpace The encoded color space.
-     *  @param dstSpace The destination color space.
-     *
-     */
-    static std::unique_ptr<SkColorSpaceXform> New(SkColorSpace* srcSpace, SkColorSpace* dstSpace);
-
-    enum ColorFormat {
-        kRGBA_8888_ColorFormat,
-        kBGRA_8888_ColorFormat,
-
-        // Unsigned, big-endian, 16-bit integer
-        kRGB_U16_BE_ColorFormat,   // Src only
-        kRGBA_U16_BE_ColorFormat,  // Src only
-
-        kRGBA_F16_ColorFormat,
-        kRGBA_F32_ColorFormat,
-
-        kBGR_565_ColorFormat,      // Dst only, kOpaque only
-    };
-
-    /**
-     *  Apply the color conversion to a |src| buffer, storing the output in the |dst| buffer.
-     *
-     *  F16 and F32 are only supported when the color space is linear. This function will return
-     *  false in unsupported cases.
-     *
-     *  @param dst            Stored in the format described by |dstColorFormat|
-     *  @param src            Stored in the format described by |srcColorFormat|
-     *  @param len            Number of pixels in the buffers
-     *  @param dstColorFormat Describes color format of |dst|
-     *  @param srcColorFormat Describes color format of |src|
-     *  @param alphaType      Describes alpha properties of the |dst| (and |src|)
-     *                        kUnpremul preserves input alpha values
-     *                        kPremul   performs a premultiplication and also preserves alpha values
-     *                        kOpaque   optimization hint, |dst| alphas set to 1
-     *
-     */
-    bool apply(ColorFormat dstFormat, void* dst, ColorFormat srcFormat, const void* src, int count,
-               SkAlphaType alphaType) const;
-
-    virtual ~SkColorSpaceXform() {}
-
-    enum AlphaOp {
-        kPreserve_AlphaOp,      // just transfer src-alpha to dst-alpha
-        kPremul_AlphaOp,        // like kPreserve, but multiplies RGB by it
-        kSrcIsOpaque_AlphaOp,   // src alphas are all 1, this is a perf hint
-    };
-    static bool Apply(SkColorSpace* dstCS, ColorFormat dstFormat, void* dst,
-                      SkColorSpace* srcCS, ColorFormat srcFormat, const void* src,
-                      int count, AlphaOp);
-
-protected:
-    SkColorSpaceXform() {}
-};
-
-#endif
--- a/gfx/skia/skia/include/core/SkCoverageMode.h
+++ b/gfx/skia/skia/include/core/SkCoverageMode.h
@@ -19,12 +19,12 @@
  */
 enum class SkCoverageMode {
     kUnion,             // A ∪ B    A+B-A*B
     kIntersect,         // A ∩ B    A*B
     kDifference,        // A - B    A*(1-B)
     kReverseDifference, // B - A    B*(1-A)
     kXor,               // A ⊕ B    A+B-2*A*B
 
-    kLast = kXor
+    kLast = kXor,
 };
 
 #endif
--- a/gfx/skia/skia/include/core/SkData.h
+++ b/gfx/skia/skia/include/core/SkData.h
@@ -164,20 +164,17 @@ private:
     void*       fPtr;
     size_t      fSize;
 
     SkData(const void* ptr, size_t size, ReleaseProc, void* context);
     explicit SkData(size_t size);   // inplace new/delete
     ~SkData();
 
     // Ensure the unsized delete is called.
-    void operator delete(void* p) { ::operator delete(p); }
-
-    // Called the first time someone calls NewEmpty to initialize the singleton.
-    friend SkData* sk_new_empty_data();
+    void operator delete(void* p);
 
     // shared internal factory
     static sk_sp<SkData> PrivateNewWithCopy(const void* srcOrNull, size_t length);
 
     static void DummyReleaseProc(const void*, void*); // {}
 
     typedef SkRefCnt INHERITED;
 };
--- a/gfx/skia/skia/include/core/SkDeferredDisplayListRecorder.h
+++ b/gfx/skia/skia/include/core/SkDeferredDisplayListRecorder.h
@@ -3,25 +3,31 @@
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 #ifndef SkDeferredDisplayListMaker_DEFINED
 #define SkDeferredDisplayListMaker_DEFINED
 
+#include "SkImageInfo.h"
 #include "SkRefCnt.h"
+#include "SkSurfaceCharacterization.h"
+#include "SkTypes.h"
 
 #include "../private/SkDeferredDisplayList.h"
-#include "../private/SkSurfaceCharacterization.h"
 
+class GrBackendFormat;
+class GrBackendTexture;
 class GrContext;
 
 class SkCanvas;
+class SkImage;
 class SkSurface;
+struct SkYUVAIndex;
 
 /*
  * This class is intended to be used as:
  *   Get an SkSurfaceCharacterization representing the intended gpu-backed destination SkSurface
  *   Create one of these (an SkDDLMaker) on the stack
  *   Get the canvas and render into it
  *   Snap off and hold on to an SkDeferredDisplayList
  *   Once your app actually needs the pixels, call SkSurface::draw(SkDeferredDisplayList*)
@@ -41,23 +47,103 @@ public:
 
     // The backing canvas will become invalid (and this entry point will return
     // null) once 'detach' is called.
     // Note: ownership of the SkCanvas is not transfered via this call.
     SkCanvas* getCanvas();
 
     std::unique_ptr<SkDeferredDisplayList> detach();
 
+    // Matches the defines in SkImage_Gpu.h
+    typedef void* TextureContext;
+    typedef void (*TextureReleaseProc)(TextureContext textureContext);
+    typedef void (*TextureFulfillProc)(TextureContext textureContext, GrBackendTexture* outTexture);
+    typedef void (*PromiseDoneProc)(TextureContext textureContext);
+
+    /**
+        Create a new SkImage that is very similar to an SkImage created by MakeFromTexture. The main
+        difference is that the client doesn't have the backend texture on the gpu yet but they know
+        all the properties of the texture. So instead of passing in a GrBackendTexture the client
+        supplies a GrBackendFormat, width, height, and GrMipMapped state.
+
+        When we actually send the draw calls to the GPU, we will call the textureFulfillProc and
+        the client will return a GrBackendTexture to us. The properties of the GrBackendTexture must
+        match those set during the SkImage creation, and it must have a valid backend gpu texture.
+        The gpu texture supplied by the client must stay valid until we call the textureReleaseProc.
+
+        When we are done with the texture returned by the textureFulfillProc we will call the
+        textureReleaseProc passing in the textureContext. This is a signal to the client that they
+        are free to delete the underlying gpu texture. If future draws also use the same promise
+        image we will call the textureFulfillProc again if we've already called the
+        textureReleaseProc. We will always call textureFulfillProc and textureReleaseProc in pairs.
+        In other words we will never call textureFulfillProc or textureReleaseProc multiple times
+        for the same textureContext before calling the other.
+
+        We call the promiseDoneProc when we will no longer call the textureFulfillProc again. We
+        pass in the textureContext as a parameter to the promiseDoneProc. We also guarantee that
+        there will be no outstanding textureReleaseProcs that still need to be called when we call
+        the textureDoneProc. Thus when the textureDoneProc gets called the client is able to cleanup
+        all GPU objects and meta data needed for the textureFulfill call.
+
+        This call is only valid if the SkDeferredDisplayListRecorder is backed by a gpu context.
+
+        @param backendFormat       format of promised gpu texture
+        @param width               width of promised gpu texture
+        @param height              height of promised gpu texture
+        @param mipMapped           mip mapped state of promised gpu texture
+        @param origin              one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
+        @param colorType           one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
+                                   kRGB_565_SkColorType, kARGB_4444_SkColorType,
+                                   kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+                                   kGray_8_SkColorType, kRGBA_F16_SkColorType
+        @param alphaType           one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
+                                   kPremul_SkAlphaType, kUnpremul_SkAlphaType
+        @param colorSpace          range of colors; may be nullptr
+        @param textureFulfillProc  function called to get actual gpu texture
+        @param textureReleaseProc  function called when texture can be released
+        @param promiseDoneProc     function called when we will no longer call textureFulfillProc
+        @param textureContext      state passed to textureFulfillProc and textureReleaseProc
+        @return                    created SkImage, or nullptr
+     */
+    sk_sp<SkImage> makePromiseTexture(const GrBackendFormat& backendFormat,
+                                      int width,
+                                      int height,
+                                      GrMipMapped mipMapped,
+                                      GrSurfaceOrigin origin,
+                                      SkColorType colorType,
+                                      SkAlphaType alphaType,
+                                      sk_sp<SkColorSpace> colorSpace,
+                                      TextureFulfillProc textureFulfillProc,
+                                      TextureReleaseProc textureReleaseProc,
+                                      PromiseDoneProc promiseDoneProc,
+                                      TextureContext textureContext);
+
+    /**
+        This entry point operates the same as 'makePromiseTexture' except that its
+        textureFulfillProc can be called up to four times to fetch the required YUVA
+        planes (passing a different textureContext to each call). So, if the 'yuvaIndices'
+        indicate that only the first two backend textures are used, 'textureFulfillProc' will
+        be called with the first two 'textureContexts'.
+     */
+    sk_sp<SkImage> makeYUVAPromiseTexture(SkYUVColorSpace yuvColorSpace,
+                                          const GrBackendFormat yuvaFormats[],
+                                          const SkYUVAIndex yuvaIndices[4],
+                                          int imageWidth,
+                                          int imageHeight,
+                                          GrSurfaceOrigin imageOrigin,
+                                          sk_sp<SkColorSpace> imageColorSpace,
+                                          TextureFulfillProc textureFulfillProc,
+                                          TextureReleaseProc textureReleaseProc,
+                                          PromiseDoneProc promiseDoneProc,
+                                          TextureContext textureContexts[]);
 private:
     bool init();
 
     const SkSurfaceCharacterization             fCharacterization;
 
-#ifndef SK_RASTER_RECORDER_IMPLEMENTATION
 #if SK_SUPPORT_GPU
     sk_sp<GrContext>                            fContext;
+    sk_sp<SkDeferredDisplayList::LazyProxyData> fLazyProxyData;
+    sk_sp<SkSurface>                            fSurface;
 #endif
-    sk_sp<SkDeferredDisplayList::LazyProxyData> fLazyProxyData;
-#endif
-    sk_sp<SkSurface>                            fSurface;
 };
 
 #endif
--- a/gfx/skia/skia/include/core/SkDeque.h
+++ b/gfx/skia/skia/include/core/SkDeque.h
@@ -5,16 +5,17 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 
 #ifndef SkDeque_DEFINED
 #define SkDeque_DEFINED
 
+#include "../private/SkNoncopyable.h"
 #include "SkTypes.h"
 
 /*
  * The deque class works by blindly creating memory space of a specified element
  * size. It manages the memory as a doubly linked list of blocks each of which
  * can contain multiple elements. Pushes and pops add/remove blocks from the
  * beginning/end of the list as necessary while each block tracks the used
  * portion of its memory.
@@ -61,17 +62,17 @@ public:
 private:
     struct Block;
 
 public:
     class Iter {
     public:
         enum IterStart {
             kFront_IterStart,
-            kBack_IterStart
+            kBack_IterStart,
         };
 
         /**
          * Creates an uninitialized iterator. Must be reset()
          */
         Iter();
 
         Iter(const SkDeque& d, IterStart startLoc);
--- a/gfx/skia/skia/include/core/SkDocument.h
+++ b/gfx/skia/skia/include/core/SkDocument.h
@@ -3,162 +3,38 @@
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 #ifndef SkDocument_DEFINED
 #define SkDocument_DEFINED
 
-#include "SkBitmap.h"
-#include "SkPicture.h"
-#include "SkRect.h"
 #include "SkRefCnt.h"
-#include "SkString.h"
-#include "SkTime.h"
+#include "SkScalar.h"
 
 class SkCanvas;
 class SkWStream;
+struct SkRect;
 
-#ifdef SK_BUILD_FOR_WIN
-struct IXpsOMObjectFactory;
-#endif
-
-/** SK_ScalarDefaultDPI is 72 DPI.
-*/
-#define SK_ScalarDefaultRasterDPI           72.0f
+/** SK_ScalarDefaultDPI is 72 dots per inch. */
+static constexpr SkScalar SK_ScalarDefaultRasterDPI = 72.0f;
 
 /**
  *  High-level API for creating a document-based canvas. To use..
  *
  *  1. Create a document, specifying a stream to store the output.
  *  2. For each "page" of content:
  *      a. canvas = doc->beginPage(...)
  *      b. draw_my_content(canvas);
  *      c. doc->endPage();
  *  3. Close the document with doc->close().
  */
 class SK_API SkDocument : public SkRefCnt {
 public:
-    struct OptionalTimestamp {
-        SkTime::DateTime fDateTime;
-        bool fEnabled;
-        OptionalTimestamp() : fEnabled(false) {}
-    };
-
-    /**
-     *  Optional metadata to be passed into the PDF factory function.
-     */
-    struct PDFMetadata {
-        /**
-         * The document's title.
-         */
-        SkString fTitle;
-        /**
-         * The name of the person who created the document.
-         */
-        SkString fAuthor;
-        /**
-         * The subject of the document.
-         */
-        SkString fSubject;
-        /**
-         * Keywords associated with the document.  Commas may be used
-         * to delineate keywords within the string.
-         */
-        SkString fKeywords;
-        /**
-         * If the document was converted to PDF from another format,
-         * the name of the conforming product that created the
-         * original document from which it was converted.
-         */
-        SkString fCreator;
-        /**
-         * The product that is converting this document to PDF.
-         *
-         * Leave fProducer empty to get the default, correct value.
-         */
-        SkString fProducer;
-        /**
-         * The date and time the document was created.
-         */
-        OptionalTimestamp fCreation;
-        /**
-         * The date and time the document was most recently modified.
-         */
-        OptionalTimestamp fModified;
-
-        /** The DPI (pixels-per-inch) at which features without
-         *  native PDF support will be rasterized (e.g. draw image
-         *  with perspective, draw text with perspective, ...)  A
-         *  larger DPI would create a PDF that reflects the
-         *  original intent with better fidelity, but it can make
-         *  for larger PDF files too, which would use more memory
-         *  while rendering, and it would be slower to be processed
-         *  or sent online or to printer.
-         */
-        SkScalar fRasterDPI = SK_ScalarDefaultRasterDPI;
-
-        /** If true, include XMP metadata, a document UUID, and sRGB output intent information.
-         *  This adds length to the document and makes it non-reproducable, but are necessary
-         *  features for PDF/A-2b conformance
-         */
-        bool fPDFA = false;
-
-        /**
-         *  Encoding quality controls the trade-off between size and quality. By default this is
-         *  set to 101 percent, which corresponds to lossless encoding. If this value is set to
-         *  a value <= 100, and the image is opaque, it will be encoded (using JPEG) with that
-         *  quality setting.
-         */
-        int fEncodingQuality = 101;
-    };
-
-    /**
-     *  Create a PDF-backed document, writing the results into a
-     *  SkWStream.
-     *
-     *  PDF pages are sized in point units. 1 pt == 1/72 inch == 127/360 mm.
-     *
-     *  @param stream A PDF document will be written to this stream.  The document may write
-     *         to the stream at anytime during its lifetime, until either close() is
-     *         called or the document is deleted.
-     *  @param metadata a PDFmetadata object.  Any fields may be left empty.
-     *
-     *  @returns NULL if there is an error, otherwise a newly created PDF-backed SkDocument.
-     */
-    static sk_sp<SkDocument> MakePDF(SkWStream* stream, const PDFMetadata& metadata);
-    static sk_sp<SkDocument> MakePDF(SkWStream* stream);
-
-#ifdef SK_BUILD_FOR_WIN
-    /**
-     *  Create a XPS-backed document, writing the results into the stream.
-     *
-     *  @param stream A XPS document will be written to this stream.  The
-     *                document may write to the stream at anytime during its
-     *                lifetime, until either close() or abort() are called or
-     *                the document is deleted.
-     *  @param xpsFactory A pointer to a COM XPS factory.  Must be non-null.
-     *                    The document will take a ref to the factory. See
-     *                    dm/DMSrcSink.cpp for an example.
-     *  @param dpi The DPI (pixels-per-inch) at which features without
-     *             native XPS support will be rasterized (e.g. draw image
-     *             with perspective, draw text with perspective, ...)  A
-     *             larger DPI would create a XPS that reflects the
-     *             original intent with better fidelity, but it can make
-     *             for larger XPS files too, which would use more memory
-     *             while rendering, and it would be slower to be processed
-     *             or sent online or to printer.
-     *
-     *  @returns nullptr if XPS is not supported.
-     */
-    static sk_sp<SkDocument> MakeXPS(SkWStream* stream,
-                                     IXpsOMObjectFactory* xpsFactory,
-                                     SkScalar dpi = SK_ScalarDefaultRasterDPI);
-#endif
 
     /**
      *  Begin a new page for the document, returning the canvas that will draw
      *  into the page. The document owns this canvas, and it will go out of
      *  scope when endPage() or close() is called, or the document is deleted.
      */
     SkCanvas* beginPage(SkScalar width, SkScalar height, const SkRect* content = nullptr);
 
deleted file mode 100644
--- a/gfx/skia/skia/include/core/SkDrawFilter.h
+++ /dev/null
@@ -1,55 +0,0 @@
-
-/*
- * Copyright 2011 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.
- */
-
-
-#ifndef SkDrawFilter_DEFINED
-#define SkDrawFilter_DEFINED
-
-#include "SkRefCnt.h"
-
-class SkCanvas;
-class SkPaint;
-
-/**
- *  DEPRECATED - use SkPaintFilterCanvas instead.
- *
- *  Right before something is being draw, filter() is called with the
- *  paint. The filter may modify the paint as it wishes, which will then be
- *  used for the actual drawing. Note: this modification only lasts for the
- *  current draw, as a temporary copy of the paint is used.
- */
-class SK_API SkDrawFilter : public SkRefCnt {
-public:
-    enum Type {
-        kPaint_Type,
-        kPoint_Type,
-        kLine_Type,
-        kBitmap_Type,
-        kRect_Type,
-        kRRect_Type,
-        kOval_Type,
-        kPath_Type,
-        kText_Type,
-    };
-
-    enum {
-        kTypeCount = kText_Type + 1
-    };
-
-    /**
-     *  Called with the paint that will be used to draw the specified type.
-     *  The implementation may modify the paint as they wish. If filter()
-     *  returns false, the draw will be skipped.
-     */
-    virtual bool filter(SkPaint*, Type) = 0;
-
-private:
-    typedef SkRefCnt INHERITED;
-};
-
-#endif
--- a/gfx/skia/skia/include/core/SkDrawLooper.h
+++ b/gfx/skia/skia/include/core/SkDrawLooper.h
@@ -5,16 +5,17 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 
 #ifndef SkDrawLooper_DEFINED
 #define SkDrawLooper_DEFINED
 
+#include "../private/SkNoncopyable.h"
 #include "SkBlurTypes.h"
 #include "SkFlattenable.h"
 #include "SkPoint.h"
 #include "SkColor.h"
 
 class  SkArenaAlloc;
 class  SkCanvas;
 class  SkColorSpaceXformer;
@@ -79,31 +80,42 @@ public:
     bool canComputeFastBounds(const SkPaint& paint) const;
     void computeFastBounds(const SkPaint& paint, const SkRect& src, SkRect* dst) const;
 
     struct BlurShadowRec {
         SkScalar        fSigma;
         SkVector        fOffset;
         SkColor         fColor;
         SkBlurStyle     fStyle;
-        SkBlurQuality   fQuality;
     };
     /**
      *  If this looper can be interpreted as having two layers, such that
      *      1. The first layer (bottom most) just has a blur and translate
      *      2. The second layer has no modifications to either paint or canvas
      *      3. No other layers.
      *  then return true, and if not null, fill out the BlurShadowRec).
      *
      *  If any of the above are not met, return false and ignore the BlurShadowRec parameter.
      */
     virtual bool asABlurShadow(BlurShadowRec*) const;
 
-    SK_TO_STRING_PUREVIRT()
-    SK_DEFINE_FLATTENABLE_TYPE(SkDrawLooper)
+    static SkFlattenable::Type GetFlattenableType() {
+        return kSkDrawLooper_Type;
+    }
+
+    SkFlattenable::Type getFlattenableType() const override {
+        return kSkDrawLooper_Type;
+    }
+
+    static sk_sp<SkDrawLooper> Deserialize(const void* data, size_t size,
+                                          const SkDeserialProcs* procs = nullptr) {
+        return sk_sp<SkDrawLooper>(static_cast<SkDrawLooper*>(
+                                  SkFlattenable::Deserialize(
+                                  kSkDrawLooper_Type, data, size, procs).release()));
+    }
 
 protected:
     sk_sp<SkDrawLooper> makeColorSpace(SkColorSpaceXformer* xformer) const {
         return this->onMakeColorSpace(xformer);
     }
     virtual sk_sp<SkDrawLooper> onMakeColorSpace(SkColorSpaceXformer*) const = 0;
 
     SkDrawLooper() {}
--- a/gfx/skia/skia/include/core/SkDrawable.h
+++ b/gfx/skia/skia/include/core/SkDrawable.h
@@ -55,17 +55,31 @@ public:
 
     /**
      *  Calling this invalidates the previous generation ID, and causes a new one to be computed
      *  the next time getGenerationID() is called. Typically this is called by the object itself,
      *  in response to its internal state changing.
      */
     void notifyDrawingChanged();
 
-    SK_DEFINE_FLATTENABLE_TYPE(SkDrawable)
+    static SkFlattenable::Type GetFlattenableType() {
+        return kSkDrawable_Type;
+    }
+
+    SkFlattenable::Type getFlattenableType() const override {
+        return kSkDrawable_Type;
+    }
+
+    static sk_sp<SkDrawable> Deserialize(const void* data, size_t size,
+                                          const SkDeserialProcs* procs = nullptr) {
+        return sk_sp<SkDrawable>(static_cast<SkDrawable*>(
+                                  SkFlattenable::Deserialize(
+                                  kSkDrawable_Type, data, size, procs).release()));
+    }
+
     Factory getFactory() const override { return nullptr; }
 
 protected:
     virtual SkRect onGetBounds() = 0;
     virtual void onDraw(SkCanvas*) = 0;
 
     /**
      *  Default implementation calls onDraw() with a canvas that records into a picture. Subclasses
--- a/gfx/skia/skia/include/core/SkFilterQuality.h
+++ b/gfx/skia/skia/include/core/SkFilterQuality.h
@@ -15,12 +15,12 @@
  *  e.g. images
  */
 enum SkFilterQuality {
     kNone_SkFilterQuality,      //!< fastest but lowest quality, typically nearest-neighbor
     kLow_SkFilterQuality,       //!< typically bilerp
     kMedium_SkFilterQuality,    //!< typically bilerp + mipmaps for down-scaling
     kHigh_SkFilterQuality,      //!< slowest but highest quality, typically bicubic or better
 
-    kLast_SkFilterQuality = kHigh_SkFilterQuality
+    kLast_SkFilterQuality = kHigh_SkFilterQuality,
 };
 
 #endif
--- a/gfx/skia/skia/include/core/SkFlattenable.h
+++ b/gfx/skia/skia/include/core/SkFlattenable.h
@@ -12,71 +12,16 @@
 
 class SkData;
 class SkReadBuffer;
 class SkWriteBuffer;
 
 struct SkSerialProcs;
 struct SkDeserialProcs;
 
-/*
- *  Flattening is straight-forward:
- *      1. call getFactory() so we have a function-ptr to recreate the subclass
- *      2. call flatten(buffer) to write out enough data for the factory to read
- *
- *  Unflattening is easy for the caller: new_instance = factory(buffer)
- *
- *  The complexity of supporting this is as follows.
- *
- *  If your subclass wants to control unflattening, use this macro in your declaration:
- *      SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS
- *  This will provide a getFactory(), and require that the subclass implements CreateProc.
- *
- *  For older buffers (before the DEEPFLATTENING change, the macros below declare
- *  a thin factory DeepCreateProc. It checks the version of the buffer, and if it is pre-deep,
- *  then it calls through to a (usually protected) constructor, passing the buffer.
- *  If the buffer is newer, then it directly calls the "real" factory: CreateProc.
- */
-
-#define SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() static void InitializeFlattenables();
-
-#define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(flattenable) \
-    void flattenable::InitializeFlattenables() {
-
-#define SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END \
-    }
-
-#define SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(flattenable) \
-    SkFlattenable::Register(#flattenable, flattenable::CreateProc, \
-                            flattenable::GetFlattenableType());
-
-#define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable)    \
-    private:                                                                \
-    static sk_sp<SkFlattenable> CreateProc(SkReadBuffer&);                        \
-    friend class SkFlattenable::PrivateInitializer;                         \
-    public:                                                                 \
-    Factory getFactory() const override { return CreateProc; }
-
-/** For SkFlattenable derived objects with a valid type
-    This macro should only be used in base class objects in core
-  */
-#define SK_DEFINE_FLATTENABLE_TYPE(flattenable) \
-    static Type GetFlattenableType() {          \
-        return k##flattenable##_Type;           \
-    }                                           \
-    Type getFlattenableType() const override {  \
-        return k##flattenable##_Type;           \
-    }                                           \
-    static sk_sp<flattenable> Deserialize(const void* data, size_t size,                \
-                                          const SkDeserialProcs* procs = nullptr) {     \
-        return sk_sp<flattenable>(static_cast<flattenable*>(                            \
-                                  SkFlattenable::Deserialize(                           \
-                                  k##flattenable##_Type, data, size, procs).release()));\
-    }
-
 /** \class SkFlattenable
 
  SkFlattenable is the base class for objects that need to be flattened
  into a data stream for either transport or as part of the key to the
  font cache.
  */
 class SK_API SkFlattenable : public SkRefCnt {
 public:
@@ -87,17 +32,17 @@ public:
         kSkImageFilter_Type,
         kSkMaskFilter_Type,
         kSkPathEffect_Type,
         kSkPixelRef_Type,
         kSkUnused_Type4,    // used to be SkRasterizer
         kSkShaderBase_Type,
         kSkUnused_Type,     // used to be SkUnitMapper
         kSkUnused_Type2,
-        kSkUnused_Type3,    // used to be SkNormalSource
+        kSkNormalSource_Type,
     };
 
     typedef sk_sp<SkFlattenable> (*Factory)(SkReadBuffer&);
 
     SkFlattenable() {}
 
     /** Implement this to return a factory function pointer that can be called
      to recreate your class given a buffer (previously written to by your
@@ -108,17 +53,25 @@ public:
     /**
      *  Returns the name of the object's class.
      *
      *  Subclasses should override this function if they intend to provide
      *  support for flattening without using the global registry.
      *
      *  If the flattenable is registered, there is no need to override.
      */
-    virtual const char* getTypeName() const { return FactoryToName(getFactory()); }
+    virtual const char* getTypeName() const {
+    #ifdef SK_DISABLE_READBUFFER
+        // Should not be reachable by PathKit WebAssembly Code.
+        SkASSERT(false);
+        return nullptr;
+    #else
+        return FactoryToName(getFactory());
+    #endif
+    }
 
     static Factory NameToFactory(const char name[]);
     static const char* FactoryToName(Factory);
     static bool NameToType(const char name[], Type* type);
 
     static void Register(const char name[], Factory, Type);
 
     /**
@@ -130,24 +83,27 @@ public:
     virtual void flatten(SkWriteBuffer&) const {}
 
     virtual Type getFlattenableType() const = 0;
 
     //
     // public ways to serialize / deserialize
     //
     sk_sp<SkData> serialize(const SkSerialProcs* = nullptr) const;
+    size_t serialize(void* memory, size_t memory_size,
+                     const SkSerialProcs* = nullptr) const;
     static sk_sp<SkFlattenable> Deserialize(Type, const void* data, size_t length,
                                             const SkDeserialProcs* procs = nullptr);
 
 protected:
     class PrivateInitializer {
     public:
         static void InitCore();
         static void InitEffects();
+        static void InitImageFilters();
     };
 
 private:
     static void InitializeFlattenablesIfNeeded();
     static void Finalize();
 
     friend class SkGraphics;
 
--- a/gfx/skia/skia/include/core/SkFont.h
+++ b/gfx/skia/skia/include/core/SkFont.h
@@ -24,47 +24,39 @@ enum SkTextEncoding {
 /*
  1. The Hinting enum in SkPaint is gone entirely, absorbed into SkFont's flags.
 
  2. SkPaint Flags look like this today
 
  enum Flags {
      kAntiAlias_Flag       = 0x01,   //!< mask to enable antialiasing
      kDither_Flag          = 0x04,   //!< mask to enable dithering
-     kUnderlineText_Flag   = 0x08,   //!< mask to enable underline text
-     kStrikeThruText_Flag  = 0x10,   //!< mask to enable strike-thru text
      kFakeBoldText_Flag    = 0x20,   //!< mask to enable fake-bold text
      kLinearText_Flag      = 0x40,   //!< mask to enable linear-text
      kSubpixelText_Flag    = 0x80,   //!< mask to enable subpixel text positioning
-     kDevKernText_Flag     = 0x100,  //!< mask to enable device kerning text
      kLCDRenderText_Flag   = 0x200,  //!< mask to enable subpixel glyph renderering
      kEmbeddedBitmapText_Flag = 0x400, //!< mask to enable embedded bitmap strikes
      kAutoHinting_Flag     = 0x800,  //!< mask to force Freetype's autohinter
      kVerticalText_Flag    = 0x1000,
-     kGenA8FromLCD_Flag    = 0x2000, // hack for GDI -- do not use if you can help it
  };
 
  SkFont would absorb these:
 
      kFakeBoldText_Flag    = 0x20,   //!< mask to enable fake-bold text
      kLinearText_Flag      = 0x40,   //!< mask to enable linear-text
      kSubpixelText_Flag    = 0x80,   //!< mask to enable subpixel text positioning
-     kDevKernText_Flag     = 0x100,  //!< mask to enable device kerning text
      kLCDRenderText_Flag   = 0x200,  //!< mask to enable subpixel glyph renderering
      kEmbeddedBitmapText_Flag = 0x400, //!< mask to enable embedded bitmap strikes
      kAutoHinting_Flag     = 0x800,  //!< mask to force Freetype's autohinter
      kVerticalText_Flag    = 0x1000,
-     kGenA8FromLCD_Flag    = 0x2000, // hack for GDI -- do not use if you can help it
 
  leaving these still in paint
 
      kAntiAlias_Flag       = 0x01,   //!< mask to enable antialiasing
      kDither_Flag          = 0x04,   //!< mask to enable dithering
-     kUnderlineText_Flag   = 0x08,   //!< mask to enable underline text
-     kStrikeThruText_Flag  = 0x10,   //!< mask to enable strike-thru text
 
  3. Antialiasing
 
     SkFont has a mask-type: BW, AA, LCD
     SkPaint has antialias boolean
 
     What to do if the font's mask-type disagrees with the paint?
 
@@ -101,19 +93,18 @@ public:
          *  nearest integer.
          *
          *  This applies to calls that return metrics (e.g. measureText) and to drawing the glyphs
          *  (see SkCanvas drawText and drawPosText).
          */
         kUseNonlinearMetrics_Flag   = 1 << 3,
 
         kVertical_Flag              = 1 << 4,
-        kGenA8FromLCD_Flag          = 1 << 5,
+
         kEmbolden_Flag              = 1 << 6,
-        kDevKern_Flag               = 1 << 7,   // ifdef ANDROID ?
     };
 
     enum MaskType {
         kBW_MaskType,
         kA8_MaskType,
         kLCD_MaskType,
     };
 
@@ -138,33 +129,30 @@ public:
     uint32_t    getFlags() const { return fFlags; }
     MaskType    getMaskType() const { return (MaskType)fMaskType; }
 
     bool isVertical() const { return SkToBool(fFlags & kVertical_Flag); }
     bool isEmbolden() const { return SkToBool(fFlags & kEmbolden_Flag); }
     bool isEnableAutoHints() const { return SkToBool(fFlags & kEnableAutoHints_Flag); }
     bool isEnableByteCodeHints() const { return SkToBool(fFlags & kEnableByteCodeHints_Flag); }
     bool isUseNonLinearMetrics() const { return SkToBool(fFlags & kUseNonlinearMetrics_Flag); }
-    bool isDevKern() const { return SkToBool(fFlags & kDevKern_Flag); }
 
     int textToGlyphs(const void* text, size_t byteLength, SkTextEncoding,
                      SkGlyphID glyphs[], int maxGlyphCount) const;
 
     int countText(const void* text, size_t byteLength, SkTextEncoding encoding) {
         return this->textToGlyphs(text, byteLength, encoding, nullptr, 0);
     }
 
     SkScalar measureText(const void* text, size_t byteLength, SkTextEncoding) const;
 
     static sk_sp<SkFont> Testing_CreateFromPaint(const SkPaint&);
 
 private:
-    enum {
-        kAllFlags = 0xFF,
-    };
+    static constexpr int kAllFlags = 0xFF;
 
     SkFont(sk_sp<SkTypeface>, SkScalar size, SkScalar scaleX, SkScalar skewX, MaskType,
            uint32_t flags);
 
     sk_sp<SkTypeface> fTypeface;
     SkScalar    fSize;
     SkScalar    fScaleX;
     SkScalar    fSkewX;
--- a/gfx/skia/skia/include/core/SkFontArguments.h
+++ b/gfx/skia/skia/include/core/SkFontArguments.h
@@ -1,35 +1,35 @@
 /*
  * Copyright 2017 Google Inc.
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
-#ifndef SkFontAgruments_DEFINED
-#define SkFontAgruments_DEFINED
+#ifndef SkFontArguments_DEFINED
+#define SkFontArguments_DEFINED
 
 #include "SkScalar.h"
 #include "SkTypes.h"
 
 /** Represents a set of actual arguments for a font. */
 struct SkFontArguments {
     struct VariationPosition {
         struct Coordinate {
             SkFourByteTag axis;
-            SkScalar value;
+            float value;
         };
         const Coordinate* coordinates;
         int coordinateCount;
     };
-    // deprecated, use VariationCoordinate instead
+    // deprecated, use VariationPosition::Coordinate instead
     struct Axis {
        SkFourByteTag fTag;
-       SkScalar fStyleValue;
+       float fStyleValue;
     };
 
     SkFontArguments() : fCollectionIndex(0), fVariationDesignPosition{nullptr, 0} {}
 
     /** Specify the index of the desired font.
      *
      *  Font formats like ttc, dfont, cff, cid, pfr, t42, t1, and fon may actually be indexed
      *  collections of fonts.
--- a/gfx/skia/skia/include/core/SkFontLCDConfig.h
+++ b/gfx/skia/skia/include/core/SkFontLCDConfig.h
@@ -18,17 +18,17 @@ public:
 
         Note, if you change this after startup, you'll need to flush the glyph
         cache because it'll have the wrong type of masks cached.
 
         @deprecated use SkPixelGeometry instead.
     */
     enum LCDOrientation {
         kHorizontal_LCDOrientation = 0,    //!< this is the default
-        kVertical_LCDOrientation   = 1
+        kVertical_LCDOrientation   = 1,
     };
 
     /** @deprecated set on Device creation. */
     static void SetSubpixelOrientation(LCDOrientation orientation);
     /** @deprecated get from Device. */
     static LCDOrientation GetSubpixelOrientation();
 
     /** LCD color elements can vary in order. For subpixel text we need to know
@@ -41,17 +41,17 @@ public:
         kNONE_LCDOrder means that the subpixel elements are not spatially
         separated in any usable fashion.
 
         @deprecated use SkPixelGeometry instead.
      */
     enum LCDOrder {
         kRGB_LCDOrder = 0,    //!< this is the default
         kBGR_LCDOrder = 1,
-        kNONE_LCDOrder = 2
+        kNONE_LCDOrder = 2,
     };
 
     /** @deprecated set on Device creation. */
     static void SetSubpixelOrder(LCDOrder order);
     /** @deprecated get from Device. */
     static LCDOrder GetSubpixelOrder();
 };
 
new file mode 100644
--- /dev/null
+++ b/gfx/skia/skia/include/core/SkFontMgr.h
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkFontMgr_DEFINED
+#define SkFontMgr_DEFINED
+
+#include "SkFontArguments.h"
+#include "SkFontStyle.h"
+#include "SkRefCnt.h"
+#include "SkTypes.h"
+
+class SkData;
+class SkFontData;
+class SkStreamAsset;
+class SkString;
+class SkTypeface;
+
+class SK_API SkFontStyleSet : public SkRefCnt {
+public:
+    virtual int count() = 0;
+    virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0;
+    virtual SkTypeface* createTypeface(int index) = 0;
+    virtual SkTypeface* matchStyle(const SkFontStyle& pattern) = 0;
+
+    static SkFontStyleSet* CreateEmpty();
+
+protected:
+    SkTypeface* matchStyleCSS3(const SkFontStyle& pattern);
+
+private:
+    typedef SkRefCnt INHERITED;
+};
+
+class SK_API SkFontMgr : public SkRefCnt {
+public:
+    int countFamilies() const;
+    void getFamilyName(int index, SkString* familyName) const;
+    SkFontStyleSet* createStyleSet(int index) const;
+
+    /**
+     *  The caller must call unref() on the returned object.
+     *  Never returns NULL; will return an empty set if the name is not found.
+     *
+     *  Passing nullptr as the parameter will return the default system family.
+     *  Note that most systems don't have a default system family, so passing nullptr will often
+     *  result in the empty set.
+     *
+     *  It is possible that this will return a style set not accessible from
+     *  createStyleSet(int) due to hidden or auto-activated fonts.
+     */
+    SkFontStyleSet* matchFamily(const char familyName[]) const;
+
+    /**
+     *  Find the closest matching typeface to the specified familyName and style
+     *  and return a ref to it. The caller must call unref() on the returned
+     *  object. Will return nullptr if no 'good' match is found.
+     *
+     *  Passing |nullptr| as the parameter for |familyName| will return the
+     *  default system font.
+     *
+     *  It is possible that this will return a style set not accessible from
+     *  createStyleSet(int) or matchFamily(const char[]) due to hidden or
+     *  auto-activated fonts.
+     */
+    SkTypeface* matchFamilyStyle(const char familyName[], const SkFontStyle&) const;
+
+    /**
+     *  Use the system fallback to find a typeface for the given character.
+     *  Note that bcp47 is a combination of ISO 639, 15924, and 3166-1 codes,
+     *  so it is fine to just pass a ISO 639 here.
+     *
+     *  Will return NULL if no family can be found for the character
+     *  in the system fallback.
+     *
+     *  Passing |nullptr| as the parameter for |familyName| will return the
+     *  default system font.
+     *
+     *  bcp47[0] is the least significant fallback, bcp47[bcp47Count-1] is the
+     *  most significant. If no specified bcp47 codes match, any font with the
+     *  requested character will be matched.
+     */
+    SkTypeface* matchFamilyStyleCharacter(const char familyName[], const SkFontStyle&,
+                                          const char* bcp47[], int bcp47Count,
+                                          SkUnichar character) const;
+
+    SkTypeface* matchFaceStyle(const SkTypeface*, const SkFontStyle&) const;
+
+    /**
+     *  Create a typeface for the specified data and TTC index (pass 0 for none)
+     *  or NULL if the data is not recognized. The caller must call unref() on
+     *  the returned object if it is not null.
+     */
+    sk_sp<SkTypeface> makeFromData(sk_sp<SkData>, int ttcIndex = 0) const;
+
+    /**
+     *  Create a typeface for the specified stream and TTC index
+     *  (pass 0 for none) or NULL if the stream is not recognized. The caller
+     *  must call unref() on the returned object if it is not null.
+     */
+    sk_sp<SkTypeface> makeFromStream(std::unique_ptr<SkStreamAsset>, int ttcIndex = 0) const;
+
+    /* Experimental, API subject to change. */
+    sk_sp<SkTypeface> makeFromStream(std::unique_ptr<SkStreamAsset>, const SkFontArguments&) const;
+
+    /**
+     *  Create a typeface from the specified font data.
+     *  Will return NULL if the typeface could not be created.
+     *  The caller must call unref() on the returned object if it is not null.
+     */
+    sk_sp<SkTypeface> makeFromFontData(std::unique_ptr<SkFontData>) const;
+
+    /**
+     *  Create a typeface for the specified fileName and TTC index
+     *  (pass 0 for none) or NULL if the file is not found, or its contents are
+     *  not recognized. The caller must call unref() on the returned object
+     *  if it is not null.
+     */
+    sk_sp<SkTypeface> makeFromFile(const char path[], int ttcIndex = 0) const;
+
+    sk_sp<SkTypeface> legacyMakeTypeface(const char familyName[], SkFontStyle style) const;
+
+    /** Return the default fontmgr. */
+    static sk_sp<SkFontMgr> RefDefault();
+
+protected:
+    virtual int onCountFamilies() const = 0;
+    virtual void onGetFamilyName(int index, SkString* familyName) const = 0;
+    virtual SkFontStyleSet* onCreateStyleSet(int index)const  = 0;
+
+    /** May return NULL if the name is not found. */
+    virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const = 0;
+
+    virtual SkTypeface* onMatchFamilyStyle(const char familyName[],
+                                           const SkFontStyle&) const = 0;
+    virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&,
+                                                    const char* bcp47[], int bcp47Count,
+                                                    SkUnichar character) const = 0;
+    virtual SkTypeface* onMatchFaceStyle(const SkTypeface*,
+                                         const SkFontStyle&) const = 0;
+
+    virtual sk_sp<SkTypeface> onMakeFromData(sk_sp<SkData>, int ttcIndex) const = 0;
+    virtual sk_sp<SkTypeface> onMakeFromStreamIndex(std::unique_ptr<SkStreamAsset>,
+                                                    int ttcIndex) const = 0;
+    virtual sk_sp<SkTypeface> onMakeFromStreamArgs(std::unique_ptr<SkStreamAsset>,
+                                                   const SkFontArguments&) const;
+    virtual sk_sp<SkTypeface> onMakeFromFontData(std::unique_ptr<SkFontData>) const;
+    virtual sk_sp<SkTypeface> onMakeFromFile(const char path[], int ttcIndex) const = 0;
+
+    virtual sk_sp<SkTypeface> onLegacyMakeTypeface(const char familyName[], SkFontStyle) const = 0;
+
+private:
+
+    /** Implemented by porting layer to return the default factory. */
+    static sk_sp<SkFontMgr> Factory();
+
+    typedef SkRefCnt INHERITED;
+};
+
+#endif
new file mode 100644
--- /dev/null
+++ b/gfx/skia/skia/include/core/SkFontParameters.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkFontParameters_DEFINED
+#define SkFontParameters_DEFINED
+
+#include "SkScalar.h"
+#include "SkTypes.h"
+
+struct SkFontParameters {
+    struct Variation {
+        // Parameters in a variation font axis.
+        struct Axis {
+            // Four character identifier of the font axis (weight, width, slant, italic...).
+            SkFourByteTag tag;
+            // Minimum value supported by this axis.
+            float min;
+            // Default value set by this axis.
+            float def;
+            // Maximum value supported by this axis. The maximum can equal the minimum.
+            float max;
+            // Return whether this axis is recommended to be remain hidden in user interfaces.
+            bool isHidden() const { return flags & HIDDEN; }
+            // Set this axis to be remain hidden in user interfaces.
+            void setHidden(bool hidden) { flags = hidden ? (flags | HIDDEN) : (flags & ~HIDDEN); }
+        private:
+            static constexpr uint16_t HIDDEN = 0x0001;
+            // Attributes for a font axis.
+            uint16_t flags;
+        };
+    };
+};
+
+#endif
--- a/gfx/skia/skia/include/core/SkGraphics.h
+++ b/gfx/skia/skia/include/core/SkGraphics.h
@@ -156,36 +156,16 @@ public:
      *  as cache sizes, here, for instance:
      *  font-cache-limit=12345678
      *
      *  The flags format is name=value[;name=value...] with no spaces.
      *  This format is subject to change.
      */
     static void SetFlags(const char* flags);
 
-    /**
-     *  Return the max number of bytes that should be used by the thread-local
-     *  font cache.
-     *  If the cache needs to allocate more, it will purge previous entries.
-     *  This max can be changed by calling SetFontCacheLimit().
-     *
-     *  If this thread has never called SetTLSFontCacheLimit, or has called it
-     *  with 0, then this thread is using the shared font cache. In that case,
-     *  this function will always return 0, and the caller may want to call
-     *  GetFontCacheLimit.
-     */
-    static size_t GetTLSFontCacheLimit();
-
-    /**
-     *  Specify the max number of bytes that should be used by the thread-local
-     *  font cache. If this value is 0, then this thread will use the shared
-     *  global font cache.
-     */
-    static void SetTLSFontCacheLimit(size_t bytes);
-
     typedef std::unique_ptr<SkImageGenerator>
                                             (*ImageGeneratorFromEncodedDataFactory)(sk_sp<SkData>);
 
     /**
      *  To instantiate images from encoded data, first looks at this runtime function-ptr. If it
      *  exists, it is called to create an SkImageGenerator from SkData. If there is no function-ptr
      *  or there is, but it returns NULL, then skia will call its internal default implementation.
      *
--- a/gfx/skia/skia/include/core/SkICC.h
+++ b/gfx/skia/skia/include/core/SkICC.h
@@ -4,106 +4,35 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 #ifndef SkICC_DEFINED
 #define SkICC_DEFINED
 
 #include "SkData.h"
+#include "SkMatrix44.h"
 #include "SkRefCnt.h"
 
 struct SkColorSpaceTransferFn;
-class SkColorSpace;
-class SkData;
-class SkMatrix44;
 
-class SK_API SkICC : public SkRefCnt {
-public:
-
-    /**
-     *  Parse an ICC profile.
-     *
-     *  Returns nullptr if the data is not a valid ICC profile or if the profile
-     *  input space is not RGB.
-     */
-    static sk_sp<SkICC> Make(const void*, size_t);
+SK_API sk_sp<SkData> SkWriteICCProfile(const SkColorSpaceTransferFn&, const float toXYZD50[9]);
 
-    /**
-     *  If the gamut can be represented as transformation into XYZ D50, returns
-     *  true and sets the proper values in |toXYZD50|.
-     *
-     *  If not, returns false.  This indicates that the ICC data is too complex
-     *  to isolate a simple gamut transformation.
-     */
-    bool toXYZD50(SkMatrix44* toXYZD50) const;
-
-    /**
-     *  If the transfer function can be represented as coefficients to the standard
-     *  equation, returns true and sets |fn| to the proper values.
-     *
-     *  If not, returns false.  This indicates one of the following:
-     *  (1) The R, G, and B transfer functions are not the same.
-     *  (2) The transfer function is represented as a table that we have not managed
-     *      to match to a standard curve.
-     *  (3) The ICC data is too complex to isolate a single transfer function.
-     */
-    bool isNumericalTransferFn(SkColorSpaceTransferFn* fn) const;
+namespace SkICC {
+    static inline sk_sp<SkData> WriteToICC(const SkColorSpaceTransferFn& fn,
+                                           const SkMatrix44& toXYZD50) {
+        if (toXYZD50.get(3,0) == 0 && toXYZD50.get(3,1) == 0 && toXYZD50.get(3,2) == 0 &&
+            toXYZD50.get(3,3) == 1 &&
+            toXYZD50.get(0,3) == 0 && toXYZD50.get(1,3) == 0 && toXYZD50.get(2,3) == 0) {
 
-    /**
-     *  Please do not call this unless isNumericalTransferFn() has been called and it
-     *  fails.  SkColorSpaceTransferFn is the preferred representation.
-     *
-     *  If it is not possible to represent the R, G, and B transfer functions numerically
-     *  and it is still necessary to get the transfer function, this will return the
-     *  transfer functions as three tables (R, G, and B).
-     *
-     *  If possible, this will return tables of the same length as they were specified in
-     *  the ICC profile.  This means that the lengths of the three tables are not
-     *  guaranteed to be the same.  If the ICC representation was not a table, the length
-     *  will be chosen arbitrarily.
-     *
-     *  The lengths of the tables are all guaranteed to be at least 2.  Entries in the
-     *  tables are guaranteed to be in [0, 1].
-     *
-     *  This API may be deleted in favor of a numerical approximation of the raw data.
-     *
-     *  This function may fail, indicating that the ICC profile does not have transfer
-     *  functions.
-     */
-    struct Channel {
-        // Byte offset of the start of the table in |fStorage|
-        size_t fOffset;
-        int    fCount;
-    };
-    struct Tables {
-        Channel fRed;
-        Channel fGreen;
-        Channel fBlue;
+            float m33[9];
+            for (int r = 0; r < 3; r++)
+            for (int c = 0; c < 3; c++) {
+                m33[3*r+c] = toXYZD50.get(r,c);
+            }
+            return SkWriteICCProfile(fn, m33);
 
-        const float* red() {
-            return (const float*) (fStorage->bytes() + fRed.fOffset);
         }
-        const float* green() {
-            return (const float*) (fStorage->bytes() + fGreen.fOffset);
-        }
-        const float* blue() {
-            return (const float*) (fStorage->bytes() + fBlue.fOffset);
-        }
-
-        sk_sp<SkData> fStorage;
-    };
-    bool rawTransferFnData(Tables* tables) const;
+        return nullptr;
+    }
+}
 
-    /**
-     *  Write an ICC profile with transfer function |fn| and gamut |toXYZD50|.
-     */
-    static sk_sp<SkData> WriteToICC(const SkColorSpaceTransferFn& fn, const SkMatrix44& toXYZD50);
-
-private:
-    SkICC(sk_sp<SkColorSpace> colorSpace);
-
-    sk_sp<SkColorSpace> fColorSpace;
-
-    friend class ICCTest;
-};
-
-#endif
+#endif//SkICC_DEFINED
--- a/gfx/skia/skia/include/core/SkImage.h
+++ b/gfx/skia/skia/include/core/SkImage.h
@@ -1,15 +1,25 @@
 /*
  * Copyright 2012 Google Inc.
  *
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
+/* Generated by tools/bookmaker from include/core/SkImage.h and docs/SkImage_Reference.bmh
+   on 2018-09-18 07:26:44. Additional documentation and examples can be found at:
+   https://skia.org/user/api/SkImage_Reference
+
+   You may edit either file directly. Structural changes to public interfaces require
+   editing both files. After editing docs/SkImage_Reference.bmh, run:
+       bookmaker -b docs -i include/core/SkImage.h -p
+   to create an updated version of this file.
+ */
+
 #ifndef SkImage_DEFINED
 #define SkImage_DEFINED
 
 #include "GrTypes.h"
 #include "SkFilterQuality.h"
 #include "SkImageInfo.h"
 #include "SkImageEncoder.h"
 #include "SkRefCnt.h"
@@ -28,16 +38,18 @@ class SkPaint;
 class SkPicture;
 class SkString;
 class SkSurface;
 class GrBackendTexture;
 class GrContext;
 class GrContextThreadSafeProxy;
 class GrTexture;
 
+struct SkYUVAIndex;
+
 /** \class SkImage
     SkImage describes a two dimensional array of pixels to draw. The pixels may be
     decoded in a raster bitmap, encoded in a SkPicture or compressed data stream,
     or located in GPU memory as a GPU texture.
 
     SkImage cannot be modified after it is created. SkImage may allocate additional
     storage as needed; for instance, an encoded SkImage may decode when drawn.
 
@@ -46,17 +58,19 @@ class GrTexture;
 
     SkImage may be created from SkBitmap, SkPixmap, SkSurface, SkPicture, encoded streams,
     GPU texture, YUV_ColorSpace data, or hardware buffer. Encoded streams supported
     include BMP, GIF, HEIF, ICO, JPEG, PNG, WBMP, WebP. Supported encoding details
     vary with platform.
 */
 class SK_API SkImage : public SkRefCnt {
 public:
-    typedef SkImageInfo Info;
+
+    /** Caller data passed to RasterReleaseProc; may be nullptr.
+    */
     typedef void* ReleaseContext;
 
     /** Creates SkImage from SkPixmap and copy of pixels. Since pixels are copied, SkPixmap
         pixels may be modified or deleted without affecting SkImage.
 
         SkImage is returned if SkPixmap is valid. Valid SkPixmap parameters include:
         dimensions are greater than zero;
         each dimension fits in 29 bits;
@@ -78,18 +92,22 @@ public:
         rowBytes are large enough to hold one row of pixels;
         pixels is not nullptr, and contains enough data for SkImage.
 
         @param info      contains width, height, SkAlphaType, SkColorType, SkColorSpace
         @param pixels    address or pixel storage
         @param rowBytes  size of pixel row or larger
         @return          SkImage sharing pixels, or nullptr
     */
-    static sk_sp<SkImage> MakeRasterData(const Info& info, sk_sp<SkData> pixels, size_t rowBytes);
+    static sk_sp<SkImage> MakeRasterData(const SkImageInfo& info, sk_sp<SkData> pixels,
+                                         size_t rowBytes);
 
+    /** Function called when SkImage no longer shares pixels. ReleaseContext is
+        provided by caller when SkImage is created, and may be nullptr.
+    */
     typedef void (*RasterReleaseProc)(const void* pixels, ReleaseContext);
 
     /** Creates SkImage from pixmap, sharing SkPixmap pixels. Pixels must remain valid and
         unchanged until rasterReleaseProc is called. rasterReleaseProc is passed
         releaseContext when SkImage is deleted or no longer refers to pixmap pixels.
 
         Pass nullptr for rasterReleaseProc to share SkPixmap without requiring a callback
         when SkImage is released. Pass nullptr for releaseContext if rasterReleaseProc
@@ -153,54 +171,37 @@ public:
         Recognized formats vary by platform.
 
         @param encoded  data of SkImage to decode
         @param subset   bounds of returned SkImage; may be nullptr
         @return         created SkImage, or nullptr
     */
     static sk_sp<SkImage> MakeFromEncoded(sk_sp<SkData> encoded, const SkIRect* subset = nullptr);
 
-    typedef void (*TextureReleaseProc)(ReleaseContext releaseContext);
-
-    /** Deprecated.
+    /** User function called when supplied texture may be deleted.
     */
-    static sk_sp<SkImage> MakeFromTexture(GrContext* context,
-                                          const GrBackendTexture& backendTexture,
-                                          GrSurfaceOrigin origin,
-                                          SkAlphaType alphaType,
-                                          sk_sp<SkColorSpace> colorSpace) {
-        return MakeFromTexture(context, backendTexture, origin, alphaType, colorSpace, nullptr,
-                               nullptr);
-    }
-
-    /** Deprecated.
-    */
-    static sk_sp<SkImage> MakeFromTexture(GrContext* context,
-                                          const GrBackendTexture& backendTexture,
-                                          GrSurfaceOrigin origin,
-                                          SkAlphaType alphaType,
-                                          sk_sp<SkColorSpace> colorSpace,
-                                          TextureReleaseProc textureReleaseProc,
-                                          ReleaseContext releaseContext);
+    typedef void (*TextureReleaseProc)(ReleaseContext releaseContext);
 
     /** Creates SkImage from GPU texture associated with context. Caller is responsible for
         managing the lifetime of GPU texture.
 
         SkImage is returned if format of backendTexture is recognized and supported.
         Recognized formats vary by GPU back-end.
 
         @param context         GPU context
         @param backendTexture  texture residing on GPU
         @param origin          one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
-        @param colorType       one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
-                               kRGB_565_SkColorType, kARGB_4444_SkColorType,
-                               kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+        @param colorType       one of:
+                               kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,
+                               kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,
+                               kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,
                                kGray_8_SkColorType, kRGBA_F16_SkColorType
-        @param alphaType       one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
-                               kPremul_SkAlphaType, kUnpremul_SkAlphaType
+        @param alphaType       one of:
+                               kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
+                               kUnpremul_SkAlphaType
         @param colorSpace      range of colors; may be nullptr
         @return                created SkImage, or nullptr
     */
     static sk_sp<SkImage> MakeFromTexture(GrContext* context,
                                           const GrBackendTexture& backendTexture,
                                           GrSurfaceOrigin origin,
                                           SkColorType colorType,
                                           SkAlphaType alphaType,
@@ -214,22 +215,24 @@ public:
         passed releaseContext when SkImage is deleted or no longer refers to texture.
 
         SkImage is returned if format of backendTexture is recognized and supported.
         Recognized formats vary by GPU back-end.
 
         @param context             GPU context
         @param backendTexture      texture residing on GPU
         @param origin              one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
-        @param colorType           one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
-                                   kRGB_565_SkColorType, kARGB_4444_SkColorType,
-                                   kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+        @param colorType           one of:
+                                   kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,
+                                   kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,
+                                   kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,
                                    kGray_8_SkColorType, kRGBA_F16_SkColorType
-        @param alphaType           one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
-                                   kPremul_SkAlphaType, kUnpremul_SkAlphaType
+        @param alphaType           one of:
+                                   kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
+                                   kUnpremul_SkAlphaType
         @param colorSpace          range of colors; may be nullptr
         @param textureReleaseProc  function called when texture can be released
         @param releaseContext      state passed to textureReleaseProc
         @return                    created SkImage, or nullptr
     */
     static sk_sp<SkImage> MakeFromTexture(GrContext* context,
                                           const GrBackendTexture& backendTexture,
                                           GrSurfaceOrigin origin,
@@ -237,230 +240,276 @@ public:
                                           SkAlphaType alphaType,
                                           sk_sp<SkColorSpace> colorSpace,
                                           TextureReleaseProc textureReleaseProc,
                                           ReleaseContext releaseContext);
 
     /** Creates SkImage from encoded data. SkImage is uploaded to GPU back-end using context.
 
         Created SkImage is available to other GPU contexts, and is available across thread
-        boundaries. All contexts must be in the same GPU_Share_Group, or otherwise
+        boundaries. All contexts must be in the same GPU share group, or otherwise
         share resources.
 
         When SkImage is no longer referenced, context releases texture memory
         asynchronously.
 
         GrBackendTexture decoded from data is uploaded to match SkSurface created with
         dstColorSpace. SkColorSpace of SkImage is determined by encoded data.
 
         SkImage is returned if format of data is recognized and supported, and if context
         supports moving resources. Recognized formats vary by platform and GPU back-end.
 
         SkImage is returned using MakeFromEncoded() if context is nullptr or does not support
         moving resources between contexts.
 
-        @param context        GPU context
-        @param data           SkImage to decode
-        @param buildMips      create SkImage as Mip_Map if true
-        @param dstColorSpace  range of colors of matching SkSurface on GPU
-        @return               created SkImage, or nullptr
+        @param context                GPU context
+        @param data                   SkImage to decode
+        @param buildMips              create SkImage as mip map if true
+        @param dstColorSpace          range of colors of matching SkSurface on GPU
+        @param limitToMaxTextureSize  downscale image to GPU maximum texture size, if necessary
+        @return                       created SkImage, or nullptr
     */
     static sk_sp<SkImage> MakeCrossContextFromEncoded(GrContext* context, sk_sp<SkData> data,
-                                                      bool buildMips, SkColorSpace* dstColorSpace);
+                                                      bool buildMips, SkColorSpace* dstColorSpace,
+                                                      bool limitToMaxTextureSize = false);
 
     /** Creates SkImage from pixmap. SkImage is uploaded to GPU back-end using context.
 
         Created SkImage is available to other GPU contexts, and is available across thread
-        boundaries. All contexts must be in the same GPU_Share_Group, or otherwise
+        boundaries. All contexts must be in the same GPU share group, or otherwise
         share resources.
 
         When SkImage is no longer referenced, context releases texture memory
         asynchronously.
 
         GrBackendTexture created from pixmap is uploaded to match SkSurface created with
         dstColorSpace. SkColorSpace of SkImage is determined by pixmap.colorSpace().
 
         SkImage is returned referring to GPU back-end if context is not nullptr,
         format of data is recognized and supported, and if context supports moving
         resources between contexts. Otherwise, pixmap pixel data is copied and SkImage
         as returned in raster format if possible; nullptr may be returned.
         Recognized GPU formats vary by platform and GPU back-end.
 
-        @param context        GPU context
-        @param pixmap         SkImageInfo, pixel address, and row bytes
-        @param buildMips      create SkImage as Mip_Map if true
-        @param dstColorSpace  range of colors of matching SkSurface on GPU
-        @return               created SkImage, or nullptr
+        @param context                GPU context
+        @param pixmap                 SkImageInfo, pixel address, and row bytes
+        @param buildMips              create SkImage as mip map if true
+        @param dstColorSpace          range of colors of matching SkSurface on GPU
+        @param limitToMaxTextureSize  downscale image to GPU maximum texture size, if necessary
+        @return                       created SkImage, or nullptr
     */
     static sk_sp<SkImage> MakeCrossContextFromPixmap(GrContext* context, const SkPixmap& pixmap,
-                                                     bool buildMips, SkColorSpace* dstColorSpace);
-
-    /** Deprecated.
-    */
-    static sk_sp<SkImage> MakeFromAdoptedTexture(GrContext* context,
-                                                 const GrBackendTexture& backendTexture,
-                                                 GrSurfaceOrigin surfaceOrigin,
-                                                 SkAlphaType alphaType = kPremul_SkAlphaType,
-                                                 sk_sp<SkColorSpace> colorSpace = nullptr);
+                                                     bool buildMips, SkColorSpace* dstColorSpace,
+                                                     bool limitToMaxTextureSize = false);
 
     /** Creates SkImage from backendTexture associated with context. backendTexture and
         returned SkImage are managed internally, and are released when no longer needed.
 
         SkImage is returned if format of backendTexture is recognized and supported.
         Recognized formats vary by GPU back-end.
 
         @param context         GPU context
         @param backendTexture  texture residing on GPU
         @param surfaceOrigin   one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
-        @param colorType       one of: kUnknown_SkColorType, kAlpha_8_SkColorType,
-                               kRGB_565_SkColorType, kARGB_4444_SkColorType,
-                               kRGBA_8888_SkColorType, kBGRA_8888_SkColorType,
+        @param colorType       one of:
+                               kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType,
+                               kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kRGB_888x_SkColorType,
+                               kBGRA_8888_SkColorType, kRGBA_1010102_SkColorType, kRGB_101010x_SkColorType,
                                kGray_8_SkColorType, kRGBA_F16_SkColorType
-        @param alphaType       one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
-                               kPremul_SkAlphaType, kUnpremul_SkAlphaType
+        @param alphaType       one of:
+                               kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
+                               kUnpremul_SkAlphaType
         @param colorSpace      range of colors; may be nullptr
         @return                created SkImage, or nullptr
     */
     static sk_sp<SkImage> MakeFromAdoptedTexture(GrContext* context,
                                                  const GrBackendTexture& backendTexture,
                                                  GrSurfaceOrigin surfaceOrigin,
                                                  SkColorType colorType,
                                                  SkAlphaType alphaType = kPremul_SkAlphaType,
                                                  sk_sp<SkColorSpace> colorSpace = nullptr);
 
-    /** Creates SkImage from copy of yuvTextureHandles, an array of textures on GPU.
-        yuvTextureHandles contain pixels for YUV planes of SkImage.
-        yuvSizes contain dimensions for each pixel plane. Dimensions must be greater than
-        zero but may differ from plane to plane. Returned SkImage has the dimensions
-        yuvSizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
+    /** Creates an SkImage by flattening the specified YUVA planes into a single, interleaved RGBA
+        image.
+
+        @param context         GPU context
+        @param yuvColorSpace   How the YUV values are converted to RGB. One of:
+                                           kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
+                                           kRec709_SkYUVColorSpace
+        @param yuvTextures     array of (up to four) YUVA textures on GPU which contain the,
+                               possibly interleaved, YUVA planes
+        @param yuvaIndices     array indicating which texture (in 'yuvaTextures') and channel
+                               (in the specified texture) maps to each of Y, U, V, and A.
+        @param imageSize       size of the resulting image
+        @param imageOrigin     origin of the resulting image. One of: kBottomLeft_GrSurfaceOrigin,
+                               kTopLeft_GrSurfaceOrigin
+        @param imageColorSpace range of colors of the resulting image; may be nullptr
+        @return                created SkImage, or nullptr
+    */
+    static sk_sp<SkImage> MakeFromYUVATexturesCopy(GrContext* context,
+                                                   SkYUVColorSpace yuvColorSpace,
+                                                   const GrBackendTexture yuvaTextures[],
+                                                   const SkYUVAIndex yuvaIndices[4],
+                                                   SkISize imageSize,
+                                                   GrSurfaceOrigin imageOrigin,
+                                                   sk_sp<SkColorSpace> imageColorSpace = nullptr);
+
+    /** Creates an SkImage by flattening the specified YUVA planes into a single, interleaved RGBA
+        image. 'backendTexture' is used to store the result of the flattening.
 
-        @param context            GPU context
-        @param yuvColorSpace      one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
-                                  kRec709_SkYUVColorSpace
-        @param yuvTextureHandles  array of YUV textures on GPU
-        @param yuvSizes           dimensions of YUV textures
-        @param surfaceOrigin      one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
-        @param colorSpace         range of colors; may be nullptr
-        @return                   created SkImage, or nullptr
+        @param context         GPU context
+        @param yuvColorSpace   How the YUV values are converted to RGB. One of:
+                                           kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
+                                           kRec709_SkYUVColorSpace
+        @param yuvTextures     array of (up to four) YUVA textures on GPU which contain the,
+                               possibly interleaved, YUVA planes
+        @param yuvaIndices     array indicating which texture (in 'yuvaTextures') and channel
+                               (in the specified texture) maps to each of Y, U, V, and A.
+        @param imageSize       size of the resulting image
+        @param imageOrigin     origin of the resulting image. One of: kBottomLeft_GrSurfaceOrigin,
+                               kTopLeft_GrSurfaceOrigin
+        @param backendTexture  the resource that stores the final pixels
+        @param imageColorSpace range of colors of the resulting image; may be nullptr
+        @return                created SkImage, or nullptr
+    */
+    static sk_sp<SkImage> MakeFromYUVATexturesCopyWithExternalBackend(
+            GrContext* context,
+            SkYUVColorSpace yuvColorSpace,
+            const GrBackendTexture yuvaTextures[],
+            const SkYUVAIndex yuvaIndices[4],
+            SkISize imageSize,
+            GrSurfaceOrigin imageOrigin,
+            const GrBackendTexture& backendTexture,
+            sk_sp<SkColorSpace> imageColorSpace = nullptr);
+
+    /** Creates SkImage from copy of yuvTextures, an array of textures on GPU.
+        yuvTextures contain pixels for YUV planes of SkImage. Returned SkImage has the dimensions
+        yuvTextures[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
+
+        @param context         GPU context
+        @param yuvColorSpace   one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
+                               kRec709_SkYUVColorSpace
+        @param yuvTextures     array of YUV textures on GPU
+        @param imageOrigin     one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
+        @param imageColorSpace range of colors; may be nullptr
+        @return                created SkImage, or nullptr
     */
     static sk_sp<SkImage> MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
-                                                  const GrBackendObject yuvTextureHandles[3],
-                                                  const SkISize yuvSizes[3],
-                                                  GrSurfaceOrigin surfaceOrigin,
-                                                  sk_sp<SkColorSpace> colorSpace = nullptr);
+                                                  const GrBackendTexture yuvTextures[3],
+                                                  GrSurfaceOrigin imageOrigin,
+                                                  sk_sp<SkColorSpace> imageColorSpace = nullptr);
+
+    /** Creates SkImage from copy of yuvTextures, an array of textures on GPU.
+        yuvTextures contain pixels for YUV planes of SkImage. Returned SkImage has the dimensions
+        yuvTextures[0] and stores pixels in backendTexture. yuvColorSpace describes how YUV colors
+        convert to RGB colors.
 
-    /** Creates SkImage from copy of nv12TextureHandles, an array of textures on GPU.
-        nv12TextureHandles[0] contains pixels for YUV_Component_Y plane.
-        nv12TextureHandles[1] contains pixels for YUV_Component_U plane,
-        followed by pixels for YUV_Component_V plane.
-        nv12Sizes contain dimensions for each pixel plane. Dimensions must be greater than
-        zero but may differ from plane to plane. Returned SkImage has the dimensions
-        nv12Sizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
+        @param context         GPU context
+        @param yuvColorSpace   one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
+                               kRec709_SkYUVColorSpace
+        @param yuvTextures     array of YUV textures on GPU
+        @param imageOrigin     one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
+        @param backendTexture  the resource that stores the final pixels
+        @param imageColorSpace range of colors; may be nullptr
+        @return                created SkImage, or nullptr
+    */
+    static sk_sp<SkImage> MakeFromYUVTexturesCopyWithExternalBackend(
+            GrContext* context, SkYUVColorSpace yuvColorSpace,
+            const GrBackendTexture yuvTextures[3], GrSurfaceOrigin imageOrigin,
+            const GrBackendTexture& backendTexture, sk_sp<SkColorSpace> imageColorSpace = nullptr);
 
-        @param context             GPU context
-        @param yuvColorSpace       one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
-                                   kRec709_SkYUVColorSpace
-        @param nv12TextureHandles  array of YUV textures on GPU
-        @param nv12Sizes           dimensions of YUV textures
-        @param surfaceOrigin       one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
-        @param colorSpace          range of colors; may be nullptr
-        @return                    created SkImage, or nullptr
+    /** Creates SkImage from copy of nv12Textures, an array of textures on GPU.
+        nv12Textures[0] contains pixels for YUV component y plane.
+        nv12Textures[1] contains pixels for YUV component u plane,
+        followed by pixels for YUV component v plane.
+        Returned SkImage has the dimensions nv12Textures[2].
+        yuvColorSpace describes how YUV colors convert to RGB colors.
+
+        @param context         GPU context
+        @param yuvColorSpace   one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
+                               kRec709_SkYUVColorSpace
+        @param nv12Textures    array of YUV textures on GPU
+        @param imageOrigin     one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
+        @param imageColorSpace range of colors; may be nullptr
+        @return                created SkImage, or nullptr
     */
     static sk_sp<SkImage> MakeFromNV12TexturesCopy(GrContext* context,
                                                    SkYUVColorSpace yuvColorSpace,
-                                                   const GrBackendObject nv12TextureHandles[2],
-                                                   const SkISize nv12Sizes[2],
-                                                   GrSurfaceOrigin surfaceOrigin,
-                                                   sk_sp<SkColorSpace> colorSpace = nullptr);
+                                                   const GrBackendTexture nv12Textures[2],
+                                                   GrSurfaceOrigin imageOrigin,
+                                                   sk_sp<SkColorSpace> imageColorSpace = nullptr);
 
-    /** Creates SkImage from copy of yuvTextureHandles, an array of textures on GPU.
-        yuvTextureHandles contain pixels for YUV planes of SkImage.
-        yuvSizes contain dimensions for each pixel plane. Dimensions must be greater than
-        zero but may differ from plane to plane. Returned SkImage has the dimensions
-        yuvSizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
+    /** Creates SkImage from copy of nv12Textures, an array of textures on GPU.
+        nv12Textures[0] contains pixels for YUV component y plane.
+        nv12Textures[1] contains pixels for YUV component u plane,
+        followed by pixels for YUV component v plane.
+        Returned SkImage has the dimensions nv12Textures[2] and stores pixels in backendTexture.
+        yuvColorSpace describes how YUV colors convert to RGB colors.
 
-        @param context            GPU context
-        @param yuvColorSpace      one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
-                                  kRec709_SkYUVColorSpace
-        @param yuvTextureHandles  array of YUV textures on GPU
-        @param yuvSizes           dimensions of YUV textures
-        @param surfaceOrigin      one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
-        @param colorSpace         range of colors; may be nullptr
-        @return                   created SkImage, or nullptr
+        @param context         GPU context
+        @param yuvColorSpace   one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
+                               kRec709_SkYUVColorSpace
+        @param nv12Textures    array of YUV textures on GPU
+        @param imageOrigin     one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
+        @param backendTexture  the resource that stores the final pixels
+        @param imageColorSpace range of colors; may be nullptr
+        @return                created SkImage, or nullptr
     */
-    static sk_sp<SkImage> MakeFromYUVTexturesCopy(GrContext* context, SkYUVColorSpace yuvColorSpace,
-                                                  const GrBackendTexture yuvTextureHandles[3],
-                                                  const SkISize yuvSizes[3],
-                                                  GrSurfaceOrigin surfaceOrigin,
-                                                  sk_sp<SkColorSpace> colorSpace = nullptr);
-
-    /** Creates SkImage from copy of nv12TextureHandles, an array of textures on GPU.
-        nv12TextureHandles[0] contains pixels for YUV_Component_Y plane.
-        nv12TextureHandles[1] contains pixels for YUV_Component_U plane,
-        followed by pixels for YUV_Component_V plane.
-        nv12Sizes contain dimensions for each pixel plane. Dimensions must be greater than
-        zero but may differ from plane to plane. Returned SkImage has the dimensions
-        nv12Sizes[0]. yuvColorSpace describes how YUV colors convert to RGB colors.
-
-        @param context             GPU context
-        @param yuvColorSpace       one of: kJPEG_SkYUVColorSpace, kRec601_SkYUVColorSpace,
-                                   kRec709_SkYUVColorSpace
-        @param nv12TextureHandles  array of YUV textures on GPU
-        @param nv12Sizes           dimensions of YUV textures
-        @param surfaceOrigin       one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
-        @param colorSpace          range of colors; may be nullptr
-        @return                    created SkImage, or nullptr
-    */
-    static sk_sp<SkImage> MakeFromNV12TexturesCopy(GrContext* context,
-                                                   SkYUVColorSpace yuvColorSpace,
-                                                   const GrBackendTexture nv12TextureHandles[2],
-                                                   const SkISize nv12Sizes[2],
-                                                   GrSurfaceOrigin surfaceOrigin,
-                                                   sk_sp<SkColorSpace> colorSpace = nullptr);
+    static sk_sp<SkImage> MakeFromNV12TexturesCopyWithExternalBackend(
+            GrContext* context,
+            SkYUVColorSpace yuvColorSpace,
+            const GrBackendTexture nv12Textures[2],
+            GrSurfaceOrigin imageOrigin,
+            const GrBackendTexture& backendTexture,
+            sk_sp<SkColorSpace> imageColorSpace = nullptr);
 
     enum class BitDepth {
-        kU8,  //!< Use 8 bits per ARGB component using unsigned integer format.
-        kF16, //!< Use 16 bits per ARGB component using half-precision floating point format.
+        kU8,  //!< uses 8-bit unsigned int per color component
+        kF16, //!< uses 16-bit float per color component
     };
 
     /** Creates SkImage from picture. Returned SkImage width and height are set by dimensions.
         SkImage draws picture with matrix and paint, set to bitDepth and colorSpace.
 
         If matrix is nullptr, draws with identity SkMatrix. If paint is nullptr, draws
         with default SkPaint. colorSpace may be nullptr.
 
         @param picture     stream of drawing commands
         @param dimensions  width and height
         @param matrix      SkMatrix to rotate, scale, translate, and so on; may be nullptr
         @param paint       SkPaint to apply transparency, filtering, and so on; may be nullptr
-        @param bitDepth    8 bit integer or 16 bit float: per component
+        @param bitDepth    8-bit integer or 16-bit float: per component
         @param colorSpace  range of colors; may be nullptr
         @return            created SkImage, or nullptr
     */
     static sk_sp<SkImage> MakeFromPicture(sk_sp<SkPicture> picture, const SkISize& dimensions,
                                           const SkMatrix* matrix, const SkPaint* paint,
                                           BitDepth bitDepth,
                                           sk_sp<SkColorSpace> colorSpace);
 
 #if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
     /** (see skbug.com/7447)
         Creates SkImage from Android hardware buffer.
         Returned SkImage takes a reference on the buffer.
 
         Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
 
         @param hardwareBuffer  AHardwareBuffer Android hardware buffer
-        @param alphaType       one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
-                               kPremul_SkAlphaType, kUnpremul_SkAlphaType
+        @param alphaType       one of:
+                               kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
+                               kUnpremul_SkAlphaType
         @param colorSpace      range of colors; may be nullptr
+        @param surfaceOrigin   one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin
         @return                created SkImage, or nullptr
     */
-    static sk_sp<SkImage> MakeFromAHardwareBuffer(AHardwareBuffer* hardwareBuffer,
-                                                 SkAlphaType alphaType = kPremul_SkAlphaType,
-                                                 sk_sp<SkColorSpace> colorSpace = nullptr);
+    static sk_sp<SkImage> MakeFromAHardwareBuffer(
+            AHardwareBuffer* hardwareBuffer,
+            SkAlphaType alphaType = kPremul_SkAlphaType,
+            sk_sp<SkColorSpace> colorSpace = nullptr,
+            GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin);
 #endif
 
     /** Returns pixel count in each row.
 
         @return  pixel width in SkImage
     */
     int width() const { return fWidth; }
 
@@ -485,26 +534,33 @@ public:
     /** Returns value unique to image. SkImage contents cannot change after SkImage is
         created. Any operation to create a new SkImage will receive generate a new
         unique number.
 
         @return  unique identifier
     */
     uint32_t uniqueID() const { return fUniqueID; }
 
-    /** Returns SkAlphaType, one of: kUnknown_SkAlphaType, kOpaque_SkAlphaType,
-        kPremul_SkAlphaType, kUnpremul_SkAlphaType.
+    /** Returns SkAlphaType, one of:
+        kUnknown_SkAlphaType, kOpaque_SkAlphaType, kPremul_SkAlphaType,
+        kUnpremul_SkAlphaType.
 
         SkAlphaType returned was a parameter to an SkImage constructor,
         or was parsed from encoded data.
 
         @return  SkAlphaType in SkImage
     */
     SkAlphaType alphaType() const;
 
+    /** Returns SkColorType if known; otherwise, returns kUnknown_SkColorType.
+
+        @return  SkColorType of SkImage
+    */
+    SkColorType colorType() const;
+
     /** Returns SkColorSpace, the range of colors, associated with SkImage.  The
         reference count of SkColorSpace is unchanged. The returned SkColorSpace is
         immutable.
 
         SkColorSpace returned was passed to an SkImage constructor,
         or was parsed from encoded data. SkColorSpace returned may be ignored when SkImage
         is drawn, depending on the capabilities of the SkSurface receiving the drawing.
 
@@ -538,20 +594,20 @@ public:
         @return  true if SkAlphaType is kOpaque_SkAlphaType
     */
     bool isOpaque() const { return SkAlphaTypeIsOpaque(this->alphaType()); }
 
     /** Creates SkShader from SkImage. SkShader dimensions are taken from SkImage. SkShader uses
         SkShader::TileMode rules to fill drawn area outside SkImage. localMatrix permits
         transforming SkImage before SkCanvas matrix is applied.
 
-        @param tileMode1    tiling in x, one of: SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode,
-                            SkShader::kMirror_TileMode
-        @param tileMode2    tiling in y, one of: SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode,
-                            SkShader::kMirror_TileMode
+        @param tileMode1    tiling on x-axis, one of: SkShader::kClamp_TileMode,
+                            SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode
+        @param tileMode2    tiling on y-axis, one of: SkShader::kClamp_TileMode,
+                            SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode
         @param localMatrix  SkImage transformation, or nullptr
         @return             SkShader containing SkImage
     */
     sk_sp<SkShader> makeShader(SkShader::TileMode tileMode1, SkShader::TileMode tileMode2,
                                const SkMatrix* localMatrix = nullptr) const;
 
     /** Creates SkShader from SkImage. SkShader dimensions are taken from SkImage. SkShader uses
         SkShader::kClamp_TileMode to fill drawn area outside SkImage. localMatrix permits
@@ -592,46 +648,47 @@ public:
         invalid. lazy image may be invalid and may not draw to raster surface or
         GPU surface or both.
 
         @param context  GPU context
         @return         true if SkImage can be drawn
     */
     bool isValid(GrContext* context) const;
 
-    /** Retrieves the back-end API handle of texture. If flushPendingGrContextIO is true,
-        complete deferred I/O operations.
+    /** Retrieves the back-end texture. If SkImage has no back-end texture, an invalid
+        object is returned. Call GrBackendTexture::isValid to determine if the result
+        is valid.
+
+        If flushPendingGrContextIO is true, completes deferred I/O operations.
 
         If origin in not nullptr, copies location of content drawn into SkImage.
 
         @param flushPendingGrContextIO  flag to flush outstanding requests
         @param origin                   storage for one of: kTopLeft_GrSurfaceOrigin,
                                         kBottomLeft_GrSurfaceOrigin; or nullptr
-        @return                         back-end API texture handle, or nullptr
+        @return                         back-end API texture handle; invalid on failure
     */
-    GrBackendObject getTextureHandle(bool flushPendingGrContextIO,
-                                     GrSurfaceOrigin* origin = nullptr) const;
+    GrBackendTexture getBackendTexture(bool flushPendingGrContextIO,
+                                       GrSurfaceOrigin* origin = nullptr) const;
 
     /** \enum SkImage::CachingHint
         CachingHint selects whether Skia may internally cache SkBitmap generated by
         decoding SkImage, or by copying SkImage from GPU to CPU. The default behavior
         allows caching SkBitmap.
 
         Choose kDisallow_CachingHint if SkImage pixels are to be used only once, or
         if SkImage pixels reside in a cache outside of Skia, or to reduce memory pressure.
 
         Choosing kAllow_CachingHint does not ensure that pixels will be cached.
         SkImage pixels may not be cached if memory requirements are too large or
         pixels are not accessible.
     */
     enum CachingHint {
-        kAllow_CachingHint,    //!< Allows Skia to internally cache decoded and copied pixels.
-
-        /** Disallows Skia from internally caching decoded and copied pixels. */
-        kDisallow_CachingHint,
+        kAllow_CachingHint,    //!< allows internally caching decoded and copied pixels
+        kDisallow_CachingHint, //!< disallows internally caching decoded and copied pixels
     };
 
     /** Copies SkRect of pixels from SkImage to dstPixels. Copy starts at offset (srcX, srcY),
         and does not exceed SkImage (width(), height()).
 
         dstInfo specifies width, height, SkColorType, SkAlphaType, and SkColorSpace of
         destination. dstRowBytes specifics the gap from one destination row to the next.
         Returns true if pixels are copied. Returns false if:
@@ -767,47 +824,43 @@ public:
         with one or more of: SK_HAS_JPEG_LIBRARY, SK_HAS_PNG_LIBRARY, SK_HAS_WEBP_LIBRARY.
 
         Returns nullptr if SkImage contents are not encoded.
 
         @return  encoded SkImage, or nullptr
     */
     sk_sp<SkData> refEncodedData() const;
 
-    /** Appends SkImage description to string, including unique ID, width, height, and
-        whether the image is opaque.
-
-        @param string  storage for description; existing content is preserved
-        @return        string appended with SkImage description
-    */
-    const char* toString(SkString* string) const;
-
     /** Returns subset of SkImage. subset must be fully contained by SkImage dimensions().
         The implementation may share pixels, or may copy them.
 
         Returns nullptr if subset is empty, or subset is not contained by bounds, or
         pixels in SkImage could not be read or copied.
 
         @param subset  bounds of returned SkImage
         @return        partial or full SkImage, or nullptr
     */
     sk_sp<SkImage> makeSubset(const SkIRect& subset) const;
 
     /** Returns SkImage backed by GPU texture associated with context. Returned SkImage is
-        compatible with SkSurface created with dstColorSpace. Returns original
-        SkImage if context and dstColorSpace match.
+        compatible with SkSurface created with dstColorSpace. The returned SkImage respects
+        mipMapped setting; if mipMapped equals GrMipMapped::kYes, the backing texture
+        allocates mip map levels. Returns original SkImage if context
+        and dstColorSpace match and mipMapped is compatible with backing GPU texture.
 
         Returns nullptr if context is nullptr, or if SkImage was created with another
         GrContext.
 
         @param context        GPU context
         @param dstColorSpace  range of colors of matching SkSurface on GPU
+        @param mipMapped      whether created SkImage texture must allocate mip map levels
         @return               created SkImage, or nullptr
     */
-    sk_sp<SkImage> makeTextureImage(GrContext* context, SkColorSpace* dstColorSpace) const;
+    sk_sp<SkImage> makeTextureImage(GrContext* context, SkColorSpace* dstColorSpace,
+                                    GrMipMapped mipMapped = GrMipMapped::kNo) const;
 
     /** Returns raster image or lazy image. Copies SkImage backed by GPU texture into
         CPU memory if needed. Returns original SkImage if decoded in raster bitmap,
         or if encoded in a stream.
 
         Returns nullptr if backed by GPU texture and copy fails.
 
         @return  raster image, lazy image, or nullptr
@@ -845,16 +898,19 @@ public:
         @param outSubset   storage for returned SkImage bounds
         @param offset      storage for returned SkImage translation
         @return            filtered SkImage, or nullptr
     */
     sk_sp<SkImage> makeWithFilter(const SkImageFilter* filter, const SkIRect& subset,
                                   const SkIRect& clipBounds, SkIRect* outSubset,
                                   SkIPoint* offset) const;
 
+    /** Defines a callback function, taking one parameter of type GrBackendTexture with
+        no return value. Function is called when back-end texture is to be released.
+    */
     typedef std::function<void(GrBackendTexture)> BackendTextureReleaseProc;
 
     /** Creates a GrBackendTexture from the provided SkImage. Returns true and
         stores result in backendTexture and backendTextureReleaseProc if
         texture is created; otherwise, returns false and leaves
         backendTexture and backendTextureReleaseProc unmodified.
 
         Call backendTextureReleaseProc after deleting backendTexture.
@@ -864,27 +920,27 @@ public:
         If SkImage is both texture backed and singly referenced, image is returned in
         backendTexture without conversion or making a copy. SkImage is singly referenced
         if its was transferred solely using std::move().
 
         If SkImage is not texture backed, returns texture with SkImage contents.
 
         @param context                    GPU context
         @param image                      SkImage used for texture
-        @param backendTexture             storage for backend texture
+        @param backendTexture             storage for back-end texture
         @param backendTextureReleaseProc  storage for clean up function
-        @return                           true if backend texture was created
+        @return                           true if back-end texture was created
     */
     static bool MakeBackendTextureFromSkImage(GrContext* context,
                                               sk_sp<SkImage> image,
                                               GrBackendTexture* backendTexture,
                                               BackendTextureReleaseProc* backendTextureReleaseProc);
 
     enum LegacyBitmapMode {
-        kRO_LegacyBitmapMode, //!< Returned bitmap is read-only and immutable.
+        kRO_LegacyBitmapMode, //!< returned bitmap is read-only and immutable
     };
 
     /** Creates raster SkBitmap with same pixels as SkImage. If legacyBitmapMode is
         kRO_LegacyBitmapMode, returned bitmap is read-only and immutable.
         Returns true if SkBitmap is stored in bitmap. Returns false and resets bitmap if
         SkBitmap write did not succeed.
 
         @param bitmap            storage for legacy SkBitmap
@@ -902,33 +958,20 @@ public:
 
     /** Creates SkImage in target SkColorSpace.
         Returns nullptr if SkImage could not be created.
 
         Returns original SkImage if it is in target SkColorSpace.
         Otherwise, converts pixels from SkImage SkColorSpace to target SkColorSpace.
         If SkImage colorSpace() returns nullptr, SkImage SkColorSpace is assumed to be sRGB.
 
-        SkTransferFunctionBehavior is to be deprecated.
-
-        Set premulBehavior to SkTransferFunctionBehavior::kRespect to convert SkImage
-        pixels to a linear space, before converting to destination SkColorType
-        and SkColorSpace.
-
-        Set premulBehavior to SkTransferFunctionBehavior::kIgnore to treat SkImage
-        pixels as linear, when converting to destination SkColorType
-        and SkColorSpace, ignoring pixel encoding.
-
-        @param target          SkColorSpace describing color range of returned SkImage
-        @param premulBehavior  one of: SkTransferFunctionBehavior::kRespect,
-                               SkTransferFunctionBehavior::kIgnore
-        @return                created SkImage in target SkColorSpace
+        @param target  SkColorSpace describing color range of returned SkImage
+        @return        created SkImage in target SkColorSpace
     */
-    sk_sp<SkImage> makeColorSpace(sk_sp<SkColorSpace> target,
-                                  SkTransferFunctionBehavior premulBehavior) const;
+    sk_sp<SkImage> makeColorSpace(sk_sp<SkColorSpace> target) const;
 
 private:
     SkImage(int width, int height, uint32_t uniqueID);
     friend class SkImage_Base;
 
     const int       fWidth;
     const int       fHeight;
     const uint32_t  fUniqueID;
--- a/gfx/skia/skia/include/core/SkImageFilter.h
+++ b/gfx/skia/skia/include/core/SkImageFilter.h
@@ -9,16 +9,17 @@
 #define SkImageFilter_DEFINED
 
 #include "../private/SkTArray.h"
 #include "../private/SkTemplates.h"
 #include "../private/SkMutex.h"
 #include "SkColorSpace.h"
 #include "SkFilterQuality.h"
 #include "SkFlattenable.h"
+#include "SkImageInfo.h"
 #include "SkMatrix.h"
 #include "SkRect.h"
 
 class GrContext;
 class GrFragmentProcessor;
 class SkColorFilter;
 class SkColorSpaceXformer;
 struct SkIPoint;
@@ -36,21 +37,24 @@ struct SkImageFilterCacheKey;
 class SK_API SkImageFilter : public SkFlattenable {
 public:
     // Extra information about the output of a filter DAG. For now, this is just the color space
     // (of the original requesting device). This is used when constructing intermediate rendering
     // surfaces, so that we ensure we land in a surface that's similar/compatible to the final
     // consumer of the DAG's output.
     class OutputProperties {
     public:
-        explicit OutputProperties(SkColorSpace* colorSpace) : fColorSpace(colorSpace) {}
+        explicit OutputP