[PATCH 1/6] Bug 985217 - Update Skia to r13827 r=upstream
authorGeorge Wright <george@mozilla.com>
Mon, 17 Mar 2014 07:34:32 -0400
changeset 193135 dfba3a2480bc41639c0c4e8ef0f90e9925661b18
parent 193134 3462f5814eb8e6d01a0d88a254a223fdb7e909cc
child 193136 e1176480f8deab6393141ba807c1a13dc3de5b59
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersupstream
bugs985217
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
[PATCH 1/6] Bug 985217 - Update Skia to r13827 r=upstream
gfx/skia/README_MOZILLA
gfx/skia/generate_mozbuild.py
gfx/skia/moz.build
gfx/skia/trunk/include/core/Sk64.h
gfx/skia/trunk/include/core/SkAnnotation.h
gfx/skia/trunk/include/core/SkBitmap.h
gfx/skia/trunk/include/core/SkBitmapDevice.h
gfx/skia/trunk/include/core/SkCanvas.h
gfx/skia/trunk/include/core/SkClipStack.h
gfx/skia/trunk/include/core/SkColorFilter.h
gfx/skia/trunk/include/core/SkColorShader.h
gfx/skia/trunk/include/core/SkComposeShader.h
gfx/skia/trunk/include/core/SkDevice.h
gfx/skia/trunk/include/core/SkDrawLooper.h
gfx/skia/trunk/include/core/SkEmptyShader.h
gfx/skia/trunk/include/core/SkGeometry.h
gfx/skia/trunk/include/core/SkImageFilter.h
gfx/skia/trunk/include/core/SkImageFilterUtils.h
gfx/skia/trunk/include/core/SkImageInfo.h
gfx/skia/trunk/include/core/SkMaskFilter.h
gfx/skia/trunk/include/core/SkMatrix.h
gfx/skia/trunk/include/core/SkPaint.h
gfx/skia/trunk/include/core/SkPathEffect.h
gfx/skia/trunk/include/core/SkPicture.h
gfx/skia/trunk/include/core/SkPreConfig.h
gfx/skia/trunk/include/core/SkRRect.h
gfx/skia/trunk/include/core/SkRasterizer.h
gfx/skia/trunk/include/core/SkReadBuffer.h
gfx/skia/trunk/include/core/SkScalarCompare.h
gfx/skia/trunk/include/core/SkShader.h
gfx/skia/trunk/include/core/SkStream.h
gfx/skia/trunk/include/core/SkSurface.h
gfx/skia/trunk/include/core/SkTDArray.h
gfx/skia/trunk/include/core/SkTLazy.h
gfx/skia/trunk/include/core/SkTemplates.h
gfx/skia/trunk/include/core/SkThread_platform.h
gfx/skia/trunk/include/core/SkTypes.h
gfx/skia/trunk/include/core/SkWriter32.h
gfx/skia/trunk/include/core/SkXfermode.h
gfx/skia/trunk/include/device/xps/SkXPSDevice.h
gfx/skia/trunk/include/effects/Sk1DPathEffect.h
gfx/skia/trunk/include/effects/Sk2DPathEffect.h
gfx/skia/trunk/include/effects/SkAvoidXfermode.h
gfx/skia/trunk/include/effects/SkBicubicImageFilter.h
gfx/skia/trunk/include/effects/SkBitmapAlphaThresholdShader.h
gfx/skia/trunk/include/effects/SkBitmapSource.h
gfx/skia/trunk/include/effects/SkBlurDrawLooper.h
gfx/skia/trunk/include/effects/SkBlurImageFilter.h
gfx/skia/trunk/include/effects/SkColorFilterImageFilter.h
gfx/skia/trunk/include/effects/SkColorMatrixFilter.h
gfx/skia/trunk/include/effects/SkComposeImageFilter.h
gfx/skia/trunk/include/effects/SkCornerPathEffect.h
gfx/skia/trunk/include/effects/SkDashPathEffect.h
gfx/skia/trunk/include/effects/SkDiscretePathEffect.h
gfx/skia/trunk/include/effects/SkDisplacementMapEffect.h
gfx/skia/trunk/include/effects/SkDropShadowImageFilter.h
gfx/skia/trunk/include/effects/SkEmbossMaskFilter.h
gfx/skia/trunk/include/effects/SkKernel33MaskFilter.h
gfx/skia/trunk/include/effects/SkLayerDrawLooper.h
gfx/skia/trunk/include/effects/SkLayerRasterizer.h
gfx/skia/trunk/include/effects/SkLerpXfermode.h
gfx/skia/trunk/include/effects/SkLumaColorFilter.h
gfx/skia/trunk/include/effects/SkMagnifierImageFilter.h
gfx/skia/trunk/include/effects/SkMatrixConvolutionImageFilter.h
gfx/skia/trunk/include/effects/SkMergeImageFilter.h
gfx/skia/trunk/include/effects/SkMorphologyImageFilter.h
gfx/skia/trunk/include/effects/SkOffsetImageFilter.h
gfx/skia/trunk/include/effects/SkPerlinNoiseShader.h
gfx/skia/trunk/include/effects/SkPictureImageFilter.h
gfx/skia/trunk/include/effects/SkPixelXorXfermode.h
gfx/skia/trunk/include/effects/SkRectShaderImageFilter.h
gfx/skia/trunk/include/effects/SkResizeImageFilter.h
gfx/skia/trunk/include/effects/SkStippleMaskFilter.h
gfx/skia/trunk/include/effects/SkTableMaskFilter.h
gfx/skia/trunk/include/effects/SkTestImageFilters.h
gfx/skia/trunk/include/effects/SkTileImageFilter.h
gfx/skia/trunk/include/effects/SkTransparentShader.h
gfx/skia/trunk/include/effects/SkXfermodeImageFilter.h
gfx/skia/trunk/include/gpu/GrBitmapTextContext.h
gfx/skia/trunk/include/gpu/GrContext.h
gfx/skia/trunk/include/gpu/GrDistanceFieldTextContext.h
gfx/skia/trunk/include/gpu/GrTBackendEffectFactory.h
gfx/skia/trunk/include/gpu/GrTextContext.h
gfx/skia/trunk/include/gpu/GrTypesPriv.h
gfx/skia/trunk/include/gpu/SkGpuDevice.h
gfx/skia/trunk/include/gpu/SkGr.h
gfx/skia/trunk/include/gpu/gl/GrGLExtensions.h
gfx/skia/trunk/include/gpu/gl/GrGLFunctions.h
gfx/skia/trunk/include/gpu/gl/GrGLInterface.h
gfx/skia/trunk/include/pdf/SkPDFDevice.h
gfx/skia/trunk/include/utils/SkDeferredCanvas.h
gfx/skia/trunk/include/utils/SkDumpCanvas.h
gfx/skia/trunk/include/utils/SkLua.h
gfx/skia/trunk/include/utils/SkLuaCanvas.h
gfx/skia/trunk/include/utils/SkNWayCanvas.h
gfx/skia/trunk/include/utils/SkNoSaveLayerCanvas.h
gfx/skia/trunk/include/utils/SkProxyCanvas.h
gfx/skia/trunk/include/utils/SkRunnable.h
gfx/skia/trunk/include/utils/SkThreadPool.h
gfx/skia/trunk/include/views/SkWindow.h
gfx/skia/trunk/src/animator/SkDisplayType.cpp
gfx/skia/trunk/src/animator/SkDrawDash.cpp
gfx/skia/trunk/src/animator/SkDrawDiscrete.cpp
gfx/skia/trunk/src/animator/SkDrawExtraPathEffect.cpp
gfx/skia/trunk/src/core/Sk64.cpp
gfx/skia/trunk/src/core/SkAnnotation.cpp
gfx/skia/trunk/src/core/SkBBoxHierarchyRecord.cpp
gfx/skia/trunk/src/core/SkBBoxHierarchyRecord.h
gfx/skia/trunk/src/core/SkBBoxRecord.cpp
gfx/skia/trunk/src/core/SkBBoxRecord.h
gfx/skia/trunk/src/core/SkBitmap.cpp
gfx/skia/trunk/src/core/SkBitmapDevice.cpp
gfx/skia/trunk/src/core/SkBitmapFilter.cpp
gfx/skia/trunk/src/core/SkBitmapHeap.cpp
gfx/skia/trunk/src/core/SkBitmapHeap.h
gfx/skia/trunk/src/core/SkBitmapProcShader.cpp
gfx/skia/trunk/src/core/SkBitmapProcShader.h
gfx/skia/trunk/src/core/SkBitmapScaler.cpp
gfx/skia/trunk/src/core/SkBitmap_scroll.cpp
gfx/skia/trunk/src/core/SkBlitter.cpp
gfx/skia/trunk/src/core/SkBlitter.h
gfx/skia/trunk/src/core/SkBlitter_RGB16.cpp
gfx/skia/trunk/src/core/SkBlitter_Sprite.cpp
gfx/skia/trunk/src/core/SkCanvas.cpp
gfx/skia/trunk/src/core/SkClipStack.cpp
gfx/skia/trunk/src/core/SkComposeShader.cpp
gfx/skia/trunk/src/core/SkConfig8888.h
gfx/skia/trunk/src/core/SkCordic.cpp
gfx/skia/trunk/src/core/SkCordic.h
gfx/skia/trunk/src/core/SkCoreBlitters.h
gfx/skia/trunk/src/core/SkDebug.cpp
gfx/skia/trunk/src/core/SkDevice.cpp
gfx/skia/trunk/src/core/SkDeviceImageFilterProxy.h
gfx/skia/trunk/src/core/SkDistanceFieldGen.cpp
gfx/skia/trunk/src/core/SkDistanceFieldGen.h
gfx/skia/trunk/src/core/SkDraw.cpp
gfx/skia/trunk/src/core/SkDrawLooper.cpp
gfx/skia/trunk/src/core/SkFP.h
gfx/skia/trunk/src/core/SkFilterShader.cpp
gfx/skia/trunk/src/core/SkFilterShader.h
gfx/skia/trunk/src/core/SkFlattenableBuffers.cpp
gfx/skia/trunk/src/core/SkGeometry.cpp
gfx/skia/trunk/src/core/SkImageFilter.cpp
gfx/skia/trunk/src/core/SkImageFilterUtils.cpp
gfx/skia/trunk/src/core/SkMaskFilter.cpp
gfx/skia/trunk/src/core/SkMatrix.cpp
gfx/skia/trunk/src/core/SkMatrixClipStateMgr.cpp
gfx/skia/trunk/src/core/SkMatrixClipStateMgr.h
gfx/skia/trunk/src/core/SkOffsetTable.h
gfx/skia/trunk/src/core/SkOrderedReadBuffer.cpp
gfx/skia/trunk/src/core/SkOrderedWriteBuffer.cpp
gfx/skia/trunk/src/core/SkOrderedWriteBuffer.h
gfx/skia/trunk/src/core/SkPaint.cpp
gfx/skia/trunk/src/core/SkPathHeap.cpp
gfx/skia/trunk/src/core/SkPathHeap.h
gfx/skia/trunk/src/core/SkPicture.cpp
gfx/skia/trunk/src/core/SkPictureFlat.h
gfx/skia/trunk/src/core/SkPicturePlayback.cpp
gfx/skia/trunk/src/core/SkPicturePlayback.h
gfx/skia/trunk/src/core/SkPictureRecord.cpp
gfx/skia/trunk/src/core/SkPictureRecord.h
gfx/skia/trunk/src/core/SkQuadTree.cpp
gfx/skia/trunk/src/core/SkQuadTree.h
gfx/skia/trunk/src/core/SkQuadTreePicture.cpp
gfx/skia/trunk/src/core/SkRRect.cpp
gfx/skia/trunk/src/core/SkScaledImageCache.cpp
gfx/skia/trunk/src/core/SkScalerContext.cpp
gfx/skia/trunk/src/core/SkShader.cpp
gfx/skia/trunk/src/core/SkSmallAllocator.h
gfx/skia/trunk/src/core/SkSpriteBlitter.h
gfx/skia/trunk/src/core/SkSpriteBlitter_ARGB32.cpp
gfx/skia/trunk/src/core/SkSpriteBlitter_RGB16.cpp
gfx/skia/trunk/src/core/SkStream.cpp
gfx/skia/trunk/src/core/SkTDynamicHash.h
gfx/skia/trunk/src/core/SkTInternalSList.h
gfx/skia/trunk/src/core/SkTLList.h
gfx/skia/trunk/src/core/SkTObjectPool.h
gfx/skia/trunk/src/core/SkTRefArray.h
gfx/skia/trunk/src/core/SkTemplatesPriv.h
gfx/skia/trunk/src/core/SkValidatingReadBuffer.cpp
gfx/skia/trunk/src/core/SkValidatingReadBuffer.h
gfx/skia/trunk/src/core/SkWriteBuffer.cpp
gfx/skia/trunk/src/core/SkWriter32.cpp
gfx/skia/trunk/src/core/SkXfermode.cpp
gfx/skia/trunk/src/core/SkXfermode_proccoeff.h
gfx/skia/trunk/src/device/xps/SkXPSDevice.cpp
gfx/skia/trunk/src/effects/SkAlphaThresholdFilter.cpp
gfx/skia/trunk/src/effects/SkArithmeticMode.cpp
gfx/skia/trunk/src/effects/SkAvoidXfermode.cpp
gfx/skia/trunk/src/effects/SkBicubicImageFilter.cpp
gfx/skia/trunk/src/effects/SkBitmapAlphaThresholdShader.cpp
gfx/skia/trunk/src/effects/SkBitmapSource.cpp
gfx/skia/trunk/src/effects/SkBlurDrawLooper.cpp
gfx/skia/trunk/src/effects/SkBlurImageFilter.cpp
gfx/skia/trunk/src/effects/SkBlurMask.cpp
gfx/skia/trunk/src/effects/SkBlurMask.h
gfx/skia/trunk/src/effects/SkBlurMaskFilter.cpp
gfx/skia/trunk/src/effects/SkColorFilterImageFilter.cpp
gfx/skia/trunk/src/effects/SkColorFilters.cpp
gfx/skia/trunk/src/effects/SkColorMatrix.cpp
gfx/skia/trunk/src/effects/SkColorMatrixFilter.cpp
gfx/skia/trunk/src/effects/SkComposeImageFilter.cpp
gfx/skia/trunk/src/effects/SkDashPathEffect.cpp
gfx/skia/trunk/src/effects/SkDisplacementMapEffect.cpp
gfx/skia/trunk/src/effects/SkDropShadowImageFilter.cpp
gfx/skia/trunk/src/effects/SkEmbossMaskFilter.cpp
gfx/skia/trunk/src/effects/SkKernel33MaskFilter.cpp
gfx/skia/trunk/src/effects/SkLayerDrawLooper.cpp
gfx/skia/trunk/src/effects/SkLayerRasterizer.cpp
gfx/skia/trunk/src/effects/SkLerpXfermode.cpp
gfx/skia/trunk/src/effects/SkLightingImageFilter.cpp
gfx/skia/trunk/src/effects/SkLumaColorFilter.cpp
gfx/skia/trunk/src/effects/SkMagnifierImageFilter.cpp
gfx/skia/trunk/src/effects/SkMatrixConvolutionImageFilter.cpp
gfx/skia/trunk/src/effects/SkMergeImageFilter.cpp
gfx/skia/trunk/src/effects/SkMorphologyImageFilter.cpp
gfx/skia/trunk/src/effects/SkOffsetImageFilter.cpp
gfx/skia/trunk/src/effects/SkPerlinNoiseShader.cpp
gfx/skia/trunk/src/effects/SkPictureImageFilter.cpp
gfx/skia/trunk/src/effects/SkPixelXorXfermode.cpp
gfx/skia/trunk/src/effects/SkRectShaderImageFilter.cpp
gfx/skia/trunk/src/effects/SkResizeImageFilter.cpp
gfx/skia/trunk/src/effects/SkStippleMaskFilter.cpp
gfx/skia/trunk/src/effects/SkTableColorFilter.cpp
gfx/skia/trunk/src/effects/SkTableMaskFilter.cpp
gfx/skia/trunk/src/effects/SkTestImageFilters.cpp
gfx/skia/trunk/src/effects/SkTileImageFilter.cpp
gfx/skia/trunk/src/effects/SkTransparentShader.cpp
gfx/skia/trunk/src/effects/SkXfermodeImageFilter.cpp
gfx/skia/trunk/src/effects/gradients/SkGradientShader.cpp
gfx/skia/trunk/src/effects/gradients/SkGradientShaderPriv.h
gfx/skia/trunk/src/effects/gradients/SkLinearGradient.cpp
gfx/skia/trunk/src/effects/gradients/SkLinearGradient.h
gfx/skia/trunk/src/effects/gradients/SkRadialGradient.cpp
gfx/skia/trunk/src/effects/gradients/SkRadialGradient.h
gfx/skia/trunk/src/effects/gradients/SkSweepGradient.cpp
gfx/skia/trunk/src/effects/gradients/SkSweepGradient.h
gfx/skia/trunk/src/effects/gradients/SkTwoPointConicalGradient.cpp
gfx/skia/trunk/src/effects/gradients/SkTwoPointConicalGradient.h
gfx/skia/trunk/src/effects/gradients/SkTwoPointRadialGradient.cpp
gfx/skia/trunk/src/effects/gradients/SkTwoPointRadialGradient.h
gfx/skia/trunk/src/gpu/GrAAHairLinePathRenderer.cpp
gfx/skia/trunk/src/gpu/GrAllocator.h
gfx/skia/trunk/src/gpu/GrAtlas.cpp
gfx/skia/trunk/src/gpu/GrAtlas.h
gfx/skia/trunk/src/gpu/GrBitmapTextContext.cpp
gfx/skia/trunk/src/gpu/GrClipMaskManager.cpp
gfx/skia/trunk/src/gpu/GrClipMaskManager.h
gfx/skia/trunk/src/gpu/GrContext.cpp
gfx/skia/trunk/src/gpu/GrDistanceFieldTextContext.cpp
gfx/skia/trunk/src/gpu/GrDrawTarget.cpp
gfx/skia/trunk/src/gpu/GrDrawTarget.h
gfx/skia/trunk/src/gpu/GrDrawTargetCaps.h
gfx/skia/trunk/src/gpu/GrInOrderDrawBuffer.cpp
gfx/skia/trunk/src/gpu/GrInOrderDrawBuffer.h
gfx/skia/trunk/src/gpu/GrOrderedSet.h
gfx/skia/trunk/src/gpu/GrRedBlackTree.h
gfx/skia/trunk/src/gpu/GrReducedClip.cpp
gfx/skia/trunk/src/gpu/GrReducedClip.h
gfx/skia/trunk/src/gpu/GrTextStrike.cpp
gfx/skia/trunk/src/gpu/GrTextStrike.h
gfx/skia/trunk/src/gpu/GrTextStrike_impl.h
gfx/skia/trunk/src/gpu/SkGpuDevice.cpp
gfx/skia/trunk/src/gpu/SkGr.cpp
gfx/skia/trunk/src/gpu/effects/GrBezierEffect.cpp
gfx/skia/trunk/src/gpu/effects/GrBezierEffect.h
gfx/skia/trunk/src/gpu/effects/GrConvexPolyEffect.cpp
gfx/skia/trunk/src/gpu/effects/GrConvexPolyEffect.h
gfx/skia/trunk/src/gpu/effects/GrDistanceFieldTextureEffect.cpp
gfx/skia/trunk/src/gpu/effects/GrDistanceFieldTextureEffect.h
gfx/skia/trunk/src/gpu/effects/GrRRectEffect.cpp
gfx/skia/trunk/src/gpu/effects/GrRRectEffect.h
gfx/skia/trunk/src/gpu/effects/GrTextureDomainEffect.cpp
gfx/skia/trunk/src/gpu/effects/GrTextureDomainEffect.h
gfx/skia/trunk/src/gpu/gl/GrGLCaps.cpp
gfx/skia/trunk/src/gpu/gl/GrGLCreateNullInterface.cpp
gfx/skia/trunk/src/gpu/gl/GrGLExtensions.cpp
gfx/skia/trunk/src/gpu/gl/GrGLInterface.cpp
gfx/skia/trunk/src/gpu/gl/GrGLNoOpInterface.cpp
gfx/skia/trunk/src/gpu/gl/GrGLNoOpInterface.h
gfx/skia/trunk/src/gpu/gl/GrGLShaderBuilder.cpp
gfx/skia/trunk/src/gpu/gl/GrGLUtil.cpp
gfx/skia/trunk/src/gpu/gl/GrGLVertexArray.cpp
gfx/skia/trunk/src/gpu/gl/GrGLVertexArray.h
gfx/skia/trunk/src/gpu/gl/GrGpuGL.cpp
gfx/skia/trunk/src/gpu/gl/GrGpuGL.h
gfx/skia/trunk/src/gpu/gl/GrGpuGL_program.cpp
gfx/skia/trunk/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp
gfx/skia/trunk/src/gpu/gl/angle/GrGLCreateANGLEInterface.cpp
gfx/skia/trunk/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp
gfx/skia/trunk/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp
gfx/skia/trunk/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp
gfx/skia/trunk/src/gpu/gl/mesa/GrGLCreateMesaInterface.cpp
gfx/skia/trunk/src/gpu/gl/unix/GrGLCreateNativeInterface_unix.cpp
gfx/skia/trunk/src/gpu/gl/win/GrGLCreateNativeInterface_win.cpp
gfx/skia/trunk/src/image/SkDataPixelRef.cpp
gfx/skia/trunk/src/image/SkDataPixelRef.h
gfx/skia/trunk/src/image/SkImagePriv.h
gfx/skia/trunk/src/image/SkImage_Gpu.cpp
gfx/skia/trunk/src/image/SkImage_Raster.cpp
gfx/skia/trunk/src/image/SkSurface.cpp
gfx/skia/trunk/src/image/SkSurface_Gpu.cpp
gfx/skia/trunk/src/image/SkSurface_Raster.cpp
gfx/skia/trunk/src/images/SkDecodingImageGenerator.cpp
gfx/skia/trunk/src/images/SkDecodingImageGenerator.h
gfx/skia/trunk/src/images/SkImageDecoder_libpng.cpp
gfx/skia/trunk/src/images/SkImageDecoder_libwebp.cpp
gfx/skia/trunk/src/images/SkImageRef.cpp
gfx/skia/trunk/src/lazy/SkDiscardablePixelRef.cpp
gfx/skia/trunk/src/opts/SkBitmapProcState_matrix_clamp_neon.h
gfx/skia/trunk/src/opts/SkBitmapProcState_matrix_neon.h
gfx/skia/trunk/src/opts/SkBitmapProcState_matrix_repeat_neon.h
gfx/skia/trunk/src/opts/SkBitmapProcState_opts_SSSE3.cpp
gfx/skia/trunk/src/opts/SkBlitRow_opts_SSE2.cpp
gfx/skia/trunk/src/opts/SkBlitRow_opts_SSE2.h
gfx/skia/trunk/src/opts/SkBlitRow_opts_arm_neon.cpp
gfx/skia/trunk/src/opts/SkColor_opts_SSE2.h
gfx/skia/trunk/src/opts/SkXfermode_opts_arm_neon.cpp
gfx/skia/trunk/src/opts/SkXfermode_opts_arm_neon.h
gfx/skia/trunk/src/opts/opts_check_SSE2.cpp
gfx/skia/trunk/src/pathops/SkDCubicToQuads.cpp
gfx/skia/trunk/src/pathops/main.cpp
gfx/skia/trunk/src/pdf/SkPDFDevice.cpp
gfx/skia/trunk/src/pdf/SkPDFFontImpl.h
gfx/skia/trunk/src/pdf/SkPDFImage.cpp
gfx/skia/trunk/src/pipe/SkGPipePriv.h
gfx/skia/trunk/src/pipe/SkGPipeRead.cpp
gfx/skia/trunk/src/pipe/SkGPipeWrite.cpp
gfx/skia/trunk/src/ports/SkFontHost_FreeType.cpp
gfx/skia/trunk/src/ports/SkFontHost_linux.cpp
gfx/skia/trunk/src/ports/SkFontHost_mac.cpp
gfx/skia/trunk/src/ports/SkFontHost_sandbox_none.cpp
gfx/skia/trunk/src/ports/SkFontHost_win.cpp
gfx/skia/trunk/src/ports/SkFontHost_win_dw.cpp
gfx/skia/trunk/src/ports/SkGlobalInitialization_chromium.cpp
gfx/skia/trunk/src/ports/SkGlobalInitialization_default.cpp
gfx/skia/trunk/src/ports/SkImageDecoder_CG.cpp
gfx/skia/trunk/src/ports/SkImageDecoder_WIC.cpp
gfx/skia/trunk/src/ports/SkThread_none.cpp
gfx/skia/trunk/src/ports/SkThread_pthread.cpp
gfx/skia/trunk/src/ports/SkThread_win.cpp
gfx/skia/trunk/src/sfnt/SkOTTableTypes.h
gfx/skia/trunk/src/sfnt/SkOTTable_OS_2_V0.h
gfx/skia/trunk/src/sfnt/SkOTTable_OS_2_V1.h
gfx/skia/trunk/src/sfnt/SkOTTable_OS_2_V2.h
gfx/skia/trunk/src/sfnt/SkOTTable_OS_2_V3.h
gfx/skia/trunk/src/sfnt/SkOTTable_OS_2_V4.h
gfx/skia/trunk/src/sfnt/SkOTTable_OS_2_VA.h
gfx/skia/trunk/src/utils/SkBitSet.h
gfx/skia/trunk/src/utils/SkBitmapHasher.cpp
gfx/skia/trunk/src/utils/SkCanvasStack.cpp
gfx/skia/trunk/src/utils/SkCanvasStack.h
gfx/skia/trunk/src/utils/SkCanvasStateUtils.cpp
gfx/skia/trunk/src/utils/SkDeferredCanvas.cpp
gfx/skia/trunk/src/utils/SkDumpCanvas.cpp
gfx/skia/trunk/src/utils/SkGatherPixelRefsAndRects.h
gfx/skia/trunk/src/utils/SkLua.cpp
gfx/skia/trunk/src/utils/SkLuaCanvas.cpp
gfx/skia/trunk/src/utils/SkMD5.h
gfx/skia/trunk/src/utils/SkNWayCanvas.cpp
gfx/skia/trunk/src/utils/SkNoSaveLayerCanvas.h
gfx/skia/trunk/src/utils/SkPictureUtils.cpp
gfx/skia/trunk/src/utils/SkProxyCanvas.cpp
gfx/skia/trunk/src/utils/SkSHA1.h
gfx/skia/trunk/src/utils/SkThreadPool.cpp
gfx/skia/trunk/src/utils/debugger/SkDebugCanvas.cpp
gfx/skia/trunk/src/utils/debugger/SkDebugCanvas.h
gfx/skia/trunk/src/utils/debugger/SkDrawCommand.cpp
gfx/skia/trunk/src/utils/debugger/SkDrawCommand.h
gfx/skia/trunk/src/utils/debugger/SkObjectParser.cpp
gfx/skia/trunk/src/utils/mac/SkCreateCGImageRef.cpp
gfx/skia/trunk/src/views/SkWidgets.cpp
gfx/skia/trunk/src/views/SkWindow.cpp
gfx/skia/trunk/src/views/mac/SkNSView.mm
--- a/gfx/skia/README_MOZILLA
+++ b/gfx/skia/README_MOZILLA
@@ -1,13 +1,13 @@
 The source from this directory was copied from the skia subversion trunk
 using the update.sh script. The changes made were those applied by update.sh,
 the addition/update of Makefile.in files for the Mozilla build system.
 
-The subversion revision used was r13424.
+The subversion revision used was r13827.
 
 To update to a new version of Skia:
 
 - Copy the entire trunk/ directory from a Skia clone to mozilla-central/gfx/skia
 - cd gfx/skia && ./gyp_mozbuild
 
 Once that's done, use git status to view the files that have changed. Keep an eye on GrUserConfig.h
 and SkUserConfig.h as those probably don't want to be overwritten by upstream versions.
--- a/gfx/skia/generate_mozbuild.py
+++ b/gfx/skia/generate_mozbuild.py
@@ -161,17 +161,17 @@ def generate_separated_sources(platform_
     'SkFontHost_win_dw',
     'SkForceLinking',
     'SkMovie',
     'SkImageDecoder',
     'SkImageEncoder',
     'SkBitmapHasher',
     'SkWGL',
     'SkImages',
-    'SkDiscardableMemory_ashmem'
+    'SkDiscardableMemory_ashmem',
     'SkMemory_malloc'
   ]
 
   def isblacklisted(value):
     for item in blacklist:
       if value.find(item) >= 0:
         return True
 
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -1,16 +1,15 @@
 
 # Please note this file is autogenerated from generate_mozbuild.py, so do not modify it directly
 
 EXPORTS.skia += [
     'trunk/include/animator/SkAnimator.h',
     'trunk/include/animator/SkAnimatorView.h',
     'trunk/include/config/SkUserConfig.h',
-    'trunk/include/core/Sk64.h',
     'trunk/include/core/SkAdvancedTypefaceMetrics.h',
     'trunk/include/core/SkAnnotation.h',
     'trunk/include/core/SkBitmap.h',
     'trunk/include/core/SkBitmapDevice.h',
     'trunk/include/core/SkBlitRow.h',
     'trunk/include/core/SkBounder.h',
     'trunk/include/core/SkCanvas.h',
     'trunk/include/core/SkChecksum.h',
@@ -46,17 +45,16 @@ EXPORTS.skia += [
     'trunk/include/core/SkFontHost.h',
     'trunk/include/core/SkFontLCDConfig.h',
     'trunk/include/core/SkGeometry.h',
     'trunk/include/core/SkGraphics.h',
     'trunk/include/core/SkImage.h',
     'trunk/include/core/SkImageDecoder.h',
     'trunk/include/core/SkImageEncoder.h',
     'trunk/include/core/SkImageFilter.h',
-    'trunk/include/core/SkImageFilterUtils.h',
     'trunk/include/core/SkImageGenerator.h',
     'trunk/include/core/SkImageInfo.h',
     'trunk/include/core/SkInstCnt.h',
     'trunk/include/core/SkLineClipper.h',
     'trunk/include/core/SkMallocPixelRef.h',
     'trunk/include/core/SkMask.h',
     'trunk/include/core/SkMaskFilter.h',
     'trunk/include/core/SkMath.h',
@@ -79,31 +77,29 @@ EXPORTS.skia += [
     'trunk/include/core/SkRasterizer.h',
     'trunk/include/core/SkReadBuffer.h',
     'trunk/include/core/SkReader32.h',
     'trunk/include/core/SkRect.h',
     'trunk/include/core/SkRefCnt.h',
     'trunk/include/core/SkRegion.h',
     'trunk/include/core/SkRRect.h',
     'trunk/include/core/SkScalar.h',
-    'trunk/include/core/SkScalarCompare.h',
     'trunk/include/core/SkShader.h',
     'trunk/include/core/SkSize.h',
     'trunk/include/core/SkStream.h',
     'trunk/include/core/SkString.h',
     'trunk/include/core/SkStringUtils.h',
     'trunk/include/core/SkStrokeRec.h',
     'trunk/include/core/SkSurface.h',
     'trunk/include/core/SkTArray.h',
     'trunk/include/core/SkTDArray.h',
     'trunk/include/core/SkTDict.h',
     'trunk/include/core/SkTDStack.h',
     'trunk/include/core/SkTemplates.h',
     'trunk/include/core/SkThread.h',
-    'trunk/include/core/SkThread_platform.h',
     'trunk/include/core/SkTileGridPicture.h',
     'trunk/include/core/SkTime.h',
     'trunk/include/core/SkTInternalLList.h',
     'trunk/include/core/SkTLazy.h',
     'trunk/include/core/SkTrace.h',
     'trunk/include/core/SkTRegistry.h',
     'trunk/include/core/SkTSearch.h',
     'trunk/include/core/SkTypeface.h',
@@ -118,17 +114,16 @@ EXPORTS.skia += [
     'trunk/include/device/xps/SkConstexprMath.h',
     'trunk/include/device/xps/SkXPSDevice.h',
     'trunk/include/effects/Sk1DPathEffect.h',
     'trunk/include/effects/Sk2DPathEffect.h',
     'trunk/include/effects/SkAlphaThresholdFilter.h',
     'trunk/include/effects/SkArithmeticMode.h',
     'trunk/include/effects/SkAvoidXfermode.h',
     'trunk/include/effects/SkBicubicImageFilter.h',
-    'trunk/include/effects/SkBitmapAlphaThresholdShader.h',
     'trunk/include/effects/SkBitmapSource.h',
     'trunk/include/effects/SkBlurDrawLooper.h',
     'trunk/include/effects/SkBlurImageFilter.h',
     'trunk/include/effects/SkBlurMaskFilter.h',
     'trunk/include/effects/SkColorFilterImageFilter.h',
     'trunk/include/effects/SkColorMatrix.h',
     'trunk/include/effects/SkColorMatrixFilter.h',
     'trunk/include/effects/SkComposeImageFilter.h',
@@ -172,40 +167,37 @@ EXPORTS.skia += [
     'trunk/include/gpu/gl/GrGLInterface.h',
     'trunk/include/gpu/gl/SkANGLEGLContext.h',
     'trunk/include/gpu/gl/SkDebugGLContext.h',
     'trunk/include/gpu/gl/SkGLContextHelper.h',
     'trunk/include/gpu/gl/SkMesaGLContext.h',
     'trunk/include/gpu/gl/SkNativeGLContext.h',
     'trunk/include/gpu/gl/SkNullGLContext.h',
     'trunk/include/gpu/GrBackendEffectFactory.h',
-    'trunk/include/gpu/GrBitmapTextContext.h',
     'trunk/include/gpu/GrClipData.h',
     'trunk/include/gpu/GrColor.h',
     'trunk/include/gpu/GrConfig.h',
     'trunk/include/gpu/GrContext.h',
     'trunk/include/gpu/GrContextFactory.h',
     'trunk/include/gpu/GrCoordTransform.h',
-    'trunk/include/gpu/GrDistanceFieldTextContext.h',
     'trunk/include/gpu/GrDrawEffect.h',
     'trunk/include/gpu/GrEffect.h',
     'trunk/include/gpu/GrEffectStage.h',
     'trunk/include/gpu/GrEffectUnitTest.h',
     'trunk/include/gpu/GrFontScaler.h',
     'trunk/include/gpu/GrGlyph.h',
     'trunk/include/gpu/GrKey.h',
     'trunk/include/gpu/GrPaint.h',
     'trunk/include/gpu/GrPathRendererChain.h',
     'trunk/include/gpu/GrPoint.h',
     'trunk/include/gpu/GrRect.h',
     'trunk/include/gpu/GrRenderTarget.h',
     'trunk/include/gpu/GrResource.h',
     'trunk/include/gpu/GrSurface.h',
     'trunk/include/gpu/GrTBackendEffectFactory.h',
-    'trunk/include/gpu/GrTextContext.h',
     'trunk/include/gpu/GrTexture.h',
     'trunk/include/gpu/GrTextureAccess.h',
     'trunk/include/gpu/GrTypes.h',
     'trunk/include/gpu/GrTypesPriv.h',
     'trunk/include/gpu/GrUserConfig.h',
     'trunk/include/gpu/SkGpuDevice.h',
     'trunk/include/gpu/SkGr.h',
     'trunk/include/gpu/SkGrPixelRef.h',
@@ -252,16 +244,17 @@ EXPORTS.skia += [
     'trunk/include/utils/SkJSON.h',
     'trunk/include/utils/SkJSONCPP.h',
     'trunk/include/utils/SkLayer.h',
     'trunk/include/utils/SkLua.h',
     'trunk/include/utils/SkLuaCanvas.h',
     'trunk/include/utils/SkMatrix44.h',
     'trunk/include/utils/SkMeshUtils.h',
     'trunk/include/utils/SkNinePatch.h',
+    'trunk/include/utils/SkNoSaveLayerCanvas.h',
     'trunk/include/utils/SkNullCanvas.h',
     'trunk/include/utils/SkNWayCanvas.h',
     'trunk/include/utils/SkParse.h',
     'trunk/include/utils/SkParsePaint.h',
     'trunk/include/utils/SkParsePath.h',
     'trunk/include/utils/SkPathUtils.h',
     'trunk/include/utils/SkPictureUtils.h',
     'trunk/include/utils/SkProxyCanvas.h',
@@ -353,16 +346,17 @@ SOURCES += [
     'trunk/src/core/SkCubicClipper.cpp',
     'trunk/src/core/SkData.cpp',
     'trunk/src/core/SkDataTable.cpp',
     'trunk/src/core/SkDebug.cpp',
     'trunk/src/core/SkDeque.cpp',
     'trunk/src/core/SkDevice.cpp',
     'trunk/src/core/SkDeviceLooper.cpp',
     'trunk/src/core/SkDeviceProfile.cpp',
+    'trunk/src/core/SkDistanceFieldGen.cpp',
     'trunk/src/core/SkDither.cpp',
     'trunk/src/core/SkDraw.cpp',
     'trunk/src/core/SkDrawLooper.cpp',
     'trunk/src/core/SkEdge.cpp',
     'trunk/src/core/SkEdgeBuilder.cpp',
     'trunk/src/core/SkEdgeClipper.cpp',
     'trunk/src/core/SkError.cpp',
     'trunk/src/core/SkFilterProc.cpp',
@@ -373,17 +367,16 @@ SOURCES += [
     'trunk/src/core/SkFloatBits.cpp',
     'trunk/src/core/SkFontDescriptor.cpp',
     'trunk/src/core/SkFontHost.cpp',
     'trunk/src/core/SkFontStream.cpp',
     'trunk/src/core/SkGeometry.cpp',
     'trunk/src/core/SkGlyphCache.cpp',
     'trunk/src/core/SkGraphics.cpp',
     'trunk/src/core/SkImageFilter.cpp',
-    'trunk/src/core/SkImageFilterUtils.cpp',
     'trunk/src/core/SkImageInfo.cpp',
     'trunk/src/core/SkInstCnt.cpp',
     'trunk/src/core/SkLineClipper.cpp',
     'trunk/src/core/SkMallocPixelRef.cpp',
     'trunk/src/core/SkMask.cpp',
     'trunk/src/core/SkMaskFilter.cpp',
     'trunk/src/core/SkMaskGamma.cpp',
     'trunk/src/core/SkMath.cpp',
@@ -510,16 +503,18 @@ SOURCES += [
     'trunk/src/effects/SkXfermodeImageFilter.cpp',
     'trunk/src/fonts/SkGScalerContext.cpp',
     'trunk/src/gpu/effects/GrBezierEffect.cpp',
     'trunk/src/gpu/effects/GrBicubicEffect.cpp',
     'trunk/src/gpu/effects/GrConfigConversionEffect.cpp',
     'trunk/src/gpu/effects/GrConvexPolyEffect.cpp',
     'trunk/src/gpu/effects/GrConvolutionEffect.cpp',
     'trunk/src/gpu/effects/GrCustomCoordsTextureEffect.cpp',
+    'trunk/src/gpu/effects/GrDistanceFieldTextureEffect.cpp',
+    'trunk/src/gpu/effects/GrRRectEffect.cpp',
     'trunk/src/gpu/effects/GrSimpleTextureEffect.cpp',
     'trunk/src/gpu/effects/GrSingleTextureEffect.cpp',
     'trunk/src/gpu/effects/GrTextureDomain.cpp',
     'trunk/src/gpu/effects/GrTextureStripAtlas.cpp',
     'trunk/src/gpu/gl/debug/GrBufferObj.cpp',
     'trunk/src/gpu/gl/debug/GrDebugGL.cpp',
     'trunk/src/gpu/gl/debug/GrFrameBufferObj.cpp',
     'trunk/src/gpu/gl/debug/GrGLCreateDebugInterface.cpp',
@@ -565,16 +560,17 @@ SOURCES += [
     'trunk/src/gpu/GrBlend.cpp',
     'trunk/src/gpu/GrBufferAllocPool.cpp',
     'trunk/src/gpu/GrCacheID.cpp',
     'trunk/src/gpu/GrClipData.cpp',
     'trunk/src/gpu/GrClipMaskCache.cpp',
     'trunk/src/gpu/GrClipMaskManager.cpp',
     'trunk/src/gpu/GrContext.cpp',
     'trunk/src/gpu/GrDefaultPathRenderer.cpp',
+    'trunk/src/gpu/GrDistanceFieldTextContext.cpp',
     'trunk/src/gpu/GrDrawState.cpp',
     'trunk/src/gpu/GrDrawTarget.cpp',
     'trunk/src/gpu/GrEffect.cpp',
     'trunk/src/gpu/GrGpu.cpp',
     'trunk/src/gpu/GrGpuFactory.cpp',
     'trunk/src/gpu/GrInOrderDrawBuffer.cpp',
     'trunk/src/gpu/GrMemoryPool.cpp',
     'trunk/src/gpu/GrOvalRenderer.cpp',
@@ -688,17 +684,16 @@ SOURCES += [
     'trunk/src/utils/SkParse.cpp',
     'trunk/src/utils/SkParseColor.cpp',
     'trunk/src/utils/SkParsePath.cpp',
     'trunk/src/utils/SkPathUtils.cpp',
     'trunk/src/utils/SkPictureUtils.cpp',
     'trunk/src/utils/SkProxyCanvas.cpp',
     'trunk/src/utils/SkRTConf.cpp',
     'trunk/src/utils/SkSHA1.cpp',
-    'trunk/src/utils/SkThreadPool.cpp',
     'trunk/src/utils/SkUnitMappers.cpp',
 ]
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):
     SOURCES += [
         'trunk/src/images/SkImageRef_ashmem.cpp',
         'trunk/src/ports/SkDebug_android.cpp',
         'trunk/src/ports/SkFontHost_android_old.cpp',
         'trunk/src/ports/SkFontHost_cairo.cpp',
deleted file mode 100644
--- a/gfx/skia/trunk/include/core/Sk64.h
+++ /dev/null
@@ -1,230 +0,0 @@
-
-/*
- * 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.
- */
-
-
-#ifndef Sk64_DEFINED
-#define Sk64_DEFINED
-
-#include "SkFixed.h"
-
-/** \class Sk64
-
-    Sk64 is a 64-bit math package that does not require long long support from the compiler.
-*/
-struct SK_API Sk64 {
-    int32_t  fHi;   //!< the high 32 bits of the number (including sign)
-    uint32_t fLo;   //!< the low 32 bits of the number
-
-    /** Returns non-zero if the Sk64 can be represented as a signed 32 bit integer
-    */
-    SkBool is32() const { return fHi == ((int32_t)fLo >> 31); }
-
-    /** Returns non-zero if the Sk64 cannot be represented as a signed 32 bit integer
-    */
-    SkBool is64() const { return fHi != ((int32_t)fLo >> 31); }
-
-    /** Returns non-zero if the Sk64 can be represented as a signed 48 bit integer. Used to know
-        if we can shift the value down by 16 to treat it as a SkFixed.
-    */
-    SkBool isFixed() const;
-
-    /** Return the signed 32 bit integer equivalent. Asserts that is32() returns non-zero.
-    */
-    int32_t get32() const { SkASSERT(this->is32()); return (int32_t)fLo; }
-
-    /** Return the number >> 16. Asserts that this does not loose any significant high bits.
-    */
-    SkFixed getFixed() const {
-        SkASSERT(this->isFixed());
-
-        uint32_t sum = fLo + (1 << 15);
-        int32_t  hi = fHi;
-        if (sum < fLo) {
-            hi += 1;
-        }
-        return (hi << 16) | (sum >> 16);
-    }
-
-    /** Return the number >> 30. Asserts that this does not loose any
-        significant high bits.
-    */
-    SkFract getFract() const;
-
-    /** Returns the square-root of the number as a signed 32 bit value. */
-    int32_t getSqrt() const;
-
-    /** Returns the number of leading zeros of the absolute value of this.
-        Will return in the range [0..64]
-    */
-    int getClzAbs() const;
-
-    /** Returns non-zero if the number is zero */
-    SkBool  isZero() const { return (fHi | fLo) == 0; }
-
-    /** Returns non-zero if the number is non-zero */
-    SkBool  nonZero() const { return fHi | fLo; }
-
-    /** Returns non-zero if the number is negative (number < 0) */
-    SkBool  isNeg() const { return (uint32_t)fHi >> 31; }
-
-    /** Returns non-zero if the number is positive (number > 0) */
-    SkBool  isPos() const { return ~(fHi >> 31) & (fHi | fLo); }
-
-    /** Returns -1,0,+1 based on the sign of the number */
-    int     getSign() const { return (fHi >> 31) | Sk32ToBool(fHi | fLo); }
-
-    /** Negate the number */
-    void    negate();
-
-    /** If the number < 0, negate the number
-    */
-    void    abs();
-
-    /** Returns the number of bits needed to shift the Sk64 to the right
-        in order to make it fit in a signed 32 bit integer.
-    */
-    int     shiftToMake32() const;
-
-    /** Set the number to zero */
-    void    setZero() { fHi = fLo = 0; }
-
-    /** Set the high and low 32 bit values of the number */
-    void    set(int32_t hi, uint32_t lo) { fHi = hi; fLo = lo; }
-
-    /** Set the number to the specified 32 bit integer */
-    void    set(int32_t a) { fHi = a >> 31; fLo = a; }
-
-    /** Set the number to the product of the two 32 bit integers */
-    void    setMul(int32_t a, int32_t b);
-
-    /** extract 32bits after shifting right by bitCount.
-        Note: itCount must be [0..63].
-        Asserts that no significant high bits were lost.
-    */
-    int32_t getShiftRight(unsigned bitCount) const;
-
-    /** Shift the number left by the specified number of bits.
-        @param bits How far to shift left, must be [0..63]
-    */
-    void    shiftLeft(unsigned bits);
-
-    /** Shift the number right by the specified number of bits.
-        @param bits How far to shift right, must be [0..63]. This
-        performs an arithmetic right-shift (sign extending).
-    */
-    void    shiftRight(unsigned bits);
-
-    /** Shift the number right by the specified number of bits, but
-        round the result.
-        @param bits How far to shift right, must be [0..63]. This
-        performs an arithmetic right-shift (sign extending).
-    */
-    void    roundRight(unsigned bits);
-
-    /** Add the specified 32 bit integer to the number */
-    void add(int32_t lo) {
-        int32_t  hi = lo >> 31; // 0 or -1
-        uint32_t sum = fLo + (uint32_t)lo;
-
-        fHi = fHi + hi + (sum < fLo);
-        fLo = sum;
-    }
-
-    /** Add the specified Sk64 to the number */
-    void add(int32_t hi, uint32_t lo) {
-        uint32_t sum = fLo + lo;
-
-        fHi = fHi + hi + (sum < fLo);
-        fLo = sum;
-    }
-
-    /** Add the specified Sk64 to the number */
-    void    add(const Sk64& other) { this->add(other.fHi, other.fLo); }
-
-    /** Subtract the specified Sk64 from the number. (*this) = (*this) - num
-    */
-    void    sub(const Sk64& num);
-
-    /** Subtract the number from the specified Sk64. (*this) = num - (*this)
-    */
-    void    rsub(const Sk64& num);
-
-    /** Multiply the number by the specified 32 bit integer
-    */
-    void    mul(int32_t);
-
-    enum DivOptions {
-        kTrunc_DivOption,   //!< truncate the result when calling div()
-        kRound_DivOption    //!< round the result when calling div()
-    };
-
-    /** Divide the number by the specified 32 bit integer, using the specified
-        divide option (either truncate or round).
-    */
-    void    div(int32_t, DivOptions);
-
-    /** return (this + other >> 16) as a 32bit result */
-    SkFixed addGetFixed(const Sk64& other) const {
-        return this->addGetFixed(other.fHi, other.fLo);
-    }
-
-    /** return (this + Sk64(hi, lo) >> 16) as a 32bit result */
-    SkFixed addGetFixed(int32_t hi, uint32_t lo) const {
-#ifdef SK_DEBUG
-        Sk64    tmp(*this);
-        tmp.add(hi, lo);
-#endif
-
-        uint32_t sum = fLo + lo;
-        hi += fHi + (sum < fLo);
-        lo = sum;
-
-        sum = lo + (1 << 15);
-        if (sum < lo)
-            hi += 1;
-
-        hi = (hi << 16) | (sum >> 16);
-        SkASSERT(hi == tmp.getFixed());
-        return hi;
-    }
-
-    /** Return the result of dividing the number by denom, treating the answer
-        as a SkFixed. (*this) << 16 / denom. It is an error for denom to be 0.
-    */
-    SkFixed getFixedDiv(const Sk64& denom) const;
-
-    friend bool operator==(const Sk64& a, const Sk64& b) {
-        return a.fHi == b.fHi && a.fLo == b.fLo;
-    }
-
-    friend bool operator!=(const Sk64& a, const Sk64& b) {
-        return a.fHi != b.fHi || a.fLo != b.fLo;
-    }
-
-    friend bool operator<(const Sk64& a, const Sk64& b) {
-        return a.fHi < b.fHi || (a.fHi == b.fHi && a.fLo < b.fLo);
-    }
-
-    friend bool operator<=(const Sk64& a, const Sk64& b) {
-        return a.fHi < b.fHi || (a.fHi == b.fHi && a.fLo <= b.fLo);
-    }
-
-    friend bool operator>(const Sk64& a, const Sk64& b) {
-        return a.fHi > b.fHi || (a.fHi == b.fHi && a.fLo > b.fLo);
-    }
-
-    friend bool operator>=(const Sk64& a, const Sk64& b) {
-        return a.fHi > b.fHi || (a.fHi == b.fHi && a.fLo >= b.fLo);
-    }
-
-#ifdef SkLONGLONG
-    SkLONGLONG getLongLong() const;
-#endif
-};
-
-#endif
--- a/gfx/skia/trunk/include/core/SkAnnotation.h
+++ b/gfx/skia/trunk/include/core/SkAnnotation.h
@@ -19,28 +19,37 @@ class SkWStream;
 struct SkPoint;
 
 /**
  *  Experimental class for annotating draws. Do not use directly yet.
  *  Use helper functions at the bottom of this file for now.
  */
 class SkAnnotation : public SkRefCnt {
 public:
-    SkAnnotation(const char key[], SkData* value);
     virtual ~SkAnnotation();
 
+    static SkAnnotation* Create(const char key[], SkData* value) {
+        return SkNEW_ARGS(SkAnnotation, (key, value));
+    }
+
+    static SkAnnotation* Create(SkReadBuffer& buffer) {
+        return SkNEW_ARGS(SkAnnotation, (buffer));
+    }
+
     /**
      *  Return the data for the specified key, or NULL.
      */
     SkData* find(const char key[]) const;
 
-    SkAnnotation(SkReadBuffer&);
     void writeToBuffer(SkWriteBuffer&) const;
 
 private:
+    SkAnnotation(const char key[], SkData* value);
+    SkAnnotation(SkReadBuffer&);
+
     SkString    fKey;
     SkData*     fData;
 
     typedef SkRefCnt INHERITED;
 };
 
 /**
  *  Experimental collection of predefined Keys into the Annotation dictionary
--- a/gfx/skia/trunk/include/core/SkBitmap.h
+++ b/gfx/skia/trunk/include/core/SkBitmap.h
@@ -9,24 +9,24 @@
 #define SkBitmap_DEFINED
 
 #include "SkColor.h"
 #include "SkColorTable.h"
 #include "SkImageInfo.h"
 #include "SkPoint.h"
 #include "SkRefCnt.h"
 
+struct SkMask;
 struct SkIRect;
 struct SkRect;
 class SkPaint;
 class SkPixelRef;
 class SkPixelRefFactory;
 class SkRegion;
 class SkString;
-
 class GrTexture;
 
 /** \class SkBitmap
 
     The SkBitmap class specifies a raster bitmap. A bitmap has an integer width
     and height, and a format (config), and a pointer to the actual pixels.
     Bitmaps can be drawn into a SkCanvas, but they are also used to specify the
     target of a SkCanvas' drawing operations.
@@ -304,16 +304,32 @@ public:
      *  pixels and context as parameters.
      *  On failure, the bitmap will be set to empty and return false.
      */
     bool installPixels(const SkImageInfo&, void* pixels, size_t rowBytes,
                        void (*ReleaseProc)(void* addr, void* context),
                        void* context);
 
     /**
+     *  Call installPixels with no ReleaseProc specified. This means that the
+     *  caller must ensure that the specified pixels are valid for the lifetime
+     *  of the created bitmap (and its pixelRef).
+     */
+    bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) {
+        return this->installPixels(info, pixels, rowBytes, NULL, NULL);
+    }
+
+    /**
+     *  Calls installPixels() with the value in the SkMask. The caller must
+     *  ensure that the specified mask pixels are valid for the lifetime
+     *  of the created bitmap (and its pixelRef).
+     */
+    bool installMaskPixels(const SkMask&);
+
+    /**
      *  DEPRECATED: call info().
      */
     bool asImageInfo(SkImageInfo* info) const {
         // compatibility: return false for kUnknown
         if (kUnknown_SkColorType == this->colorType()) {
             return false;
         }
         if (info) {
@@ -450,17 +466,17 @@ public:
     bool lockPixelsAreWritable() const;
 
     /** Call this to be sure that the bitmap is valid enough to be drawn (i.e.
         it has non-null pixels, and if required by its config, it has a
         non-null colortable. Returns true if all of the above are met.
     */
     bool readyToDraw() const {
         return this->getPixels() != NULL &&
-               (this->config() != kIndex8_Config || NULL != fColorTable);
+               (this->colorType() != kIndex_8_SkColorType || NULL != fColorTable);
     }
 
     /** Returns the pixelRef's texture, or NULL
      */
     GrTexture* getTexture() const;
 
     /** Return the bitmap's colortable, if it uses one (i.e. colorType is
         Index_8) and the pixels are locked.
@@ -594,43 +610,47 @@ public:
         returned and dst will be untouched.
         @param dst  The bitmap that will be set to a subset of this bitmap
         @param subset The rectangle of pixels in this bitmap that dst will
                       reference.
         @return true if the subset copy was successfully made.
     */
     bool extractSubset(SkBitmap* dst, const SkIRect& subset) const;
 
-    /** Makes a deep copy of this bitmap, respecting the requested config,
+    /** Makes a deep copy of this bitmap, respecting the requested colorType,
      *  and allocating the dst pixels on the cpu.
      *  Returns false if either there is an error (i.e. the src does not have
      *  pixels) or the request cannot be satisfied (e.g. the src has per-pixel
      *  alpha, and the requested config does not support alpha).
      *  @param dst The bitmap to be sized and allocated
-     *  @param c The desired config for dst
+     *  @param ct The desired colorType for dst
      *  @param allocator Allocator used to allocate the pixelref for the dst
      *                   bitmap. If this is null, the standard HeapAllocator
      *                   will be used.
-     *  @return true if the copy could be made.
+     *  @return true if the copy was made.
      */
-    bool copyTo(SkBitmap* dst, Config c, Allocator* allocator = NULL) const;
+    bool copyTo(SkBitmap* dst, SkColorType ct, Allocator* = NULL) const;
+
+    bool copyTo(SkBitmap* dst, Allocator* allocator = NULL) const {
+        return this->copyTo(dst, this->colorType(), allocator);
+    }
 
-    /** Makes a deep copy of this bitmap, respecting the requested config, and
-     *  with custom allocation logic that will keep the copied pixels
+    /**
+     *  Returns true if this bitmap's pixels can be converted into the requested
+     *  colorType, such that copyTo() could succeed.
+     */
+    bool canCopyTo(SkColorType colorType) const;
+
+    /** Makes a deep copy of this bitmap, keeping the copied pixels
      *  in the same domain as the source: If the src pixels are allocated for
      *  the cpu, then so will the dst. If the src pixels are allocated on the
      *  gpu (typically as a texture), the it will do the same for the dst.
      *  If the request cannot be fulfilled, returns false and dst is unmodified.
      */
-    bool deepCopyTo(SkBitmap* dst, Config c) const;
-
-    /** Returns true if this bitmap can be deep copied into the requested config
-        by calling copyTo().
-     */
-    bool canCopyTo(Config newConfig) const;
+    bool deepCopyTo(SkBitmap* dst) const;
 
     SK_ATTR_DEPRECATED("use setFilterLevel on SkPaint")
     void buildMipMap(bool forceRebuild = false);
 
 #ifdef SK_BUILD_FOR_ANDROID
     bool hasHardwareMipMap() const {
         return (fFlags & kHasHardwareMipMap_Flag) != 0;
     }
@@ -722,17 +742,17 @@ public:
             fYPtrs[y] = addr;
         }
 
     private:
         uint8_t** fYPtrs;
         int       fHeight;
     };
 
-    SkDEVCODE(void toString(SkString* str) const;)
+    SK_TO_STRING_NONVIRT()
 
 private:
     struct MipMap;
     mutable MipMap* fMipMap;
 
     mutable SkPixelRef* fPixelRef;
     mutable int         fPixelLockCount;
     // These are just caches from the locked pixelref
@@ -865,36 +885,43 @@ private:
     const SkPMColor* fColors;
 };
 #define SkAutoLockColors(...) SK_REQUIRE_LOCAL_VAR(SkAutoLockColors)
 
 ///////////////////////////////////////////////////////////////////////////////
 
 inline uint32_t* SkBitmap::getAddr32(int x, int y) const {
     SkASSERT(fPixels);
-    SkASSERT(this->config() == kARGB_8888_Config);
+    SkASSERT(4 == this->bytesPerPixel());
     SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)this->height());
     return (uint32_t*)((char*)fPixels + y * fRowBytes + (x << 2));
 }
 
 inline uint16_t* SkBitmap::getAddr16(int x, int y) const {
     SkASSERT(fPixels);
-    SkASSERT(this->config() == kRGB_565_Config || this->config() == kARGB_4444_Config);
+    SkASSERT(2 == this->bytesPerPixel());
     SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)this->height());
     return (uint16_t*)((char*)fPixels + y * fRowBytes + (x << 1));
 }
 
 inline uint8_t* SkBitmap::getAddr8(int x, int y) const {
     SkASSERT(fPixels);
-    SkASSERT(this->config() == kA8_Config || this->config() == kIndex8_Config);
+    SkASSERT(1 == this->bytesPerPixel());
     SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)this->height());
     return (uint8_t*)fPixels + y * fRowBytes + x;
 }
 
 inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const {
     SkASSERT(fPixels);
-    SkASSERT(this->config() == kIndex8_Config);
+    SkASSERT(kIndex_8_SkColorType == this->colorType());
     SkASSERT((unsigned)x < (unsigned)this->width() && (unsigned)y < (unsigned)this->height());
     SkASSERT(fColorTable);
     return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)];
 }
 
+///////////////////////////////////////////////////////////////////////////////
+//
+// Helpers until we can fully deprecate SkBitmap::Config
+//
+extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType);
+extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config);
+
 #endif
--- a/gfx/skia/trunk/include/core/SkBitmapDevice.h
+++ b/gfx/skia/trunk/include/core/SkBitmapDevice.h
@@ -25,16 +25,17 @@ public:
 
     /**
      *  Construct a new device with the specified bitmap as its backend. It is
      *  valid for the bitmap to have no pixels associated with it. In that case,
      *  any drawing to this device will have no effect.
     */
     SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties);
 
+#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
     /**
      *  Create a new raster device and have the pixels be automatically
      *  allocated. The rowBytes of the device will be computed automatically
      *  based on the config and the width.
      *
      *  @param config   The desired config for the pixels. If the request cannot
      *                  be met, the closest matching support config will be used.
      *  @param width    width (in pixels) of the device
@@ -56,20 +57,19 @@ public:
      *  @param height   height (in pixels) of the device
      *  @param isOpaque Set to true if it is known that all of the pixels will
      *                  be drawn to opaquely. Used as an accelerator when drawing
      *                  these pixels to another device.
      *  @param deviceProperties Properties which affect compositing.
      */
     SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
                    const SkDeviceProperties& deviceProperties);
-
-    virtual ~SkBitmapDevice();
-
-    virtual uint32_t getDeviceCapabilities() SK_OVERRIDE { return 0; }
+#endif
+    static SkBitmapDevice* Create(const SkImageInfo&,
+                                  const SkDeviceProperties* = NULL);
 
     /** Return the width of the device (in pixels).
     */
     virtual int width() const SK_OVERRIDE { return fBitmap.width(); }
     /** Return the height of the device (in pixels).
     */
     virtual int height() const SK_OVERRIDE { return fBitmap.height(); }
 
@@ -77,16 +77,19 @@ public:
         implicitly opaque.
     */
     virtual bool isOpaque() const SK_OVERRIDE { return fBitmap.isOpaque(); }
 
     /** Return the bitmap config of the device's pixels
     */
     virtual SkBitmap::Config config() const SK_OVERRIDE { return fBitmap.config(); }
 
+    virtual SkImageInfo imageInfo() const SK_OVERRIDE;
+
+#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG
     /**
      *  DEPRECATED: This will be made protected once WebKit stops using it.
      *              Instead use Canvas' writePixels method.
      *
      *  Similar to draw sprite, this method will copy the pixels in bitmap onto
      *  the device, with the top/left corner specified by (x, y). The pixel
      *  values in the device are completely replaced: there is no blending.
      *
@@ -94,17 +97,17 @@ public:
      *  relaxed in the future.
      *
      *  If the bitmap has config kARGB_8888_Config then the config8888 param
      *  will determines how the pixel valuess are intepreted. If the bitmap is
      *  not kARGB_8888_Config then this parameter is ignored.
      */
     virtual void writePixels(const SkBitmap& bitmap, int x, int y,
                              SkCanvas::Config8888 config8888) SK_OVERRIDE;
-
+#endif
     /**
      * Return the device's associated gpu render target, or NULL.
      */
     virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; }
 
 protected:
     /**
      *  Device may filter the text flags for drawing text here. If it wants to
@@ -178,17 +181,17 @@ protected:
                                 const SkPath& path, const SkMatrix* matrix,
                                 const SkPaint& paint) SK_OVERRIDE;
     virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCount,
                               const SkPoint verts[], const SkPoint texs[],
                               const SkColor colors[], SkXfermode* xmode,
                               const uint16_t indices[], int indexCount,
                               const SkPaint& paint) SK_OVERRIDE;
     /** The SkBaseDevice passed will be an SkBaseDevice which was returned by a call to
-        onCreateCompatibleDevice on this device with kSaveLayer_Usage.
+        onCreateDevice on this device with kSaveLayer_Usage.
      */
     virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
                             const SkPaint&) SK_OVERRIDE;
 
     ///////////////////////////////////////////////////////////////////////////
 
     /** Update as needed the pixel value in the bitmap, so that the caller can
         access the pixels directly. Note: only the pixels field should be
@@ -206,19 +209,19 @@ protected:
 
     /**
      * Implements readPixels API. The caller will ensure that:
      *  1. bitmap has pixel config kARGB_8888_Config.
      *  2. bitmap has pixels.
      *  3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is
      *     contained in the device bounds.
      */
-    virtual bool onReadPixels(const SkBitmap& bitmap,
-                              int x, int y,
-                              SkCanvas::Config8888 config8888) SK_OVERRIDE;
+    virtual bool onReadPixels(const SkBitmap&, int x, int y, SkCanvas::Config8888) SK_OVERRIDE;
+    virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) SK_OVERRIDE;
+    virtual void* onAccessPixels(SkImageInfo* info, size_t* rowBytes) SK_OVERRIDE;
 
     /** Called when this device is installed into a Canvas. Balanced by a call
         to unlockPixels() when the device is removed from a Canvas.
     */
     virtual void lockPixels() SK_OVERRIDE;
     virtual void unlockPixels() SK_OVERRIDE;
 
     /**
@@ -240,48 +243,46 @@ protected:
 
     /**
      *  Related (but not required) to canHandleImageFilter, this method returns
      *  true if the device could apply the filter to the src bitmap and return
      *  the result (and updates offset as needed).
      *  If the device does not recognize or support this filter,
      *  it just returns false and leaves result and offset unchanged.
      */
-    virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkMatrix&,
+    virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkImageFilter::Context&,
                              SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
 
 private:
     friend class SkCanvas;
     friend struct DeviceCM; //for setMatrixClip
     friend class SkDraw;
     friend class SkDrawIter;
     friend class SkDeviceFilteredPaint;
     friend class SkDeviceImageFilterProxy;
 
     friend class SkSurface_Raster;
 
-    void init(SkBitmap::Config config, int width, int height, bool isOpaque);
-
     // used to change the backend's pixels (and possibly config/rowbytes)
     // but cannot change the width/height, so there should be no change to
     // any clip information.
     virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE;
 
-    /**
-     * Subclasses should override this to implement createCompatibleDevice.
-     */
-    virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
-                                                   int width, int height,
-                                                   bool isOpaque,
-                                                   Usage usage) SK_OVERRIDE;
+#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
+    // in support of legacy constructors
+    void init(SkBitmap::Config config, int width, int height, bool isOpaque);
+#endif
+
+    virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE;
 
     /** Causes any deferred drawing to the device to be completed.
      */
     virtual void flush() SK_OVERRIDE {}
 
     virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE;
+    virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE;
 
     SkBitmap    fBitmap;
 
     typedef SkBaseDevice INHERITED;
 };
 
 #endif // SkBitmapDevice_DEFINED
--- a/gfx/skia/trunk/include/core/SkCanvas.h
+++ b/gfx/skia/trunk/include/core/SkCanvas.h
@@ -13,26 +13,36 @@
 #include "SkDeque.h"
 #include "SkClipStack.h"
 #include "SkPaint.h"
 #include "SkRefCnt.h"
 #include "SkPath.h"
 #include "SkRegion.h"
 #include "SkXfermode.h"
 
+// if not defined, we always assume ClipToLayer for saveLayer()
+//#define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
+
+
+//#define SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG
+//#define SK_SUPPORT_LEGACY_GETCLIPTYPE
+//#define SK_SUPPORT_LEGACY_GETTOTALCLIP
+//#define SK_SUPPORT_LEGACY_GETTOPDEVICE
+
 class SkBounder;
 class SkBaseDevice;
 class SkDraw;
 class SkDrawFilter;
 class SkMetaData;
 class SkPicture;
 class SkRRect;
 class SkSurface;
 class SkSurface_Base;
 class GrContext;
+class GrRenderTarget;
 
 /** \class SkCanvas
 
     A Canvas encapsulates all of the state about drawing into a device (bitmap).
     This includes a reference to the device itself, and a stack of matrix/clip
     values. For any given draw call (e.g. drawRect), the geometry of the object
     being drawn is transformed by the concatenation of all the matrices in the
     stack. The transformed geometry is clipped by the intersection of all of
@@ -44,16 +54,66 @@ class GrContext;
     color, typeface, textSize, strokeWidth, shader (e.g. gradients, patterns),
     etc.
 */
 class SK_API SkCanvas : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(SkCanvas)
 
     /**
+     *  Attempt to allocate an offscreen raster canvas, matching the ImageInfo.
+     *  On success, return a new canvas that will draw into that offscreen.
+     *
+     *  The caller can access the pixels after drawing into this canvas by
+     *  calling readPixels() or peekPixels().
+     *
+     *  If the requested ImageInfo is opaque (either the colortype is
+     *  intrinsically opaque like RGB_565, or the info's alphatype is kOpaque)
+     *  then the pixel memory may be uninitialized. Otherwise, the pixel memory
+     *  will be initialized to 0, which is interpreted as transparent.
+     *
+     *  On failure, return NULL. This can fail for several reasons:
+     *  1. the memory allocation failed (e.g. request is too large)
+     *  2. invalid ImageInfo (e.g. negative dimensions)
+     *  3. unsupported ImageInfo for a canvas
+     *      - kUnknown_SkColorType, kIndex_8_SkColorType
+     *      - kIgnore_SkAlphaType
+     *      - this list is not complete, so others may also be unsupported
+     *
+     *  Note: it is valid to request a supported ImageInfo, but with zero
+     *  dimensions.
+     */
+    static SkCanvas* NewRaster(const SkImageInfo&);
+
+    static SkCanvas* NewRasterN32(int width, int height) {
+        return NewRaster(SkImageInfo::MakeN32Premul(width, height));
+    }
+
+    /**
+     *  Attempt to allocate raster canvas, matching the ImageInfo, that will draw directly into the
+     *  specified pixels. To access the pixels after drawing to them, the caller should call
+     *  flush() or call peekPixels(...).
+     *
+     *  On failure, return NULL. This can fail for several reasons:
+     *  1. invalid ImageInfo (e.g. negative dimensions)
+     *  2. unsupported ImageInfo for a canvas
+     *      - kUnknown_SkColorType, kIndex_8_SkColorType
+     *      - kIgnore_SkAlphaType
+     *      - this list is not complete, so others may also be unsupported
+     *
+     *  Note: it is valid to request a supported ImageInfo, but with zero
+     *  dimensions.
+     */
+    static SkCanvas* NewRasterDirect(const SkImageInfo&, void*, size_t);
+
+    static SkCanvas* NewRasterDirectN32(int width, int height, SkPMColor* pixels, size_t rowBytes) {
+        return NewRasterDirect(SkImageInfo::MakeN32Premul(width, height), pixels, rowBytes);
+    }
+
+    /**
      *  Creates an empty canvas with no backing device/pixels, and zero
      *  dimensions.
      */
     SkCanvas();
 
     /**
      *  Creates a canvas of the specified dimensions, but explicitly not backed
      *  by any device/pixels. Typically this use used by subclasses who handle
@@ -71,66 +131,111 @@ public:
         @param bitmap   Specifies a bitmap for the canvas to draw into. Its
                         structure are copied to the canvas.
     */
     explicit SkCanvas(const SkBitmap& bitmap);
     virtual ~SkCanvas();
 
     SkMetaData& getMetaData();
 
+    /**
+     *  Return ImageInfo for this canvas. If the canvas is not backed by pixels
+     *  (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType.
+     */
+    SkImageInfo imageInfo() const;
+
     ///////////////////////////////////////////////////////////////////////////
 
     /**
      *  Trigger the immediate execution of all pending draw operations.
      */
     void flush();
 
     /**
-     *  Return the width/height of the underlying device. The current drawable
-     *  area may be small (due to clipping or saveLayer). For a canvas with
-     *  no device, 0,0 will be returned.
+     * Gets the size of the base or root layer in global canvas coordinates. The
+     * origin of the base layer is always (0,0). The current drawable area may be
+     * smaller (due to clipping or saveLayer).
+     */
+    SkISize getBaseLayerSize() const;
+
+    /**
+     *  DEPRECATED: call getBaseLayerSize
      */
-    SkISize getDeviceSize() const;
+    SkISize getDeviceSize() const { return this->getBaseLayerSize(); }
 
-    /** Return the canvas' device object, which may be null. The device holds
-        the bitmap of the pixels that the canvas draws into. The reference count
-        of the returned device is not changed by this call.
-    */
+    /**
+     *  DEPRECATED.
+     *  Return the canvas' device object, which may be null. The device holds
+     *  the bitmap of the pixels that the canvas draws into. The reference count
+     *  of the returned device is not changed by this call.
+     */
     SkBaseDevice* getDevice() const;
 
     /**
      *  saveLayer() can create another device (which is later drawn onto
      *  the previous device). getTopDevice() returns the top-most device current
      *  installed. Note that this can change on other calls like save/restore,
      *  so do not access this device after subsequent canvas calls.
      *  The reference count of the device is not changed.
      *
      * @param updateMatrixClip If this is true, then before the device is
      *        returned, we ensure that its has been notified about the current
      *        matrix and clip. Note: this happens automatically when the device
      *        is drawn to, but is optional here, as there is a small perf hit
      *        sometimes.
      */
+#ifndef SK_SUPPORT_LEGACY_GETTOPDEVICE
+private:
+#endif
     SkBaseDevice* getTopDevice(bool updateMatrixClip = false) const;
+public:
 
     /**
      *  Create a new surface matching the specified info, one that attempts to
      *  be maximally compatible when used with this canvas.
      */
     SkSurface* newSurface(const SkImageInfo&);
 
     /**
      * Return the GPU context of the device that is associated with the canvas.
      * For a canvas with non-GPU device, NULL is returned.
      */
     GrContext* getGrContext();
 
     ///////////////////////////////////////////////////////////////////////////
 
     /**
+     *  If the canvas has writable pixels in its top layer (and is not recording to a picture
+     *  or other non-raster target) and has direct access to its pixels (i.e. they are in
+     *  local RAM) return the address of those pixels, and if not null,
+     *  return the ImageInfo and rowBytes. The returned address is only valid
+     *  while the canvas object is in scope and unchanged. Any API calls made on
+     *  canvas (or its parent surface if any) will invalidate the
+     *  returned address (and associated information).
+     *
+     *  On failure, returns NULL and the info and rowBytes parameters are
+     *  ignored.
+     */
+    void* accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes);
+
+    /**
+     *  If the canvas has readable pixels in its base layer (and is not recording to a picture
+     *  or other non-raster target) and has direct access to its pixels (i.e. they are in
+     *  local RAM) return the const-address of those pixels, and if not null,
+     *  return the ImageInfo and rowBytes. The returned address is only valid
+     *  while the canvas object is in scope and unchanged. Any API calls made on
+     *  canvas (or its parent surface if any) will invalidate the
+     *  returned address (and associated information).
+     *
+     *  On failure, returns NULL and the info and rowBytes parameters are
+     *  ignored.
+     */
+    const void* peekPixels(SkImageInfo* info, size_t* rowBytes);
+
+    /**
      * This enum can be used with read/writePixels to perform a pixel ops to or
      * from an 8888 config other than Skia's native config (SkPMColor). There
      * are three byte orders supported: native, BGRA, and RGBA. Each has a
      * premultiplied and unpremultiplied variant.
      *
      * Components of a 8888 pixel can be packed/unpacked from a 32bit word using
      * either byte offsets or shift values. Byte offsets are endian-invariant
      * while shifts are not. BGRA and RGBA configs are defined by byte
@@ -203,52 +308,85 @@ public:
     /**
      * DEPRECATED: This will be removed as soon as webkit is no longer relying
      * on it. The bitmap is resized to the intersection of srcRect and the
      * canvas bounds. New pixels are always allocated on success. Bitmap is
      * unmodified on failure.
      */
     bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap);
 
+#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG
     /**
+     *  DEPRECATED
      *  Similar to draw sprite, this method will copy the pixels in bitmap onto
      *  the canvas, with the top/left corner specified by (x, y). The canvas'
      *  pixel values are completely replaced: there is no blending.
      *
      *  Currently if bitmap is backed by a texture this is a no-op. This may be
      *  relaxed in the future.
      *
      *  If the bitmap has config kARGB_8888_Config then the config8888 param
      *  will determines how the pixel valuess are intepreted. If the bitmap is
      *  not kARGB_8888_Config then this parameter is ignored.
      *
      *  Note: If you are recording drawing commands on this canvas to
      *  SkPicture, writePixels() is ignored!
      */
-    void writePixels(const SkBitmap& bitmap,
-                     int x, int y,
-                     Config8888 config8888 = kNative_Premul_Config8888);
+    void writePixels(const SkBitmap& bitmap, int x, int y, Config8888 config8888);
+#endif
+
+    /**
+     *  This method affects the pixels in the base-layer, and operates in pixel coordinates,
+     *  ignoring the matrix and clip.
+     *
+     *  The specified ImageInfo and (x,y) offset specifies a rectangle: target.
+     *
+     *      target.setXYWH(x, y, info.width(), info.height());
+     *
+     *  Target is intersected with the bounds of the base-layer. If this intersection is not empty,
+     *  then we have two sets of pixels (of equal size), the "src" specified by info+pixels+rowBytes
+     *  and the "dst" by the canvas' backend. Replace the dst pixels with the corresponding src
+     *  pixels, performing any colortype/alphatype transformations needed (in the case where the
+     *  src and dst have different colortypes or alphatypes).
+     *
+     *  This call can fail, returning false, for several reasons:
+     *  - If the src colortype/alphatype cannot be converted to the canvas' types
+     *  - If this canvas is not backed by pixels (e.g. picture or PDF)
+     */
+    bool writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, int x, int y);
+
+    /**
+     *  Helper for calling writePixels(info, ...) by passing its pixels and rowbytes. If the bitmap
+     *  is just wrapping a texture, returns false and does nothing.
+     */
+    bool writePixels(const SkBitmap& bitmap, int x, int y);
 
     ///////////////////////////////////////////////////////////////////////////
 
     enum SaveFlags {
         /** save the matrix state, restoring it on restore() */
         kMatrix_SaveFlag            = 0x01,
         /** save the clip state, restoring it on restore() */
         kClip_SaveFlag              = 0x02,
         /** the layer needs to support per-pixel alpha */
         kHasAlphaLayer_SaveFlag     = 0x04,
         /** the layer needs to support 8-bits per color component */
         kFullColorLayer_SaveFlag    = 0x08,
-        /** the layer should clip against the bounds argument */
+        /**
+         *  the layer should clip against the bounds argument
+         *
+         *  if SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG is undefined, this is treated as always on.
+         */
         kClipToLayer_SaveFlag       = 0x10,
 
         // helper masks for common choices
         kMatrixClip_SaveFlag        = 0x03,
+#ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
         kARGB_NoClipLayer_SaveFlag  = 0x0F,
+#endif
         kARGB_ClipLayer_SaveFlag    = 0x1F
     };
 
     /** This call saves the current matrix, clip, and drawFilter, and pushes a
         copy onto a private stack. Subsequent calls to translate, scale,
         rotate, skew, concat or clipRect, clipPath, and setDrawFilter all
         operate on this copy.
         When the balancing call to restore() is made, the previous matrix, clip,
@@ -256,33 +394,33 @@ public:
         @param flags The flags govern what portion of the Matrix/Clip/drawFilter
                      state the save (and matching restore) effect. For example,
                      if only kMatrix is specified, then only the matrix state
                      will be pushed and popped. Likewise for the clip if kClip
                      is specified.  However, the drawFilter is always affected
                      by calls to save/restore.
         @return The value to pass to restoreToCount() to balance this save()
     */
-    virtual int save(SaveFlags flags = kMatrixClip_SaveFlag);
+    int save(SaveFlags flags = kMatrixClip_SaveFlag);
 
     /** This behaves the same as save(), but in addition it allocates an
         offscreen bitmap. All drawing calls are directed there, and only when
         the balancing call to restore() is made is that offscreen transfered to
         the canvas (or the previous layer).
         @param bounds (may be null) This rect, if non-null, is used as a hint to
                       limit the size of the offscreen, and thus drawing may be
                       clipped to it, though that clipping is not guaranteed to
                       happen. If exact clipping is desired, use clipRect().
         @param paint (may be null) This is copied, and is applied to the
                      offscreen when restore() is called
         @param flags  LayerFlags
         @return The value to pass to restoreToCount() to balance this save()
     */
-    virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
-                          SaveFlags flags = kARGB_ClipLayer_SaveFlag);
+    int saveLayer(const SkRect* bounds, const SkPaint* paint,
+                  SaveFlags flags = kARGB_ClipLayer_SaveFlag);
 
     /** This behaves the same as save(), but in addition it allocates an
         offscreen bitmap. All drawing calls are directed there, and only when
         the balancing call to restore() is made is that offscreen transfered to
         the canvas (or the previous layer).
         @param bounds (may be null) This rect, if non-null, is used as a hint to
                       limit the size of the offscreen, and thus drawing may be
                       clipped to it, though that clipping is not guaranteed to
@@ -294,109 +432,108 @@ public:
     int saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
                        SaveFlags flags = kARGB_ClipLayer_SaveFlag);
 
     /** This call balances a previous call to save(), and is used to remove all
         modifications to the matrix/clip/drawFilter state since the last save
         call.
         It is an error to call restore() more times than save() was called.
     */
-    virtual void restore();
+    void restore();
 
     /** Returns the number of matrix/clip states on the SkCanvas' private stack.
-        This will equal # save() calls - # restore() calls.
+        This will equal # save() calls - # restore() calls + 1. The save count on
+        a new canvas is 1.
     */
     int getSaveCount() const;
 
     /** Efficient way to pop any calls to save() that happened after the save
-        count reached saveCount. It is an error for saveCount to be less than
-        getSaveCount()
+        count reached saveCount. It is an error for saveCount to be greater than
+        getSaveCount(). To pop all the way back to the initial matrix/clip context
+        pass saveCount == 1.
         @param saveCount    The number of save() levels to restore from
     */
     void restoreToCount(int saveCount);
 
     /** Returns true if drawing is currently going to a layer (from saveLayer)
      *  rather than to the root device.
      */
     virtual bool isDrawingToLayer() const;
 
     /** Preconcat the current matrix with the specified translation
         @param dx   The distance to translate in X
         @param dy   The distance to translate in Y
         returns true if the operation succeeded (e.g. did not overflow)
     */
-    virtual bool translate(SkScalar dx, SkScalar dy);
+    bool translate(SkScalar dx, SkScalar dy);
 
     /** Preconcat the current matrix with the specified scale.
         @param sx   The amount to scale in X
         @param sy   The amount to scale in Y
         returns true if the operation succeeded (e.g. did not overflow)
     */
-    virtual bool scale(SkScalar sx, SkScalar sy);
+    bool scale(SkScalar sx, SkScalar sy);
 
     /** Preconcat the current matrix with the specified rotation.
         @param degrees  The amount to rotate, in degrees
         returns true if the operation succeeded (e.g. did not overflow)
     */
-    virtual bool rotate(SkScalar degrees);
+    bool rotate(SkScalar degrees);
 
     /** Preconcat the current matrix with the specified skew.
         @param sx   The amount to skew in X
         @param sy   The amount to skew in Y
         returns true if the operation succeeded (e.g. did not overflow)
     */
-    virtual bool skew(SkScalar sx, SkScalar sy);
+    bool skew(SkScalar sx, SkScalar sy);
 
     /** Preconcat the current matrix with the specified matrix.
         @param matrix   The matrix to preconcatenate with the current matrix
         @return true if the operation succeeded (e.g. did not overflow)
     */
-    virtual bool concat(const SkMatrix& matrix);
+    bool concat(const SkMatrix& matrix);
 
     /** Replace the current matrix with a copy of the specified matrix.
         @param matrix The matrix that will be copied into the current matrix.
     */
-    virtual void setMatrix(const SkMatrix& matrix);
+    void setMatrix(const SkMatrix& matrix);
 
     /** Helper for setMatrix(identity). Sets the current matrix to identity.
     */
     void resetMatrix();
 
     /**
      *  Modify the current clip with the specified rectangle.
      *  @param rect The rect to combine with the current clip
      *  @param op The region op to apply to the current clip
      *  @param doAntiAlias true if the clip should be antialiased
-     *  @return true if the canvas' clip is non-empty
      */
-    virtual bool clipRect(const SkRect& rect,
-                          SkRegion::Op op = SkRegion::kIntersect_Op,
-                          bool doAntiAlias = false);
+    void clipRect(const SkRect& rect,
+                  SkRegion::Op op = SkRegion::kIntersect_Op,
+                  bool doAntiAlias = false);
 
     /**
      *  Modify the current clip with the specified SkRRect.
      *  @param rrect The rrect to combine with the current clip
      *  @param op The region op to apply to the current clip
      *  @param doAntiAlias true if the clip should be antialiased
-     *  @return true if the canvas' clip is non-empty
      */
-    virtual bool clipRRect(const SkRRect& rrect,
-                           SkRegion::Op op = SkRegion::kIntersect_Op,
-                           bool doAntiAlias = false);
+    void clipRRect(const SkRRect& rrect,
+                   SkRegion::Op op = SkRegion::kIntersect_Op,
+                   bool doAntiAlias = false);
 
     /**
      *  Modify the current clip with the specified path.
      *  @param path The path to combine with the current clip
      *  @param op The region op to apply to the current clip
      *  @param doAntiAlias true if the clip should be antialiased
-     *  @return true if the canvas' new clip is non-empty
      */
-    virtual bool clipPath(const SkPath& path,
-                          SkRegion::Op op = SkRegion::kIntersect_Op,
-                          bool doAntiAlias = false);
+    void clipPath(const SkPath& path,
+                  SkRegion::Op op = SkRegion::kIntersect_Op,
+                  bool doAntiAlias = false);
 
     /** EXPERIMENTAL -- only used for testing
         Set to false to force clips to be hard, even if doAntiAlias=true is
         passed to clipRect or clipPath.
      */
     void setAllowSoftClip(bool allow) {
         fAllowSoftClip = allow;
     }
@@ -409,29 +546,27 @@ public:
     }
 
     /** Modify the current clip with the specified region. Note that unlike
         clipRect() and clipPath() which transform their arguments by the current
         matrix, clipRegion() assumes its argument is already in device
         coordinates, and so no transformation is performed.
         @param deviceRgn    The region to apply to the current clip
         @param op The region op to apply to the current clip
-        @return true if the canvas' new clip is non-empty
     */
-    virtual bool clipRegion(const SkRegion& deviceRgn,
-                            SkRegion::Op op = SkRegion::kIntersect_Op);
+    void clipRegion(const SkRegion& deviceRgn,
+                    SkRegion::Op op = SkRegion::kIntersect_Op);
 
     /** Helper for clipRegion(rgn, kReplace_Op). Sets the current clip to the
         specified region. This does not intersect or in any other way account
         for the existing clip region.
         @param deviceRgn The region to copy into the current clip.
-        @return true if the new clip region is non-empty
     */
-    bool setClipRegion(const SkRegion& deviceRgn) {
-        return this->clipRegion(deviceRgn, SkRegion::kReplace_Op);
+    void setClipRegion(const SkRegion& deviceRgn) {
+        this->clipRegion(deviceRgn, SkRegion::kReplace_Op);
     }
 
     /** Return true if the specified rectangle, after being transformed by the
         current matrix, would lie completely outside of the current clip. Call
         this to check if an area you intend to draw into is clipped out (and
         therefore you can skip making the draw calls).
         @param rect the rect to compare with the current clip
         @return true if the rect (transformed by the canvas' matrix) does not
@@ -458,36 +593,50 @@ public:
         returns true, then the band is guaranteed to be clipped out.
         @param top  The top of the horizontal band to compare with the clip
         @param bottom The bottom of the horizontal and to compare with the clip
         @return true if the horizontal band is completely clipped out (i.e. does
                      not intersect the current clip)
     */
     bool quickRejectY(SkScalar top, SkScalar bottom) const {
         SkASSERT(top <= bottom);
+
+#ifndef SK_WILL_NEVER_DRAW_PERSPECTIVE_TEXT
+        // TODO: add a hasPerspective method similar to getLocalClipBounds. This
+        // would cache the SkMatrix::hasPerspective result. Alternatively, have
+        // the MC stack just set a hasPerspective boolean as it is updated.
+        if (this->getTotalMatrix().hasPerspective()) {
+            // TODO: consider implementing some half-plane test between the
+            // two Y planes and the device-bounds (i.e., project the top and
+            // bottom Y planes and then determine if the clip bounds is completely
+            // outside either one).
+            return false;
+        }
+#endif
+
         const SkRect& clipR = this->getLocalClipBounds();
         // In the case where the clip is empty and we are provided with a
         // negative top and positive bottom parameter then this test will return
         // false even though it will be clipped. We have chosen to exclude that
         // check as it is rare and would result double the comparisons.
         return top >= clipR.fBottom || bottom <= clipR.fTop;
     }
 
     /** Return the bounds of the current clip (in local coordinates) in the
         bounds parameter, and return true if it is non-empty. This can be useful
         in a way similar to quickReject, in that it tells you that drawing
         outside of these bounds will be clipped out.
     */
-    bool getClipBounds(SkRect* bounds) const;
+    virtual bool getClipBounds(SkRect* bounds) const;
 
     /** Return the bounds of the current clip, in device coordinates; returns
         true if non-empty. Maybe faster than getting the clip explicitly and
         then taking its bounds.
     */
-    bool getClipDeviceBounds(SkIRect* bounds) const;
+    virtual bool getClipDeviceBounds(SkIRect* bounds) const;
 
 
     /** Fill the entire canvas' bitmap (restricted to the current clip) with the
         specified ARGB color, using the specified mode.
         @param a    the alpha component (0..255) of the color to fill the canvas
         @param r    the red component (0..255) of the color to fill the canvas
         @param g    the green component (0..255) of the color to fill the canvas
         @param b    the blue component (0..255) of the color to fill the canvas
@@ -591,18 +740,17 @@ public:
     */
     virtual void drawRect(const SkRect& rect, const SkPaint& paint);
 
     /** Draw the specified rectangle using the specified paint. The rectangle
         will be filled or framed based on the Style in the paint.
         @param rect     The rect to be drawn
         @param paint    The paint used to draw the rect
     */
-    void drawIRect(const SkIRect& rect, const SkPaint& paint)
-    {
+    void drawIRect(const SkIRect& rect, const SkPaint& paint) {
         SkRect r;
         r.set(rect);    // promotes the ints to scalars
         this->drawRect(r, paint);
     }
 
     /** Draw the specified rectangle using the specified paint. The rectangle
         will be filled or framed based on the Style in the paint.
         @param left     The left side of the rectangle to be drawn
@@ -625,16 +773,22 @@ public:
      *  Draw the specified RRect using the specified paint The rrect will be filled or stroked
      *  based on the Style in the paint.
      *
      *  @param rrect    The round-rect to draw
      *  @param paint    The paint used to draw the round-rect
      */
     virtual void drawRRect(const SkRRect& rrect, const SkPaint& paint);
 
+    /**
+     *  Draw the annulus formed by the outer and inner rrects. The results
+     *  are undefined if the outer does not contain the inner.
+     */
+    void drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint&);
+
     /** Draw the specified circle using the specified paint. If radius is <= 0,
         then nothing will be drawn. The circle will be filled
         or framed based on the Style in the paint.
         @param cx       The x-coordinate of the center of the cirle to be drawn
         @param cy       The y-coordinate of the center of the cirle to be drawn
         @param radius   The radius of the cirle to be drawn
         @param paint    The paint used to draw the circle
     */
@@ -824,16 +978,24 @@ public:
         @param matrix       (may be null) Applied to the text before it is
                             mapped onto the path
         @param paint        The paint used for the text
         */
     virtual void drawTextOnPath(const void* text, size_t byteLength,
                                 const SkPath& path, const SkMatrix* matrix,
                                 const SkPaint& paint);
 
+    /** PRIVATE / EXPERIMENTAL -- do not call
+        Perform back-end analysis/optimization of a picture. This may attach
+        optimization data to the picture which can be used by a later
+        drawPicture call.
+        @param picture The recorded drawing commands to analyze/optimize
+    */
+    void EXPERIMENTAL_optimize(SkPicture* picture);
+
     /** Draw the picture into this canvas. This method effective brackets the
         playback of the picture's draw calls with save/restore, so the state
         of this canvas will be unchanged after this call.
         @param picture The recorded drawing commands to playback into this
                        canvas.
     */
     virtual void drawPicture(SkPicture& picture);
 
@@ -886,17 +1048,36 @@ public:
     }
     virtual void addComment(const char* kywd, const char* value) {
         // do nothing. Subclasses may do something
     }
     virtual void endCommentGroup() {
         // do nothing. Subclasses may do something
     }
 
+    /**
+     *  With this call the client asserts that subsequent draw operations (up to the
+     *  matching popCull()) are fully contained within the given bounding box. The assertion
+     *  is not enforced, but the information might be used to quick-reject command blocks,
+     *  so an incorrect bounding box may result in incomplete rendering.
+     */
+    void pushCull(const SkRect& cullRect) {
+        ++fCullCount;
+        this->onPushCull(cullRect);
+    }
 
+    /**
+     *  Terminates the current culling block, and restores the previous one (if any).
+     */
+    void popCull() {
+        if (fCullCount > 0) {
+            --fCullCount;
+            this->onPopCull();
+        }
+    }
     //////////////////////////////////////////////////////////////////////////
 
     /** Get the current bounder object.
         The bounder's reference count is unchaged.
         @return the canva's bounder (or NULL).
     */
     SkBounder*  getBounder() const { return fBounder; }
 
@@ -923,53 +1104,72 @@ public:
         matrix and clip.
         @param filter the new filter (or NULL)
         @return the new filter
     */
     virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter);
 
     //////////////////////////////////////////////////////////////////////////
 
+    /**
+     *  Return true if the current clip is empty (i.e. nothing will draw).
+     *  Note: this is not always a free call, so it should not be used
+     *  more often than necessary. However, once the canvas has computed this
+     *  result, subsequent calls will be cheap (until the clip state changes,
+     *  which can happen on any clip..() or restore() call.
+     */
+    virtual bool isClipEmpty() const;
+
+    /**
+     *  Returns true if the current clip is just a (non-empty) rectangle.
+     *  Returns false if the clip is empty, or if it is complex.
+     */
+    virtual bool isClipRect() const;
+
     /** Return the current matrix on the canvas.
         This does not account for the translate in any of the devices.
         @return The current matrix on the canvas.
     */
     const SkMatrix& getTotalMatrix() const;
 
+#ifdef SK_SUPPORT_LEGACY_GETCLIPTYPE
     enum ClipType {
         kEmpty_ClipType = 0,
         kRect_ClipType,
         kComplex_ClipType
     };
-
     /** Returns a description of the total clip; may be cheaper than
         getting the clip and querying it directly.
     */
-    ClipType getClipType() const;
+    virtual ClipType getClipType() const;
+#endif
 
+#ifdef SK_SUPPORT_LEGACY_GETTOTALCLIP
     /** DEPRECATED -- need to move this guy to private/friend
      *  Return the current device clip (concatenation of all clip calls).
      *  This does not account for the translate in any of the devices.
      *  @return the current device clip (concatenation of all clip calls).
      */
     const SkRegion& getTotalClip() const;
+#endif
 
     /** Return the clip stack. The clip stack stores all the individual
      *  clips organized by the save/restore frame in which they were
      *  added.
      *  @return the current clip stack ("list" of individual clip elements)
      */
     const SkClipStack* getClipStack() const {
         return &fClipStack;
     }
 
     class ClipVisitor {
     public:
         virtual ~ClipVisitor();
         virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0;
+        virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0;
         virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0;
     };
 
     /**
      *  Replays the clip operations, back to front, that have been applied to
      *  the canvas, calling the appropriate method on the visitor for each
      *  clip. All clips have already been transformed into device space.
      */
@@ -1010,99 +1210,150 @@ public:
         // (though needs to be a compile-time-assert!). We use intptr_t to work
         // 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;
     };
 
+    // don't call
+    const SkRegion& internal_private_getTotalClip() const;
+    // don't call
+    void internal_private_getTotalClipAsPath(SkPath*) const;
+    // don't call
+    GrRenderTarget* internal_private_accessTopLayerRenderTarget();
+
 protected:
     // default impl defers to getDevice()->newSurface(info)
     virtual SkSurface* onNewSurface(const SkImageInfo&);
 
+    // default impl defers to its device
+    virtual const void* onPeekPixels(SkImageInfo*, size_t* rowBytes);
+    virtual void* onAccessTopLayerPixels(SkImageInfo*, size_t* rowBytes);
+
+    // Subclass save/restore notifiers.
+    // Overriders should call the corresponding INHERITED method up the inheritance chain.
+    // willSaveLayer()'s return value may suppress full layer allocation.
+    enum SaveLayerStrategy {
+        kFullLayer_SaveLayerStrategy,
+        kNoLayer_SaveLayerStrategy
+    };
+    virtual void willSave(SaveFlags);
+    virtual SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SaveFlags);
+    virtual void willRestore();
+
+    virtual void didTranslate(SkScalar, SkScalar);
+    virtual void didScale(SkScalar, SkScalar);
+    virtual void didRotate(SkScalar);
+    virtual void didSkew(SkScalar, SkScalar);
+    virtual void didConcat(const SkMatrix&);
+    virtual void didSetMatrix(const SkMatrix&);
+
+    virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&);
+
+    enum ClipEdgeStyle {
+        kHard_ClipEdgeStyle,
+        kSoft_ClipEdgeStyle
+    };
+
+    virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle);
+    virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle);
+    virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle);
+    virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op);
+
     // Returns the canvas to be used by DrawIter. Default implementation
     // returns this. Subclasses that encapsulate an indirect canvas may
     // need to overload this method. The impl must keep track of this, as it
     // is not released or deleted by the caller.
     virtual SkCanvas* canvasForDrawIter();
 
     // 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, SaveFlags flags,
                         SkIRect* intersection,
                         const SkImageFilter* imageFilter = NULL);
 
     // Called by child classes that override clipPath and clipRRect to only
     // track fast conservative clip bounds, rather than exact clips.
-    bool updateClipConservativelyUsingBounds(const SkRect&, SkRegion::Op,
+    void updateClipConservativelyUsingBounds(const SkRect&, SkRegion::Op,
                                              bool inverseFilled);
 
     // notify our surface (if we have one) that we are about to draw, so it
     // can perform copy-on-write or invalidate any cached images
     void predrawNotify();
 
-    /**
-     DEPRECATED -- need to remove when subclass stop relying on it.
-     Marked as 'protected' to avoid new clients using this before we can
-     completely remove it.
-
-     Specify a device for this canvas to draw into. If it is not null, its
-     reference count is incremented. If the canvas was already holding a
-     device, its reference count is decremented. The new device is returned.
-     */
-    virtual SkBaseDevice* setDevice(SkBaseDevice* device);
+    virtual void onPushCull(const SkRect& cullRect);
+    virtual void onPopCull();
 
 private:
     class MCRec;
 
     SkClipStack fClipStack;
     SkDeque     fMCStack;
     // points to top of stack
     MCRec*      fMCRec;
     // the first N recs that can fit here mean we won't call malloc
     uint32_t    fMCRecStorage[32];
 
     SkBounder*  fBounder;
     int         fSaveLayerCount;    // number of successful saveLayer calls
+    int         fCullCount;         // number of active culls
 
     SkMetaData* fMetaData;
 
     SkSurface_Base*  fSurfaceBase;
     SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; }
     void setSurfaceBase(SkSurface_Base* sb) {
         fSurfaceBase = sb;
     }
     friend class SkSurface_Base;
     friend class SkSurface_Gpu;
 
     bool fDeviceCMDirty;            // cleared by updateDeviceCMCache()
     void updateDeviceCMCache();
 
-    friend class SkDrawIter;    // needs setupDrawForLayerDevice()
+    friend class SkDrawIter;        // needs setupDrawForLayerDevice()
     friend class AutoDrawLooper;
+    friend class SkLua;             // needs top layer size and offset
+    friend class SkDeferredDevice;  // needs getTopDevice()
 
-    SkBaseDevice* createLayerDevice(SkBitmap::Config, int width, int height,
-                                    bool isOpaque);
+    SkBaseDevice* createLayerDevice(const SkImageInfo&);
 
     SkBaseDevice* init(SkBaseDevice*);
 
+    /**
+     *  DEPRECATED
+     *
+     *  Specify a device for this canvas to draw into. If it is not null, its
+     *  reference count is incremented. If the canvas was already holding a
+     *  device, its reference count is decremented. The new device is returned.
+     */
+    SkBaseDevice* setRootDevice(SkBaseDevice* device);
+
+    /**
+     * Gets the size/origin 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.
+     */
+    SkISize getTopLayerSize() const;
+    SkIPoint getTopLayerOrigin() const;
+
     // internal methods are not virtual, so they can safely be called by other
     // canvas apis, without confusing subclasses (like SkPictureRecording)
     void internalDrawBitmap(const SkBitmap&, const SkMatrix& m, const SkPaint* paint);
     void internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
                                 const SkRect& dst, const SkPaint* paint,
                                 DrawBitmapRectFlags flags);
     void internalDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
                                 const SkRect& dst, const SkPaint* paint);
     void internalDrawPaint(const SkPaint& paint);
     int internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
-                          SaveFlags, bool justForImageFilter);
+                          SaveFlags, bool justForImageFilter, SaveLayerStrategy strategy);
     void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*);
 
     // shared by save() and saveLayer()
     int internalSave(SaveFlags flags);
     void internalRestore();
     static void DrawRect(const SkDraw& draw, const SkPaint& paint,
                          const SkRect& r, SkScalar textSize);
     static void DrawTextDecorations(const SkDraw& draw, const SkPaint& paint,
@@ -1201,9 +1452,52 @@ public:
         }
     }
 
 private:
     SkCanvas* fCanvas;
 };
 #define SkAutoCommentBlock(...) SK_REQUIRE_LOCAL_VAR(SkAutoCommentBlock)
 
+/**
+ *  If the caller wants read-only access to the pixels in a canvas, it can just
+ *  call canvas->peekPixels(), since that is the fastest way to "peek" at the
+ *  pixels on a raster-backed canvas.
+ *
+ *  If the canvas has pixels, but they are not readily available to the CPU
+ *  (e.g. gpu-backed), then peekPixels() will fail, but readPixels() will
+ *  succeed (though be slower, since it will return a copy of the pixels).
+ *
+ *  SkAutoROCanvasPixels encapsulates these two techniques, trying first to call
+ *  peekPixels() (for performance), but if that fails, calling readPixels() and
+ *  storing the copy locally.
+ *
+ *  The caller must respect the restrictions associated with peekPixels(), since
+ *  that may have been called: The returned information is invalidated if...
+ *      - any API is called on the canvas (or its parent surface if present)
+ *      - the canvas goes out of scope
+ */
+class SkAutoROCanvasPixels : SkNoncopyable {
+public:
+    SkAutoROCanvasPixels(SkCanvas* canvas);
+
+    // returns NULL on failure
+    const void* addr() const { return fAddr; }
+
+    // undefined if addr() == NULL
+    size_t rowBytes() const { return fRowBytes; }
+
+    // undefined if addr() == NULL
+    const SkImageInfo& info() const { return fInfo; }
+
+    // helper that, if returns true, installs the pixels into the bitmap. Note
+    // that the bitmap may reference the address returned by peekPixels(), so
+    // the caller must respect the restrictions associated with peekPixels().
+    bool asROBitmap(SkBitmap*) const;
+
+private:
+    SkBitmap    fBitmap;    // used if peekPixels() fails
+    const void* fAddr;      // NULL on failure
+    SkImageInfo fInfo;
+    size_t      fRowBytes;
+};
+
 #endif
--- a/gfx/skia/trunk/include/core/SkClipStack.h
+++ b/gfx/skia/trunk/include/core/SkClipStack.h
@@ -6,18 +6,20 @@
  * found in the LICENSE file.
  */
 #ifndef SkClipStack_DEFINED
 #define SkClipStack_DEFINED
 
 #include "SkDeque.h"
 #include "SkPath.h"
 #include "SkRect.h"
+#include "SkRRect.h"
 #include "SkRegion.h"
 #include "SkTDArray.h"
+#include "SkTLazy.h"
 
 
 // Because a single save/restore state can have multiple clips, this class
 // stores the stack depth (fSaveCount) and clips (fDeque) separately.
 // Each clip in fDeque stores the stack state to which it belongs
 // (i.e., the fSaveCount in force when it was added). Restores are thus
 // implemented by removing clips from fDeque that have an fSaveCount larger
 // then the freshly decremented count.
@@ -36,69 +38,65 @@ public:
 
     class Element {
     public:
         enum Type {
             //!< This element makes the clip empty (regardless of previous elements).
             kEmpty_Type,
             //!< This element combines a rect with the current clip using a set operation
             kRect_Type,
+            //!< This element combines a round-rect with the current clip using a set operation
+            kRRect_Type,
             //!< This element combines a path with the current clip using a set operation
             kPath_Type,
         };
 
         Element() {
             this->initCommon(0, SkRegion::kReplace_Op, false);
             this->setEmpty();
         }
 
+        Element(const Element&);
+
         Element(const SkRect& rect, SkRegion::Op op, bool doAA) {
             this->initRect(0, rect, op, doAA);
         }
 
+        Element(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+            this->initRRect(0, rrect, op, doAA);
+        }
+
         Element(const SkPath& path, SkRegion::Op op, bool doAA) {
             this->initPath(0, path, op, doAA);
         }
 
-        bool operator== (const Element& element) const {
-            if (this == &element) {
-                return true;
-            }
-            if (fOp != element.fOp ||
-                fType != element.fType ||
-                fDoAA != element.fDoAA ||
-                fSaveCount != element.fSaveCount) {
-                return false;
-            }
-            switch (fType) {
-                case kPath_Type:
-                    return fPath == element.fPath;
-                case kRect_Type:
-                    return fRect == element.fRect;
-                case kEmpty_Type:
-                    return true;
-                default:
-                    SkDEBUGFAIL("Unexpected type.");
-                    return false;
-            }
-        }
+        bool operator== (const Element& element) const;
         bool operator!= (const Element& element) const { return !(*this == element); }
 
         //!< Call to get the type of the clip element.
         Type getType() const { return fType; }
 
         //!< Call if getType() is kPath to get the path.
-        const SkPath& getPath() const { return fPath; }
+        const SkPath& getPath() const { SkASSERT(kPath_Type == fType); return *fPath.get(); }
+
+        //!< Call if getType() is kRRect to get the round-rect.
+        const SkRRect& getRRect() const { SkASSERT(kRRect_Type == fType); return fRRect; }
 
         //!< Call if getType() is kRect to get the rect.
-        const SkRect& getRect() const { return fRect; }
+        const SkRect& getRect() const {
+            SkASSERT(kRect_Type == fType && (fRRect.isRect() || fRRect.isEmpty()));
+            return fRRect.getBounds();
+        }
 
         //!< Call if getType() is not kEmpty to get the set operation used to combine this element.
         SkRegion::Op getOp() const { return fOp; }
 
+        //!< Call to get the element as a path, regardless of its type.
+        void asPath(SkPath* path) const;
+
         /** If getType() is not kEmpty this indicates whether the clip shape should be anti-aliased
             when it is rasterized. */
         bool isAA() const { return fDoAA; }
 
         //!< Inverts the fill of the clip shape. Note that a kEmpty element remains kEmpty.
         void invertShapeFillType();
 
         //!< Sets the set operation represented by the element.
@@ -113,58 +111,61 @@ public:
 
         /**
          * Gets the bounds of the clip element, either the rect or path bounds. (Whether the shape
          * is inverse filled is not considered.)
          */
         const SkRect& getBounds() const {
             static const SkRect kEmpty = { 0, 0, 0, 0 };
             switch (fType) {
-                case kRect_Type:
-                    return fRect;
+                case kRect_Type:  // fallthrough
+                case kRRect_Type:
+                    return fRRect.getBounds();
                 case kPath_Type:
-                    return fPath.getBounds();
+                    return fPath.get()->getBounds();
                 case kEmpty_Type:
                     return kEmpty;
                 default:
                     SkDEBUGFAIL("Unexpected type.");
                     return kEmpty;
             }
         }
 
         /**
          * Conservatively checks whether the clip shape contains the rect param. (Whether the shape
          * is inverse filled is not considered.)
          */
         bool contains(const SkRect& rect) const {
             switch (fType) {
                 case kRect_Type:
-                    return fRect.contains(rect);
+                    return this->getRect().contains(rect);
+                case kRRect_Type:
+                    return fRRect.contains(rect);
                 case kPath_Type:
-                    return fPath.conservativelyContainsRect(rect);
+                    return fPath.get()->conservativelyContainsRect(rect);
                 case kEmpty_Type:
                     return false;
                 default:
                     SkDEBUGFAIL("Unexpected type.");
                     return false;
             }
         }
 
         /**
          * Is the clip shape inverse filled.
          */
         bool isInverseFilled() const {
-            return kPath_Type == fType && fPath.isInverseFillType();
+            return kPath_Type == fType && fPath.get()->isInverseFillType();
         }
 
     private:
         friend class SkClipStack;
 
-        SkPath          fPath;
-        SkRect          fRect;
+        SkTLazy<SkPath> fPath;
+        SkRRect         fRRect;
         int             fSaveCount; // save count of stack when this element was added.
         SkRegion::Op    fOp;
         Type            fType;
         bool            fDoAA;
 
         /* fFiniteBoundType and fFiniteBound are used to incrementally update the clip stack's
            bound. When fFiniteBoundType is kNormal_BoundsType, fFiniteBound represents the
            conservative bounding box of the pixels that aren't clipped (i.e., any pixels that can be
@@ -184,16 +185,20 @@ public:
 
         int                     fGenID;
 
         Element(int saveCount) {
             this->initCommon(saveCount, SkRegion::kReplace_Op, false);
             this->setEmpty();
         }
 
+        Element(int saveCount, const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+            this->initRRect(saveCount, rrect, op, doAA);
+        }
+
         Element(int saveCount, const SkRect& rect, SkRegion::Op op, bool doAA) {
             this->initRect(saveCount, rect, op, doAA);
         }
 
         Element(int saveCount, const SkPath& path, SkRegion::Op op, bool doAA) {
             this->initPath(saveCount, path, op, doAA);
         }
 
@@ -205,36 +210,35 @@ public:
             // indicates that nothing is known to be outside the clip.
             fFiniteBoundType = kInsideOut_BoundsType;
             fFiniteBound.setEmpty();
             fIsIntersectionOfRects = false;
             fGenID = kInvalidGenID;
         }
 
         void initRect(int saveCount, const SkRect& rect, SkRegion::Op op, bool doAA) {
-            fRect = rect;
+            fRRect.setRect(rect);
             fType = kRect_Type;
             this->initCommon(saveCount, op, doAA);
         }
 
-        void initPath(int saveCount, const SkPath& path, SkRegion::Op op, bool doAA) {
-            fPath = path;
-            fType = kPath_Type;
+        void initRRect(int saveCount, const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+            SkRRect::Type type = rrect.getType();
+            fRRect = rrect;
+            if (SkRRect::kRect_Type == type || SkRRect::kEmpty_Type == type) {
+                fType = kRect_Type;
+            } else {
+                fType = kRRect_Type;
+            }
             this->initCommon(saveCount, op, doAA);
         }
 
-        void setEmpty() {
-            fType = kEmpty_Type;
-            fFiniteBound.setEmpty();
-            fFiniteBoundType = kNormal_BoundsType;
-            fIsIntersectionOfRects = false;
-            fRect.setEmpty();
-            fPath.reset();
-            fGenID = kEmptyGenID;
-        }
+        void initPath(int saveCount, const SkPath& path, SkRegion::Op op, bool doAA);
+
+        void setEmpty();
 
         // All Element methods below are only used within SkClipStack.cpp
         inline void checkEmpty() const;
         inline bool canBeIntersectedInPlace(int saveCount, SkRegion::Op op) const;
         /* This method checks to see if two rect clips can be safely merged into one. The issue here
           is that to be strictly correct all the edges of the resulting rect must have the same
           anti-aliasing. */
         bool rectRectIntersectAllowed(const SkRect& newR, bool newAA) const;
@@ -300,16 +304,17 @@ public:
     bool quickContains(const SkRect& devRect) const;
 
     void clipDevRect(const SkIRect& ir, SkRegion::Op op) {
         SkRect r;
         r.set(ir);
         this->clipDevRect(r, op, false);
     }
     void clipDevRect(const SkRect&, SkRegion::Op, bool doAA);
+    void clipDevRRect(const SkRRect&, SkRegion::Op, bool doAA);
     void clipDevPath(const SkPath&, SkRegion::Op, bool doAA);
     // An optimized version of clipDevRect(emptyRect, kIntersect, ...)
     void clipEmpty();
 
     /**
      * isWideOpen returns true if the clip state corresponds to the infinite
      * plane (i.e., draws are not limited at all)
      */
@@ -423,16 +428,21 @@ private:
     int     fSaveCount;
 
     // Generation ID for the clip stack. This is incremented for each
     // clipDevRect and clipDevPath call. 0 is reserved to indicate an
     // invalid ID.
     static int32_t     gGenID;
 
     /**
+     * Helper for clipDevPath, etc.
+     */
+    void pushElement(const Element& element);
+
+    /**
      * Restore the stack back to the specified save count.
      */
     void restoreTo(int saveCount);
 
     /**
      * Return the next unique generation ID.
      */
     static int32_t GetNextGenID();
--- a/gfx/skia/trunk/include/core/SkColorFilter.h
+++ b/gfx/skia/trunk/include/core/SkColorFilter.h
@@ -123,17 +123,17 @@ public:
     */
     static SkColorFilter* CreateLightingFilter(SkColor mul, SkColor add);
 
     /** A subclass may implement this factory function to work with the GPU backend. If the return
         is non-NULL then the caller owns a ref on the returned object.
      */
     virtual GrEffectRef* asNewEffect(GrContext*) const;
 
-    SkDEVCODE(virtual void toString(SkString* str) const = 0;)
+    SK_TO_STRING_PUREVIRT()
 
     SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
     SK_DEFINE_FLATTENABLE_TYPE(SkColorFilter)
 
 protected:
     SkColorFilter() {}
     SkColorFilter(SkReadBuffer& rb) : INHERITED(rb) {}
 
--- a/gfx/skia/trunk/include/core/SkColorShader.h
+++ b/gfx/skia/trunk/include/core/SkColorShader.h
@@ -43,17 +43,17 @@ public:
 
     // we return false for this, use asAGradient
     virtual BitmapType asABitmap(SkBitmap* outTexture,
                                  SkMatrix* outMatrix,
                                  TileMode xy[2]) const SK_OVERRIDE;
 
     virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
 
-    SK_DEVELOPER_TO_STRING()
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader)
 
 protected:
     SkColorShader(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
 private:
 
--- a/gfx/skia/trunk/include/core/SkComposeShader.h
+++ b/gfx/skia/trunk/include/core/SkComposeShader.h
@@ -34,17 +34,17 @@ public:
     SkComposeShader(SkShader* sA, SkShader* sB, SkXfermode* mode = NULL);
     virtual ~SkComposeShader();
 
     virtual bool setContext(const SkBitmap&, const SkPaint&,
                             const SkMatrix&) SK_OVERRIDE;
     virtual void endContext() SK_OVERRIDE;
     virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
 
-    SK_DEVELOPER_TO_STRING()
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader)
 
 protected:
     SkComposeShader(SkReadBuffer& );
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
 private:
 
--- a/gfx/skia/trunk/include/core/SkDevice.h
+++ b/gfx/skia/trunk/include/core/SkDevice.h
@@ -10,16 +10,24 @@
 #ifndef SkDevice_DEFINED
 #define SkDevice_DEFINED
 
 #include "SkRefCnt.h"
 #include "SkBitmap.h"
 #include "SkCanvas.h"
 #include "SkColor.h"
 #include "SkDeviceProperties.h"
+#include "SkImageFilter.h"
+
+// getDeviceCapabilities() is not called by skia, but this flag keeps it around
+// for clients that have "override" annotations on their subclass. These overrides
+// should be deleted.
+//#define SK_SUPPORT_LEGACY_GETDEVICECAPABILITIES
+
+//#define SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
 
 class SkClipStack;
 class SkDraw;
 struct SkIRect;
 class SkMatrix;
 class SkMetaData;
 class SkRegion;
 
@@ -36,52 +44,63 @@ public:
 
     /**
      *  Construct a new device.
     */
     SkBaseDevice(const SkDeviceProperties& deviceProperties);
 
     virtual ~SkBaseDevice();
 
+#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
     /**
      *  Creates a device that is of the same type as this device (e.g. SW-raster,
      *  GPU, or PDF). The backing store for this device is created automatically
      *  (e.g. offscreen pixels or FBO or whatever is appropriate).
      *
      *  @param width    width of the device to create
      *  @param height   height of the device to create
      *  @param isOpaque performance hint, set to true if you know that you will
      *                  draw into this device such that all of the pixels will
      *                  be opaque.
      */
     SkBaseDevice* createCompatibleDevice(SkBitmap::Config config,
                                          int width, int height,
                                          bool isOpaque);
+#endif
+    SkBaseDevice* createCompatibleDevice(const SkImageInfo&);
 
     SkMetaData& getMetaData();
 
+#ifdef SK_SUPPORT_LEGACY_GETDEVICECAPABILITIES
     enum Capabilities {
-        kVector_Capability = 0x1,  //!< mask indicating a vector representation
+        kVector_Capability = 0x1,
     };
-    virtual uint32_t getDeviceCapabilities() = 0;
+    virtual uint32_t getDeviceCapabilities() { return 0; }
+#endif
 
     /** Return the width of the device (in pixels).
     */
     virtual int width() const = 0;
     /** Return the height of the device (in pixels).
     */
     virtual int height() const = 0;
 
     /** Return the image properties of the device. */
     virtual const SkDeviceProperties& getDeviceProperties() const {
         //Currently, all the properties are leaky.
         return fLeakyProperties;
     }
 
     /**
+     *  Return ImageInfo for this device. If the canvas is not backed by pixels
+     *  (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType.
+     */
+    virtual SkImageInfo imageInfo() const;
+
+    /**
      *  Return the bounds of the device in the coordinate space of the root
      *  canvas. The root device will have its top-left at 0,0, but other devices
      *  such as those associated with saveLayer may have a non-zero origin.
      */
     void getGlobalBounds(SkIRect* bounds) const {
         SkASSERT(bounds);
         const SkIPoint& origin = this->getOrigin();
         bounds->setXYWH(origin.x(), origin.y(), this->width(), this->height());
@@ -90,44 +109,49 @@ public:
 
     /** Returns true if the device's bitmap's config treats every pixel as
         implicitly opaque.
     */
     virtual bool isOpaque() const = 0;
 
     /** Return the bitmap config of the device's pixels
      */
-    SK_ATTR_DEPRECATED("want to hide configness of the device -- don't use")
     virtual SkBitmap::Config config() const = 0;
 
     /** Return the bitmap associated with this device. Call this each time you need
         to access the bitmap, as it notifies the subclass to perform any flushing
         etc. before you examine the pixels.
         @param changePixels set to true if the caller plans to change the pixels
         @return the device's bitmap
     */
     const SkBitmap& accessBitmap(bool changePixels);
 
+#ifdef SK_SUPPORT_LEGACY_WRITEPIXELSCONFIG
     /**
      *  DEPRECATED: This will be made protected once WebKit stops using it.
      *              Instead use Canvas' writePixels method.
      *
      *  Similar to draw sprite, this method will copy the pixels in bitmap onto
      *  the device, with the top/left corner specified by (x, y). The pixel
      *  values in the device are completely replaced: there is no blending.
      *
      *  Currently if bitmap is backed by a texture this is a no-op. This may be
      *  relaxed in the future.
      *
      *  If the bitmap has config kARGB_8888_Config then the config8888 param
      *  will determines how the pixel valuess are intepreted. If the bitmap is
      *  not kARGB_8888_Config then this parameter is ignored.
      */
     virtual void writePixels(const SkBitmap& bitmap, int x, int y,
-                             SkCanvas::Config8888 config8888 = SkCanvas::kNative_Premul_Config8888) = 0;
+                             SkCanvas::Config8888 config8888 = SkCanvas::kNative_Premul_Config8888);
+#endif
+
+    bool writePixelsDirect(const SkImageInfo&, const void*, size_t rowBytes, int x, int y);
+
+    void* accessPixels(SkImageInfo* info, size_t* rowBytes);
 
     /**
      * Return the device's associated gpu render target, or NULL.
      */
     virtual GrRenderTarget* accessRenderTarget() = 0;
 
 
     /**
@@ -222,16 +246,20 @@ protected:
                             const SkPoint[], const SkPaint& paint) = 0;
     virtual void drawRect(const SkDraw&, const SkRect& r,
                           const SkPaint& paint) = 0;
     virtual void drawOval(const SkDraw&, const SkRect& oval,
                           const SkPaint& paint) = 0;
     virtual void drawRRect(const SkDraw&, const SkRRect& rr,
                            const SkPaint& paint) = 0;
 
+    // Default impl calls drawPath()
+    virtual void drawDRRect(const SkDraw&, const SkRRect& outer,
+                            const SkRRect& inner, const SkPaint&);
+
     /**
      *  If pathIsMutable, then the implementation is allowed to cast path to a
      *  non-const pointer and modify it in place (as an optimization). Canvas
      *  may do this to implement helpers such as drawOval, by placing a temp
      *  path on the stack to hold the representation of the oval.
      *
      *  If prePathMatrix is not null, it should logically be applied before any
      *  stroking or other effects. If there are no effects on the paint that
@@ -269,17 +297,17 @@ protected:
                                 const SkPath& path, const SkMatrix* matrix,
                                 const SkPaint& paint) = 0;
     virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCount,
                               const SkPoint verts[], const SkPoint texs[],
                               const SkColor colors[], SkXfermode* xmode,
                               const uint16_t indices[], int indexCount,
                               const SkPaint& paint) = 0;
     /** The SkDevice passed will be an SkDevice which was returned by a call to
-        onCreateCompatibleDevice on this device with kSaveLayer_Usage.
+        onCreateDevice on this device with kSaveLayer_Usage.
      */
     virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
                             const SkPaint&) = 0;
 
     /**
      *  On success (returns true), copy the device pixels into the bitmap.
      *  On failure, the bitmap parameter is left unchanged and false is
      *  returned.
@@ -313,27 +341,16 @@ protected:
     ///////////////////////////////////////////////////////////////////////////
 
     /** Update as needed the pixel value in the bitmap, so that the caller can
         access the pixels directly.
         @return The device contents as a bitmap
     */
     virtual const SkBitmap& onAccessBitmap() = 0;
 
-    /**
-     * Implements readPixels API. The caller will ensure that:
-     *  1. bitmap has pixel config kARGB_8888_Config.
-     *  2. bitmap has pixels.
-     *  3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is
-     *     contained in the device bounds.
-     */
-    virtual bool onReadPixels(const SkBitmap& bitmap,
-                              int x, int y,
-                              SkCanvas::Config8888 config8888) = 0;
-
     /** Called when this device is installed into a Canvas. Balanced by a call
         to unlockPixels() when the device is removed from a Canvas.
     */
     virtual void lockPixels() = 0;
     virtual void unlockPixels() = 0;
 
     /**
      *  Returns true if the device allows processing of this imagefilter. If
@@ -354,66 +371,118 @@ protected:
 
     /**
      *  Related (but not required) to canHandleImageFilter, this method returns
      *  true if the device could apply the filter to the src bitmap and return
      *  the result (and updates offset as needed).
      *  If the device does not recognize or support this filter,
      *  it just returns false and leaves result and offset unchanged.
      */
-    virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkMatrix&,
+    virtual bool filterImage(const SkImageFilter*, const SkBitmap&,
+                             const SkImageFilter::Context& ctx,
                              SkBitmap* result, SkIPoint* offset) = 0;
 
     // This is equal kBGRA_Premul_Config8888 or kRGBA_Premul_Config8888 if
     // either is identical to kNative_Premul_Config8888. Otherwise, -1.
     static const SkCanvas::Config8888 kPMColorAlias;
 
 protected:
     // default impl returns NULL
     virtual SkSurface* newSurface(const SkImageInfo&);
 
+    // default impl returns NULL
+    virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes);
+
+    /**
+     * Implements readPixels API. The caller will ensure that:
+     *  1. bitmap has pixel config kARGB_8888_Config.
+     *  2. bitmap has pixels.
+     *  3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is
+     *     contained in the device bounds.
+     */
+    virtual bool onReadPixels(const SkBitmap& bitmap,
+                              int x, int y,
+                              SkCanvas::Config8888 config8888);
+
+    /**
+     *  The caller is responsible for "pre-clipping" the src. The impl can assume that the src
+     *  image at the specified x,y offset will fit within the device's bounds.
+     *
+     *  This is explicitly asserted in writePixelsDirect(), the public way to call this.
+     */
+    virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, int y);
+
+    /**
+     *  Default impl returns NULL.
+     */
+    virtual void* onAccessPixels(SkImageInfo* info, size_t* rowBytes);
+
     /**
      *  Leaky properties are those which the device should be applying but it isn't.
      *  These properties will be applied by the draw, when and as it can.
      *  If the device does handle a property, that property should be set to the identity value
      *  for that property, effectively making it non-leaky.
      */
     SkDeviceProperties fLeakyProperties;
 
+    /**
+     *  PRIVATE / EXPERIMENTAL -- do not call
+     *  Construct an acceleration object and attach it to 'picture'
+     */
+    virtual void EXPERIMENTAL_optimize(SkPicture* picture);
+
+    /**
+     *  PRIVATE / EXPERIMENTAL -- do not call
+     *  This entry point gives the backend an opportunity to take over the rendering
+     *  of 'picture'. If optimization data is available (due to an earlier
+     *  'optimize' call) this entry point should make use of it and return true
+     *  if all rendering has been done. If false is returned, SkCanvas will
+     *  perform its own rendering pass. It is acceptable for the backend
+     *  to perform some device-specific warm up tasks and then let SkCanvas
+     *  perform the main rendering loop (by return false from here).
+     */
+    virtual bool EXPERIMENTAL_drawPicture(const SkPicture& picture);
+
 private:
     friend class SkCanvas;
     friend struct DeviceCM; //for setMatrixClip
     friend class SkDraw;
     friend class SkDrawIter;
     friend class SkDeviceFilteredPaint;
     friend class SkDeviceImageFilterProxy;
-    friend class DeferredDevice;    // for newSurface
+    friend class SkDeferredDevice;    // for newSurface
 
     friend class SkSurface_Raster;
 
     // used to change the backend's pixels (and possibly config/rowbytes)
     // but cannot change the width/height, so there should be no change to
     // any clip information.
     // TODO: move to SkBitmapDevice
     virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) = 0;
 
     // just called by SkCanvas when built as a layer
     void setOrigin(int x, int y) { fOrigin.set(x, y); }
     // just called by SkCanvas for saveLayer
-    SkBaseDevice* createCompatibleDeviceForSaveLayer(SkBitmap::Config config,
-                                                     int width, int height,
-                                                     bool isOpaque);
+    SkBaseDevice* createCompatibleDeviceForSaveLayer(const SkImageInfo&);
 
+#ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG
     /**
-     * Subclasses should override this to implement createCompatibleDevice.
+     * Justs exists during the period where clients still "override" this
+     *  signature. They are supported by our base-impl calling this old
+     *  signature from the new one (using ImageInfo).
      */
     virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
                                                    int width, int height,
-                                                   bool isOpaque,
-                                                   Usage usage) = 0;
+                                                   bool isOpaque, Usage) {
+        return NULL;
+    }
+#endif
+    virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) {
+        return NULL;
+    }
 
     /** Causes any deferred drawing to the device to be completed.
      */
     virtual void flush() = 0;
 
     SkIPoint    fOrigin;
     SkMetaData* fMetaData;
 
--- a/gfx/skia/trunk/include/core/SkDrawLooper.h
+++ b/gfx/skia/trunk/include/core/SkDrawLooper.h
@@ -25,50 +25,75 @@ class SkString;
     invoked multiple times (hence the name loop-er), allow it to perform effects
     like shadows or frame/fills, that require more than one pass.
 */
 class SK_API SkDrawLooper : public SkFlattenable {
 public:
     SK_DECLARE_INST_COUNT(SkDrawLooper)
 
     /**
-     *  Called right before something is being drawn. This will be followed by
-     *  calls to next() until next() returns false.
+     *  Holds state during a draw. Users call next() until it returns false.
+     *
+     *  Subclasses of SkDrawLooper should create a subclass of this object to
+     *  hold state specific to their subclass.
      */
-    virtual void init(SkCanvas*) = 0;
+    class SK_API Context : public SkNoncopyable {
+    public:
+        Context() {}
+        virtual ~Context() {}
+
+        /**
+         *  Called in a loop on objects returned by SkDrawLooper::createContext().
+         *  Each time true is returned, the object is drawn (possibly with a modified
+         *  canvas and/or paint). When false is finally returned, drawing for the object
+         *  stops.
+         *
+         *  On each call, the paint will be in its original state, but the
+         *  canvas will be as it was following the previous call to next() or
+         *  createContext().
+         *
+         *  The implementation must ensure that, when next() finally returns
+         *  false, the canvas has been restored to the state it was
+         *  initially, before createContext() was first called.
+         */
+        virtual bool next(SkCanvas* canvas, SkPaint* paint) = 0;
+    };
 
     /**
-     *  Called in a loop (after init()). Each time true is returned, the object
-     *  is drawn (possibly with a modified canvas and/or paint). When false is
-     *  finally returned, drawing for the object stops.
-     *
-     *  On each call, the paint will be in its original state, but the canvas
-     *  will be as it was following the previous call to next() or init().
-     *
-     *  The implementation must ensure that, when next() finally returns false,
-     *  that the canvas has been restored to the state it was initially, before
-     *  init() was first called.
+     *  Called right before something is being drawn. Returns a Context
+     *  whose next() method should be called until it returns false.
+     *  The caller has to ensure that the storage pointer provides enough
+     *  memory for the Context. The required size can be queried by calling
+     *  contextSize(). It is also the caller's responsibility to destroy the
+     *  object after use.
      */
-    virtual bool next(SkCanvas*, SkPaint* paint) = 0;
+    virtual Context* createContext(SkCanvas*, void* storage) const = 0;
+
+    /**
+      *  Returns the number of bytes needed to store subclasses of Context (belonging to the
+      *  corresponding SkDrawLooper subclass).
+      */
+    virtual size_t contextSize() const = 0;
+
 
     /**
      * The fast bounds functions are used to enable the paint to be culled early
      * in the drawing pipeline. If a subclass can support this feature it must
      * return true for the canComputeFastBounds() function.  If that function
      * returns false then computeFastBounds behavior is undefined otherwise it
      * is expected to have the following behavior. Given the parent paint and
      * the parent's bounding rect the subclass must fill in and return the
      * storage rect, where the storage rect is with the union of the src rect
      * and the looper's bounding rect.
      */
-    virtual bool canComputeFastBounds(const SkPaint& paint);
+    virtual bool canComputeFastBounds(const SkPaint& paint) const;
     virtual void computeFastBounds(const SkPaint& paint,
-                                   const SkRect& src, SkRect* dst);
+                                   const SkRect& src, SkRect* dst) const;
 
-    SkDEVCODE(virtual void toString(SkString* str) const = 0;)
+    SK_TO_STRING_PUREVIRT()
     SK_DEFINE_FLATTENABLE_TYPE(SkDrawLooper)
 
 protected:
     SkDrawLooper() {}
     SkDrawLooper(SkReadBuffer& buffer) : INHERITED(buffer) {}
 
 private:
     typedef SkFlattenable INHERITED;
--- a/gfx/skia/trunk/include/core/SkEmptyShader.h
+++ b/gfx/skia/trunk/include/core/SkEmptyShader.h
@@ -25,17 +25,17 @@ public:
     virtual uint32_t getFlags() SK_OVERRIDE;
     virtual uint8_t getSpan16Alpha() const SK_OVERRIDE;
     virtual bool setContext(const SkBitmap&, const SkPaint&,
                             const SkMatrix&) SK_OVERRIDE;
     virtual void shadeSpan(int x, int y, SkPMColor span[], int count) SK_OVERRIDE;
     virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
     virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVERRIDE;
 
-    SK_DEVELOPER_TO_STRING()
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader)
 
 protected:
     SkEmptyShader(SkReadBuffer& buffer) : INHERITED(buffer) {}
 
 private:
     typedef SkShader INHERITED;
 };
--- a/gfx/skia/trunk/include/core/SkGeometry.h
+++ b/gfx/skia/trunk/include/core/SkGeometry.h
@@ -250,16 +250,25 @@ struct SkConic {
 
     bool findXExtrema(SkScalar* t) const;
     bool findYExtrema(SkScalar* t) const;
     bool chopAtXExtrema(SkConic dst[2]) const;
     bool chopAtYExtrema(SkConic dst[2]) const;
 
     void computeTightBounds(SkRect* bounds) const;
     void computeFastBounds(SkRect* bounds) const;
+
+    /** Find the parameter value where the conic takes on its maximum curvature.
+     *
+     *  @param t   output scalar for max curvature.  Will be unchanged if
+     *             max curvature outside 0..1 range.
+     *
+     *  @return  true if max curvature found inside 0..1 range, false otherwise
+     */
+    bool findMaxCurvature(SkScalar* t) const;
 };
 
 #include "SkTemplates.h"
 
 /**
  *  Help class to allocate storage for approximating a conic with N quads.
  */
 class SkAutoConicToQuads {
--- a/gfx/skia/trunk/include/core/SkImageFilter.h
+++ b/gfx/skia/trunk/include/core/SkImageFilter.h
@@ -4,22 +4,22 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 #ifndef SkImageFilter_DEFINED
 #define SkImageFilter_DEFINED
 
 #include "SkFlattenable.h"
+#include "SkMatrix.h"
 #include "SkRect.h"
 
 class SkBitmap;
 class SkColorFilter;
 class SkBaseDevice;
-class SkMatrix;
 struct SkIPoint;
 class SkShader;
 class GrEffectRef;
 class GrTexture;
 
 /**
  *  Base class for image filters. If one is installed in the paint, then
  *  all drawing occurs as usual, but it is as if the drawing happened into an
@@ -44,44 +44,56 @@ public:
         explicit CropRect(const SkRect& rect, uint32_t flags = kHasAll_CropEdge) : fRect(rect), fFlags(flags) {}
         uint32_t flags() const { return fFlags; }
         const SkRect& rect() const { return fRect; }
     private:
         SkRect fRect;
         uint32_t fFlags;
     };
 
+    class Context {
+    public:
+        Context(const SkMatrix& ctm, const SkIRect& clipBounds) :
+            fCTM(ctm), fClipBounds(clipBounds) {
+        }
+        const SkMatrix& ctm() const { return fCTM; }
+        const SkIRect& clipBounds() const { return fClipBounds; }
+    private:
+        SkMatrix fCTM;
+        SkIRect  fClipBounds;
+    };
+
     class Proxy {
     public:
         virtual ~Proxy() {};
 
         virtual SkBaseDevice* createDevice(int width, int height) = 0;
         // returns true if the proxy can handle this filter natively
         virtual bool canHandleImageFilter(const SkImageFilter*) = 0;
         // returns true if the proxy handled the filter itself. if this returns
         // false then the filter's code will be called.
         virtual bool filterImage(const SkImageFilter*, const SkBitmap& src,
-                                 const SkMatrix& ctm,
+                                 const Context&,
                                  SkBitmap* result, SkIPoint* offset) = 0;
     };
 
     /**
      *  Request a new (result) image to be created from the src image.
      *  If the src has no pixels (isNull()) then the request just wants to
      *  receive the config and width/height of the result.
      *
      *  The matrix is the current matrix on the canvas.
      *
      *  Offset is the amount to translate the resulting image relative to the
      *  src when it is drawn. This is an out-param.
      *
      *  If the result image cannot be created, return false, in which case both
      *  the result and offset parameters will be ignored by the caller.
      */
-    bool filterImage(Proxy*, const SkBitmap& src, const SkMatrix& ctm,
+    bool filterImage(Proxy*, const SkBitmap& src, const Context&,
                      SkBitmap* result, SkIPoint* offset) const;
 
     /**
      *  Given the src bounds of an image, this returns the bounds of the result
      *  image after the filter has been applied.
      */
     bool filterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const;
 
@@ -99,17 +111,17 @@ public:
      *  multi-pass effects, where intermediate results must be rendered to
      *  textures.  For single-pass effects, use asNewEffect().  src is the
      *  source image for processing, as a texture-backed bitmap.  result is
      *  the destination bitmap, which should contain a texture-backed pixelref
      *  on success.  offset is the amount to translate the resulting image
      *  relative to the src when it is drawn. The default implementation does
      *  single-pass processing using asNewEffect().
      */
-    virtual bool filterImageGPU(Proxy*, const SkBitmap& src, const SkMatrix& ctm,
+    virtual bool filterImageGPU(Proxy*, const SkBitmap& src, const Context&,
                                 SkBitmap* result, SkIPoint* offset) const;
 
     /**
      *  Returns whether this image filter is a color filter and puts the color filter into the
      *  "filterPtr" parameter if it can. Does nothing otherwise.
      *  If this returns false, then the filterPtr is unchanged.
      *  If this returns true, then if filterPtr is not null, it must be set to a ref'd colorfitler
      *  (i.e. it may not be set to NULL).
@@ -141,16 +153,30 @@ public:
      *  filterImageGPU(). (The latter ensures that the resulting buffer is
      *  drawn in the correct location.)
      */
     bool cropRectIsSet() const { return fCropRect.flags() != 0x0; }
 
     // Default impl returns union of all input bounds.
     virtual void computeFastBounds(const SkRect&, SkRect*) const;
 
+#ifdef SK_SUPPORT_GPU
+    /**
+     * Wrap the given texture in a texture-backed SkBitmap.
+     */
+    static void WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result);
+
+    /**
+     * Recursively evaluate this filter on the GPU. If the filter has no GPU
+     * implementation, it will be processed in software and uploaded to the GPU.
+     */
+    bool getInputResultGPU(SkImageFilter::Proxy* proxy, const SkBitmap& src, const Context&,
+                           SkBitmap* result, SkIPoint* offset) const;
+#endif
+
     SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter)
 
 protected:
     SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRect = NULL);
 
     // Convenience constructor for 1-input filters.
     explicit SkImageFilter(SkImageFilter* input, const CropRect* cropRect = NULL);
 
@@ -181,31 +207,46 @@ protected:
      *
      *  Offset is the amount to translate the resulting image relative to the
      *  src when it is drawn. This is an out-param.
      *
      *  If the result image cannot be created, this should false, in which
      *  case both the result and offset parameters will be ignored by the
      *  caller.
      */
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* offset) const;
     // Given the bounds of the destination rect to be filled in device
     // coordinates (first parameter), and the CTM, compute (conservatively)
     // which rect of the source image would be required (third parameter).
     // Used for clipping and temp-buffer allocations, so the result need not
     // be exact, but should never be smaller than the real answer. The default
     // implementation recursively unions all input bounds, or returns false if
     // no inputs.
     virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const;
 
-    // Applies "matrix" to the crop rect, and sets "rect" to the intersection of
-    // "rect" and the transformed crop rect. If there is no overlap, returns
-    // false and leaves "rect" unchanged.
-    bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const;
+    /** Computes source bounds as the src bitmap bounds offset by srcOffset.
+     *  Apply the transformed crop rect to the bounds if any of the
+     *  corresponding edge flags are set. Intersects the result against the
+     *  context's clipBounds, and returns the result in "bounds". If there is
+     *  no intersection, returns false and leaves "bounds" unchanged.
+     */
+    bool applyCropRect(const Context&, const SkBitmap& src, const SkIPoint& srcOffset,
+                       SkIRect* bounds) const;
+
+    /** Same as the above call, except that if the resulting crop rect is not
+     *  entirely contained by the source bitmap's bounds, it creates a new
+     *  bitmap in "result" and pads the edges with transparent black. In that
+     *  case, the srcOffset is modified to be the same as the bounds, since no
+     *  further adjustment is needed by the caller. This version should only
+     *  be used by filters which are not capable of processing a smaller
+     *  source bitmap into a larger destination.
+     */
+    bool applyCropRect(const Context&, Proxy* proxy, const SkBitmap& src, SkIPoint* srcOffset,
+                       SkIRect* bounds, SkBitmap* result) const;
 
     /**
      *  Returns true if the filter can be expressed a single-pass
      *  GrEffect, used to process this filter on the GPU, or false if
      *  not.
      *
      *  If effect is non-NULL, a new GrEffect instance is stored
      *  in it.  The caller assumes ownership of the stage, and it is up to the
@@ -217,16 +258,17 @@ protected:
      *  will be called with (NULL, NULL, SkMatrix::I()) to query for support,
      *  so returning "true" indicates support for all possible matrices.
      */
     virtual bool asNewEffect(GrEffectRef** effect,
                              GrTexture*,
                              const SkMatrix& matrix,
                              const SkIRect& bounds) const;
 
+
 private:
     typedef SkFlattenable INHERITED;
     int fInputCount;
     SkImageFilter** fInputs;
     CropRect fCropRect;
 };
 
 #endif
deleted file mode 100644
--- a/gfx/skia/trunk/include/core/SkImageFilterUtils.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2013 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 SkImageFilterUtils_DEFINED
-#define SkImageFilterUtils_DEFINED
-
-#if SK_SUPPORT_GPU
-
-#include "SkImageFilter.h"
-
-class SkBitmap;
-class GrTexture;
-class SkImageFilter;
-
-class SK_API SkImageFilterUtils {
-public:
-    /**
-     * Wrap the given texture in a texture-backed SkBitmap.
-     */
-    static bool WrapTexture(GrTexture* texture, int width, int height, SkBitmap* result);
-
-    /**
-     * Recursively evaluate the given filter on the GPU.  If filter is NULL,
-     * this function returns src.  If the filter has no GPU implementation, it
-     * will be processed in software and uploaded to the GPU.
-     */
-    static bool GetInputResultGPU(const SkImageFilter* filter, SkImageFilter::Proxy* proxy,
-                                  const SkBitmap& src, const SkMatrix& ctm, SkBitmap* result,
-                                  SkIPoint* offset);
-};
-
-#endif
-
-#endif
--- a/gfx/skia/trunk/include/core/SkImageInfo.h
+++ b/gfx/skia/trunk/include/core/SkImageInfo.h
@@ -160,16 +160,23 @@ struct SkImageInfo {
 
     static SkImageInfo MakeA8(int width, int height) {
         SkImageInfo info = {
             width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType
         };
         return info;
     }
 
+    static SkImageInfo MakeUnknown(int width, int height) {
+        SkImageInfo info = {
+            width, height, kUnknown_SkColorType, kIgnore_SkAlphaType
+        };
+        return info;
+    }
+
     int width() const { return fWidth; }
     int height() const { return fHeight; }
     SkColorType colorType() const { return fColorType; }
     SkAlphaType alphaType() const { return fAlphaType; }
 
     bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; }
 
     bool isOpaque() const {
--- a/gfx/skia/trunk/include/core/SkMaskFilter.h
+++ b/gfx/skia/trunk/include/core/SkMaskFilter.h
@@ -35,18 +35,16 @@ class SkStrokeRec;
     new mask is used to render into the device.
 
     Blur and emboss are implemented as subclasses of SkMaskFilter.
 */
 class SK_API SkMaskFilter : public SkFlattenable {
 public:
     SK_DECLARE_INST_COUNT(SkMaskFilter)
 
-    SkMaskFilter() {}
-
     /** Returns the format of the resulting mask that this subclass will return
         when its filterMask() method is called.
     */
     virtual SkMask::Format getFormat() const = 0;
 
     /** Create a new mask by filter the src mask.
         If src.fImage == null, then do not allocate or create the dst image
         but do fill out the other fields in dstMask.
@@ -98,16 +96,24 @@ public:
     /**
      *  Try to directly render the mask filter into the target.  Returns
      *  true if drawing was successful.
      */
     virtual bool directFilterMaskGPU(GrContext* context,
                                      GrPaint* grp,
                                      const SkStrokeRec& strokeRec,
                                      const SkPath& path) const;
+    /**
+     *  Try to directly render a rounded rect mask filter into the target.  Returns
+     *  true if drawing was successful.
+     */
+    virtual bool directFilterRRectMaskGPU(GrContext* context,
+                                          GrPaint* grp,
+                                          const SkStrokeRec& strokeRec,
+                                          const SkRRect& rrect) const;
 
     /**
      * This function is used to implement filters that require an explicit src mask. It should only
      * be called if canFilterMaskGPU returned true and the maskRect param should be the output from
      * that call. canOverwriteSrc indicates whether the implementation may treat src as a scratch
      * texture and overwrite its contents. When true it is also legal to return src as the result.
      * Implementations are free to get the GrContext from the src texture in order to create
      * additional textures and perform multiple passes.
@@ -127,20 +133,21 @@ public:
      * allowed to provide the same struct for both src and dest so each
      * implementation must accomodate that behavior.
      *
      *  The default impl calls filterMask with the src mask having no image,
      *  but subclasses may override this if they can compute the rect faster.
      */
     virtual void computeFastBounds(const SkRect& src, SkRect* dest) const;
 
-    SkDEVCODE(virtual void toString(SkString* str) const = 0;)
+    SK_TO_STRING_PUREVIRT()
     SK_DEFINE_FLATTENABLE_TYPE(SkMaskFilter)
 
 protected:
+    SkMaskFilter() {}
     // empty for now, but lets get our subclass to remember to init us for the future
     SkMaskFilter(SkReadBuffer& buffer) : INHERITED(buffer) {}
 
     enum FilterReturn {
         kFalse_FilterReturn,
         kTrue_FilterReturn,
         kUnimplemented_FilterReturn
     };
--- a/gfx/skia/trunk/include/core/SkMatrix.h
+++ b/gfx/skia/trunk/include/core/SkMatrix.h
@@ -555,17 +555,17 @@ public:
      * @param buffer Memory to read from
      * @param length Amount of memory available in the buffer
      * @return number of bytes read (must be a multiple of 4) or
      *         0 if there was not enough memory available
      */
     size_t readFromMemory(const void* buffer, size_t length);
 
     SkDEVCODE(void dump() const;)
-    SkDEVCODE(void toString(SkString*) const;)
+    SK_TO_STRING_NONVIRT()
 
     /**
      * Calculates the minimum stretching factor of the matrix. If the matrix has
      * perspective -1 is returned.
      *
      * @return minumum strecthing factor
      */
     SkScalar getMinStretch() const;
--- a/gfx/skia/trunk/include/core/SkPaint.h
+++ b/gfx/skia/trunk/include/core/SkPaint.h
@@ -113,16 +113,18 @@ public:
         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
+        kDistanceFieldTextTEMP_Flag = 0x4000, //!< TEMPORARY mask to enable distance fields
+                                              // currently overrides LCD and subpixel rendering
         // when adding extra flags, note that the fFlags member is specified
         // with a bit-width and you'll have to expand it.
 
         kAllFlags = 0xFFFF
     };
 
     /** Return the paint's flags. Use the Flag enum to test flag values.
         @return the paint's flags (see enums ending in _Flag for bit masks)
@@ -279,16 +281,29 @@ public:
     }
 
     /** Helper for setFlags(), setting or clearing the kKernText_Flag bit
         @param kernText true to set the kKernText_Flag bit in the paint's
                             flags, false to clear it.
     */
     void setDevKernText(bool devKernText);
 
+    /** Helper for getFlags(), returns true if kDistanceFieldTextTEMP_Flag bit is set
+     @return true if the distanceFieldText bit is set in the paint's flags.
+     */
+    bool isDistanceFieldTextTEMP() const {
+        return SkToBool(this->getFlags() & kDistanceFieldTextTEMP_Flag);
+    }
+
+    /** Helper for setFlags(), setting or clearing the kDistanceFieldTextTEMP_Flag bit
+     @param distanceFieldText true to set the kDistanceFieldTextTEMP_Flag bit in the paint's
+     flags, false to clear it.
+     */
+    void setDistanceFieldTextTEMP(bool distanceFieldText);
+
     enum FilterLevel {
         kNone_FilterLevel,
         kLow_FilterLevel,
         kMedium_FilterLevel,
         kHigh_FilterLevel
     };
 
     /**
@@ -726,27 +741,70 @@ public:
         kGlyphID_TextEncoding   //!< the text parameters are glyph indices
     };
 
     TextEncoding getTextEncoding() const { return (TextEncoding)fTextEncoding; }
 
     void setTextEncoding(TextEncoding encoding);
 
     struct FontMetrics {
+        /** Flags which indicate the confidence level of various metrics.
+            A set flag indicates that the metric may be trusted.
+        */
+        enum FontMetricsFlags {
+            kUnderlineThinknessIsValid_Flag = 1 << 0,
+            kUnderlinePositionIsValid_Flag = 1 << 1,
+        };
+
+        uint32_t    fFlags;       //!< Bit field to identify which values are unknown
         SkScalar    fTop;       //!< The greatest distance above the baseline for any glyph (will be <= 0)
         SkScalar    fAscent;    //!< The recommended distance above the baseline (will be <= 0)
         SkScalar    fDescent;   //!< The recommended distance below the baseline (will be >= 0)
         SkScalar    fBottom;    //!< The greatest distance below the baseline for any glyph (will be >= 0)
         SkScalar    fLeading;   //!< The recommended distance to add between lines of text (will be >= 0)
-        SkScalar    fAvgCharWidth;  //!< the average charactor width (>= 0)
-        SkScalar    fMaxCharWidth;  //!< the max charactor width (>= 0)
+        SkScalar    fAvgCharWidth;  //!< the average character width (>= 0)
+        SkScalar    fMaxCharWidth;  //!< the max character width (>= 0)
         SkScalar    fXMin;      //!< The minimum bounding box x value for all glyphs
         SkScalar    fXMax;      //!< The maximum bounding box x value for all glyphs
         SkScalar    fXHeight;   //!< The height of an 'x' in px, or 0 if no 'x' in face
         SkScalar    fCapHeight;  //!< The cap height (> 0), or 0 if cannot be determined.
+        SkScalar    fUnderlineThickness; //!< underline thickness, or 0 if cannot be determined
+
+        /**  Underline Position - position of the top of the Underline stroke
+                relative to the baseline, this can have following values
+                - Negative - means underline should be drawn above baseline.
+                - Positive - means below baseline.
+                - Zero     - mean underline should be drawn on baseline.
+         */
+        SkScalar    fUnderlinePosition; //!< underline position, or 0 if cannot be determined
+
+        /**  If the fontmetrics has a valid underlinethickness, return true, and set the
+                thickness param to that value. If it doesn't return false and ignore the
+                thickness param.
+        */
+        bool hasUnderlineThickness(SkScalar* thickness) const {
+            if (SkToBool(fFlags & kUnderlineThinknessIsValid_Flag)) {
+                *thickness = fUnderlineThickness;
+                return true;
+            }
+            return false;
+        }
+
+        /**  If the fontmetrics has a valid underlineposition, return true, and set the
+                thickness param to that value. If it doesn't return false and ignore the
+                thickness param.
+        */
+        bool hasUnderlinePosition(SkScalar* position) const {
+            if (SkToBool(fFlags & kUnderlinePositionIsValid_Flag)) {
+                *position = fUnderlinePosition;
+                return true;
+            }
+            return false;
+        }
+
     };
 
     /** Return the recommend spacing between lines (which will be
         fDescent - fAscent + fLeading).
         If metrics is not null, return in it the font metrics for the
         typeface/pointsize/etc. currently set in the paint.
         @param metrics      If not null, returns the font metrics for the
                             current typeface/pointsize/etc setting in this
@@ -875,20 +933,16 @@ public:
     */
     void getTextPath(const void* text, size_t length, SkScalar x, SkScalar y,
                      SkPath* path) const;
 
     void getPosTextPath(const void* text, size_t length,
                         const SkPoint pos[], SkPath* path) const;
 
 #ifdef SK_BUILD_FOR_ANDROID
-    const SkGlyph& getUnicharMetrics(SkUnichar, const SkMatrix*);
-    const SkGlyph& getGlyphMetrics(uint16_t, const SkMatrix*);
-    const void* findImage(const SkGlyph&, const SkMatrix*);
-
     uint32_t getGenerationID() const;
     void setGenerationID(uint32_t generationID);
 
     /** Returns the base glyph count for the strike associated with this paint
     */
     unsigned getBaseGlyphCount(SkUnichar text) const;
 
     const SkPaintOptionsAndroid& getPaintOptionsAndroid() const {
@@ -973,17 +1027,22 @@ public:
         }
         return matrix;
     }
 
     SkMatrix* setTextMatrix(SkMatrix* matrix) const {
         return SetTextMatrix(matrix, fTextSize, fTextScaleX, fTextSkewX);
     }
 
-    SkDEVCODE(void toString(SkString*) const;)
+    SK_TO_STRING_NONVIRT()
+
+    struct FlatteningTraits {
+        static void Flatten(SkWriteBuffer& buffer, const SkPaint& paint);
+        static void Unflatten(SkReadBuffer& buffer, SkPaint* paint);
+    };
 
 private:
     SkTypeface*     fTypeface;
     SkScalar        fTextSize;
     SkScalar        fTextScaleX;
     SkScalar        fTextSkewX;
 
     SkPathEffect*   fPathEffect;
@@ -994,26 +1053,35 @@ private:
     SkRasterizer*   fRasterizer;
     SkDrawLooper*   fLooper;
     SkImageFilter*  fImageFilter;
     SkAnnotation*   fAnnotation;
 
     SkColor         fColor;
     SkScalar        fWidth;
     SkScalar        fMiterLimit;
-    // all of these bitfields should add up to 32
-    unsigned        fFlags : 16;
-    unsigned        fTextAlign : 2;
-    unsigned        fCapType : 2;
-    unsigned        fJoinType : 2;
-    unsigned        fStyle : 2;
-    unsigned        fTextEncoding : 2;  // 3 values
-    unsigned        fHinting : 2;
-    //unsigned      fFreeBits : 4;
 
+    union {
+        struct {
+            // all of these bitfields should add up to 32
+            unsigned        fFlags : 16;
+            unsigned        fTextAlign : 2;
+            unsigned        fCapType : 2;
+            unsigned        fJoinType : 2;
+            unsigned        fStyle : 2;
+            unsigned        fTextEncoding : 2;  // 3 values
+            unsigned        fHinting : 2;
+            //unsigned      fFreeBits : 4;
+        };
+        uint32_t fBitfields;
+    };
+    uint32_t getBitfields() const { return fBitfields; }
+    void setBitfields(uint32_t bitfields);
+
+    uint32_t fDirtyBits;
 
     SkDrawCacheProc    getDrawCacheProc() const;
     SkMeasureCacheProc getMeasureCacheProc(TextBufferDirection dir,
                                            bool needFullMetrics) const;
 
     SkScalar measure_text(SkGlyphCache*, const char* text, size_t length,
                           int* count, SkRect* bounds) const;
 
--- a/gfx/skia/trunk/include/core/SkPathEffect.h
+++ b/gfx/skia/trunk/include/core/SkPathEffect.h
@@ -26,18 +26,16 @@ class SkPath;
     canvas' matrix and drawn.
 
     Dashing is implemented as a subclass of SkPathEffect.
 */
 class SK_API SkPathEffect : public SkFlattenable {
 public:
     SK_DECLARE_INST_COUNT(SkPathEffect)
 
-    SkPathEffect() {}
-
     /**
      *  Given a src path (input) and a stroke-rec (input and output), apply
      *  this effect to the src path, returning the new path in dst, and return
      *  true. If this effect cannot be applied, return false and ignore dst
      *  and stroke-rec.
      *
      *  The stroke-rec specifies the initial request for stroking (if any).
      *  The effect can treat this as input only, or it can choose to change
@@ -104,16 +102,17 @@ public:
      */
     virtual bool asPoints(PointData* results, const SkPath& src,
                           const SkStrokeRec&, const SkMatrix&,
                           const SkRect* cullR) const;
 
     SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect)
 
 protected:
+    SkPathEffect() {}
     SkPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {}
 
 private:
     // illegal
     SkPathEffect(const SkPathEffect&);
     SkPathEffect& operator=(const SkPathEffect&);
 
     typedef SkFlattenable INHERITED;
@@ -122,20 +121,20 @@ private:
 /** \class SkPairPathEffect
 
     Common baseclass for Compose and Sum. This subclass manages two pathEffects,
     including flattening them. It does nothing in filterPath, and is only useful
     for managing the lifetimes of its two arguments.
 */
 class SkPairPathEffect : public SkPathEffect {
 public:
-    SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1);
     virtual ~SkPairPathEffect();
 
 protected:
+    SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1);
     SkPairPathEffect(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
     // these are visible to our subclasses
     SkPathEffect* fPE0, *fPE1;
 
 private:
     typedef SkPathEffect INHERITED;
@@ -148,27 +147,34 @@ private:
 */
 class SkComposePathEffect : public SkPairPathEffect {
 public:
     /** Construct a pathEffect whose effect is to apply first the inner pathEffect
         and the the outer pathEffect (e.g. outer(inner(path)))
         The reference counts for outer and inner are both incremented in the constructor,
         and decremented in the destructor.
     */
-    SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner)
-        : INHERITED(outer, inner) {}
+    static SkComposePathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) {
+        return SkNEW_ARGS(SkComposePathEffect, (outer, inner));
+    }
 
     virtual bool filterPath(SkPath* dst, const SkPath& src,
                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
 
 protected:
     SkComposePathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {}
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner)
+        : INHERITED(outer, inner) {}
+
 private:
     // illegal
     SkComposePathEffect(const SkComposePathEffect&);
     SkComposePathEffect& operator=(const SkComposePathEffect&);
 
     typedef SkPairPathEffect INHERITED;
 };
 
@@ -179,27 +185,34 @@ private:
 */
 class SkSumPathEffect : public SkPairPathEffect {
 public:
     /** Construct a pathEffect whose effect is to apply two effects, in sequence.
         (e.g. first(path) + second(path))
         The reference counts for first and second are both incremented in the constructor,
         and decremented in the destructor.
     */
-    SkSumPathEffect(SkPathEffect* first, SkPathEffect* second)
-        : INHERITED(first, second) {}
+    static SkSumPathEffect* Create(SkPathEffect* first, SkPathEffect* second) {
+        return SkNEW_ARGS(SkSumPathEffect, (first, second));
+    }
 
     virtual bool filterPath(SkPath* dst, const SkPath& src,
                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
 
 protected:
     SkSumPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {}
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkSumPathEffect(SkPathEffect* first, SkPathEffect* second)
+        : INHERITED(first, second) {}
+
 private:
     // illegal
     SkSumPathEffect(const SkSumPathEffect&);
     SkSumPathEffect& operator=(const SkSumPathEffect&);
 
     typedef SkPairPathEffect INHERITED;
 };
 
--- a/gfx/skia/trunk/include/core/SkPicture.h
+++ b/gfx/skia/trunk/include/core/SkPicture.h
@@ -29,26 +29,59 @@ struct SkPictInfo;
 
     The SkPicture class records the drawing commands made to a canvas, to
     be played back at a later time.
 */
 class SK_API SkPicture : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(SkPicture)
 
+    // AccelData provides a base class for device-specific acceleration
+    // data. It is added to the picture via a call to a device's optimize
+    // method.
+    class AccelData : public SkRefCnt {
+    public:
+        typedef uint8_t Domain;
+        typedef uint32_t Key;
+
+        AccelData(Key key) : fKey(key) { }
+
+        const Key& getKey() const { return fKey; }
+
+        // This entry point allows user's to get a unique domain prefix
+        // for their keys
+        static Domain GenerateDomain();
+    private:
+        Key fKey;
+
+        typedef SkRefCnt INHERITED;
+    };
+
     /** The constructor prepares the picture to record.
         @param width the width of the virtual device the picture records.
         @param height the height of the virtual device the picture records.
     */
     SkPicture();
     /** Make a copy of the contents of src. If src records more drawing after
         this call, those elements will not appear in this picture.
     */
     SkPicture(const SkPicture& src);
 
+    /**  PRIVATE / EXPERIMENTAL -- do not call */
+    void EXPERIMENTAL_addAccelData(const AccelData* data) {
+        SkRefCnt_SafeAssign(fAccelData, data);
+    }
+    /**  PRIVATE / EXPERIMENTAL -- do not call */
+    const AccelData* EXPERIMENTAL_getAccelData(AccelData::Key key) const {
+        if (NULL != fAccelData && fAccelData->getKey() == key) {
+            return fAccelData;
+        }
+        return NULL;
+    }
+
     /**
      *  Function signature defining a function that sets up an SkBitmap from encoded data. On
      *  success, the SkBitmap should have its Config, width, height, rowBytes and pixelref set.
      *  If the installed pixelref has decoded the data into pixels, then the src buffer need not be
      *  copied. If the pixelref defers the actual decode until its lockPixels() is called, then it
      *  must make a copy of the src buffer.
      *  @param src Encoded data.
      *  @param length Size of the encoded data, in bytes.
@@ -120,25 +153,16 @@ public:
             after a frame or two of tiled rendering (and complex pictures that
             induce the worst record times will generally get the largest
             speedups at playback time).
 
             Note: Currently this is not serializable, the bounding data will be
             discarded if you serialize into a stream and then deserialize.
         */
         kOptimizeForClippedPlayback_RecordingFlag = 0x02,
-        /*
-            This flag disables all the picture recording optimizations (i.e.,
-            those in SkPictureRecord). It is mainly intended for testing the
-            existing optimizations (i.e., to actually have the pattern
-            appear in an .skp we have to disable the optimization). This
-            option doesn't affect the optimizations controlled by
-            'kOptimizeForClippedPlayback_RecordingFlag'.
-         */
-        kDisableRecordOptimizations_RecordingFlag = 0x04
     };
 
     /** Returns the canvas that records the drawing commands.
         @param width the base width for the picture, as if the recording
                      canvas' bitmap had this width.
         @param height the base width for the picture, as if the recording
                      canvas' bitmap had this height.
         @param recordFlags optional flags that control recording.
@@ -212,16 +236,35 @@ public:
     /** Signals that the caller is prematurely done replaying the drawing
         commands. This can be called from a canvas virtual while the picture
         is drawing. Has no effect if the picture is not drawing.
         @deprecated preserving for legacy purposes
     */
     void abortPlayback();
 #endif
 
+    /** Return true if the SkStream/Buffer represents a serialized picture, and
+        fills out SkPictInfo. After this function returns, the data source is not
+        rewound so it will have to be manually reset before passing to
+        CreateFromStream or CreateFromBuffer. Note, CreateFromStream and
+        CreateFromBuffer perform this check internally so these entry points are
+        intended for stand alone tools.
+        If false is returned, SkPictInfo is unmodified.
+    */
+    static bool InternalOnly_StreamIsSKP(SkStream*, SkPictInfo*);
+    static bool InternalOnly_BufferIsSKP(SkReadBuffer&, SkPictInfo*);
+
+    /** Enable/disable all the picture recording optimizations (i.e.,
+        those in SkPictureRecord). It is mainly intended for testing the
+        existing optimizations (i.e., to actually have the pattern
+        appear in an .skp we have to disable the optimization). Call right
+        after 'beginRecording'.
+    */
+    void internalOnly_EnableOpts(bool enableOpts);
+
 protected:
     // V2 : adds SkPixelRef's generation ID.
     // V3 : PictInfo tag at beginning, and EOF tag at the end
     // V4 : move SkPictInfo to be the header
     // V5 : don't read/write FunctionPtr on cross-process (we can detect that)
     // V6 : added serialization of SkPath's bounds (and packed its flags tighter)
     // V7 : changed drawBitmapRect(IRect) to drawBitmapRectToRect(Rect)
     // V8 : Add an option for encoding bitmaps
@@ -234,41 +277,44 @@ protected:
     //      parameterize blurs by sigma rather than radius
     // V14: Add flags word to PathRef serialization
     // V15: Remove A1 bitmpa config (and renumber remaining configs)
     // V16: Move SkPath's isOval flag to SkPathRef
     // V17: SkPixelRef now writes SkImageInfo
     // V18: SkBitmap now records x,y for its pixelref origin, instead of offset.
     // V19: encode matrices and regions into the ops stream
     // V20: added bool to SkPictureImageFilter's serialization (to allow SkPicture serialization)
-    static const uint32_t PICTURE_VERSION = 20;
+    // V21: add pushCull, popCull
+    // V22: SK_PICT_FACTORY_TAG's size is now the chunk size in bytes
+
+    // Note: If the picture version needs to be increased then please follow the
+    // steps to generate new SKPs in (only accessible to Googlers): http://goo.gl/qATVcw
+
+    // Only SKPs within the min/current picture version range (inclusive) can be read.
+    static const uint32_t MIN_PICTURE_VERSION = 19;
+    static const uint32_t CURRENT_PICTURE_VERSION = 22;
 
     // fPlayback, fRecord, fWidth & fHeight are protected to allow derived classes to
     // install their own SkPicturePlayback-derived players,SkPictureRecord-derived
     // recorders and set the picture size
-    SkPicturePlayback* fPlayback;
-    SkPictureRecord* fRecord;
-    int fWidth, fHeight;
+    SkPicturePlayback*    fPlayback;
+    SkPictureRecord*      fRecord;
+    int                   fWidth, fHeight;
+    const AccelData*      fAccelData;
 
     // Create a new SkPicture from an existing SkPicturePlayback. Ref count of
     // playback is unchanged.
     SkPicture(SkPicturePlayback*, int width, int height);
 
     // For testing. Derived classes may instantiate an alternate
     // SkBBoxHierarchy implementation
     virtual SkBBoxHierarchy* createBBoxHierarchy() const;
-
-    // Return true if the SkStream represents a serialized picture, and fills out
-    // SkPictInfo. After this function returns, the SkStream is not rewound; it
-    // will be ready to be parsed to create an SkPicturePlayback.
-    // If false is returned, SkPictInfo is unmodified.
-    static bool StreamIsSKP(SkStream*, SkPictInfo*);
-    static bool BufferIsSKP(SkReadBuffer&, SkPictInfo*);
 private:
-    void createHeader(void* header) const;
+    void createHeader(SkPictInfo* info) const;
+    static bool IsValidPictInfo(const SkPictInfo& info);
 
     friend class SkFlatPicture;
     friend class SkPicturePlayback;
 
     typedef SkRefCnt INHERITED;
 };
 
 /**
--- a/gfx/skia/trunk/include/core/SkPreConfig.h
+++ b/gfx/skia/trunk/include/core/SkPreConfig.h
@@ -111,50 +111,40 @@
 
 #define SK_CPU_SSE_LEVEL_SSE1     10
 #define SK_CPU_SSE_LEVEL_SSE2     20
 #define SK_CPU_SSE_LEVEL_SSE3     30
 #define SK_CPU_SSE_LEVEL_SSSE3    31
 
 // Are we in GCC?
 #ifndef SK_CPU_SSE_LEVEL
-    #if defined(__SSE2__)
-        #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_SSE2
+    // These checks must be done in descending order to ensure we set the highest
+    // available SSE level.
+    #if defined(__SSSE3__)
+        #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_SSSE3
     #elif defined(__SSE3__)
         #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_SSE3
-    #elif defined(__SSSE3__)
-        #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_SSSE3
+    #elif defined(__SSE2__)
+        #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_SSE2
     #endif
 #endif
 
 // Are we in VisualStudio?
 #ifndef SK_CPU_SSE_LEVEL
+    // These checks must be done in descending order to ensure we set the highest
+    // available SSE level.
     #if defined (_M_IX86_FP)
-        #if _M_IX86_FP == 1
+        #if _M_IX86_FP >= 2
+            #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_SSE2
+        #elif _M_IX86_FP == 1
             #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_SSE1
-        #elif _M_IX86_FP >= 2
-            #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_SSE2
         #endif
     #endif
 #endif
 
-// 64bit intel guarantees at least SSE2
-#if defined(__x86_64__) || defined(_WIN64)
-    #if !defined(SK_CPU_SSE_LEVEL) || (SK_CPU_SSE_LEVEL < SK_CPU_SSE_LEVEL_SSE2)
-        #undef SK_CPU_SSE_LEVEL
-        #define SK_CPU_SSE_LEVEL    SK_CPU_SSE_LEVEL_SSE2
-    #endif
-#endif
-
-// Android x86 NDK ABI requires SSE3 support
-#if defined(SK_BUILD_FOR_ANDROID)
-    #undef SK_CPU_SSE_LEVEL
-    #define SK_CPU_SSE_LEVEL        SK_CPU_SSE_LEVEL_SSE3
-#endif
-
 //////////////////////////////////////////////////////////////////////
 // ARM defines
 
 #if defined(__arm__) && (!defined(__APPLE__) || !TARGET_IPHONE_SIMULATOR)
     #define SK_CPU_ARM
 
     #if defined(__GNUC__)
         #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
--- a/gfx/skia/trunk/include/core/SkRRect.h
+++ b/gfx/skia/trunk/include/core/SkRRect.h
@@ -21,25 +21,19 @@ class SkMatrix;
 //      add contains(SkRRect&) - for clip stack
 //      add heart rect computation (max rect inside RR)
 //      add 9patch rect computation
 //      add growToInclude(SkPath&)
 //   analysis
 //      use growToInclude to fit skp round rects & generate stats (RRs vs. real paths)
 //      check on # of rectorus's the RRs could handle
 //   rendering work
-//      add entry points (clipRRect, drawRRect) - plumb down to SkBaseDevice
-//      update SkPath.addRRect() to take an SkRRect - only use quads
-//          -- alternatively add addRRectToPath here
+//      update SkPath.addRRect() to only use quads
 //      add GM and bench
-//   clipping opt
-//      update SkClipStack to perform logic with RRs
 //   further out
-//      add RR rendering shader to Ganesh (akin to cicle drawing code)
-//          - only for simple RRs
 //      detect and triangulate RRectorii rather than falling back to SW in Ganesh
 //
 
 /** \class SkRRect
 
     The SkRRect class represents a rounded rect with a potentially different
     radii for each corner. It does not have a constructor so must be
     initialized with one of the initialization functions (e.g., setEmpty,
@@ -97,18 +91,34 @@ public:
     }
 
     Type type() const { return this->getType(); }
 
     inline bool isEmpty() const { return kEmpty_Type == this->getType(); }
     inline bool isRect() const { return kRect_Type == this->getType(); }
     inline bool isOval() const { return kOval_Type == this->getType(); }
     inline bool isSimple() const { return kSimple_Type == this->getType(); }
+    inline bool isSimpleCircular() const {
+        return this->isSimple() && fRadii[0].fX == fRadii[0].fY;
+    }
     inline bool isComplex() const { return kComplex_Type == this->getType(); }
 
+    bool allCornersCircular() const;
+
+    /**
+     * Are both x-radii the same on the two left corners, and similar for the top, right, and
+     * bottom. When this is the case the four ellipse centers form a rectangle.
+     */
+    bool isNinePatch() const {
+        return fRadii[kUpperLeft_Corner].fX == fRadii[kLowerLeft_Corner].fX &&
+               fRadii[kUpperRight_Corner].fX == fRadii[kLowerRight_Corner].fX &&
+               fRadii[kUpperLeft_Corner].fY == fRadii[kUpperRight_Corner].fY &&
+               fRadii[kLowerLeft_Corner].fY == fRadii[kLowerRight_Corner].fY;
+    }
+
     SkScalar width() const { return fRect.width(); }
     SkScalar height() const { return fRect.height(); }
 
     /**
      * Set this RR to the empty rectangle (0,0,0,0) with 0 x & y radii.
      */
     void setEmpty() {
         fRect.setEmpty();
@@ -224,16 +234,23 @@ public:
     void outset(SkScalar dx, SkScalar dy, SkRRect* dst) const {
         this->inset(-dx, -dy, dst);
     }
     void outset(SkScalar dx, SkScalar dy) {
         this->inset(-dx, -dy, this);
     }
 
     /**
+     * Translate the rrect by (dx, dy).
+     */
+    void offset(SkScalar dx, SkScalar dy) {
+        fRect.offset(dx, dy);
+    }
+
+    /**
      *  Returns true if 'rect' is wholy inside the RR, and both
      *  are not empty.
      */
     bool contains(const SkRect& rect) const;
 
     SkDEBUGCODE(void validate() const;)
 
     enum {
--- a/gfx/skia/trunk/include/core/SkRasterizer.h
+++ b/gfx/skia/trunk/include/core/SkRasterizer.h
@@ -17,27 +17,26 @@ class SkMaskFilter;
 class SkMatrix;
 class SkPath;
 struct SkIRect;
 
 class SK_API SkRasterizer : public SkFlattenable {
 public:
     SK_DECLARE_INST_COUNT(SkRasterizer)
 
-    SkRasterizer() {}
-
     /** Turn the path into a mask, respecting the specified local->device matrix.
     */
     bool rasterize(const SkPath& path, const SkMatrix& matrix,
                    const SkIRect* clipBounds, SkMaskFilter* filter,
                    SkMask* mask, SkMask::CreateMode mode) const;
 
     SK_DEFINE_FLATTENABLE_TYPE(SkRasterizer)
 
 protected:
+    SkRasterizer() {}
     SkRasterizer(SkReadBuffer& buffer) : INHERITED(buffer) {}
 
     virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix,
                              const SkIRect* clipBounds,
                              SkMask* mask, SkMask::CreateMode mode) const;
 
 private:
     typedef SkFlattenable INHERITED;
--- a/gfx/skia/trunk/include/core/SkReadBuffer.h
+++ b/gfx/skia/trunk/include/core/SkReadBuffer.h
@@ -172,22 +172,24 @@ public:
         fBitmapDecoder = bitmapDecoder;
     }
 
     // Default impelementations don't check anything.
     virtual bool validate(bool isValid) { return true; }
     virtual bool isValid() const { return true; }
     virtual bool validateAvailable(size_t size) { return true; }
 
+protected:
+    SkReader32 fReader;
+
 private:
     bool readArray(void* value, size_t size, size_t elementSize);
 
     uint32_t fFlags;
 
-    SkReader32 fReader;
     void* fMemoryPtr;
 
     SkBitmapHeapReader* fBitmapStorage;
     SkTypeface** fTFArray;
     int        fTFCount;
 
     SkTDArray<SkFlattenable::Factory>* fFactoryTDArray;
     SkFlattenable::Factory* fFactoryArray;
deleted file mode 100644
--- a/gfx/skia/trunk/include/core/SkScalarCompare.h
+++ /dev/null
@@ -1,38 +0,0 @@
-
-/*
- * 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.
- */
-
-
-#ifndef SkScalarCompare_DEFINED
-#define SkScalarCompare_DEFINED
-
-#include "SkFloatBits.h"
-#include "SkRect.h"
-
-/** Skia can spend a lot of time just comparing scalars (e.g. quickReject).
-    When scalar==fixed, this is very fast, and when scalar==hardware-float, this
-    is also reasonable, but if scalar==software-float, then each compare can be
-    a function call and take real time. To account for that, we have the flag
-    SK_SCALAR_SLOW_COMPARES.
-
-    If this is defined, we have a special trick where we quickly convert floats
-    to a 2's compliment form, and then treat them as signed 32bit integers. In
-    this form we lose a few subtlties (e.g. NaNs always comparing false) but
-    we gain the speed of integer compares.
- */
-
-#ifdef SK_SCALAR_SLOW_COMPARES
-    typedef int32_t SkScalarCompareType;
-    typedef SkIRect SkRectCompareType;
-    #define SkScalarToCompareType(x)    SkScalarAs2sCompliment(x)
-#else
-    typedef SkScalar SkScalarCompareType;
-    typedef SkRect SkRectCompareType;
-    #define SkScalarToCompareType(x)    (x)
-#endif
-
-#endif
--- a/gfx/skia/trunk/include/core/SkShader.h
+++ b/gfx/skia/trunk/include/core/SkShader.h
@@ -340,18 +340,17 @@ public:
      *  @param src  The bitmap to use inside the shader
      *  @param tmx  The tiling mode to use when sampling the bitmap in the x-direction.
      *  @param tmy  The tiling mode to use when sampling the bitmap in the y-direction.
      *  @return     Returns a new shader object. Note: this function never returns null.
     */
     static SkShader* CreateBitmapShader(const SkBitmap& src,
                                         TileMode tmx, TileMode tmy);
 
-    SkDEVCODE(virtual void toString(SkString* str) const;)
-
+    SK_TO_STRING_VIRT()
     SK_DEFINE_FLATTENABLE_TYPE(SkShader)
 
 protected:
     enum MatrixClass {
         kLinear_MatrixClass,            // no perspective
         kFixedStepInX_MatrixClass,      // fast perspective, need to call fixedStepInX() each scanline
         kPerspective_MatrixClass        // slow perspective, need to mappoints each pixel
     };
@@ -366,16 +365,12 @@ protected:
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 private:
     SkMatrix            fLocalMatrix;
     SkMatrix            fTotalInverse;
     uint8_t             fPaintAlpha;
     uint8_t             fTotalInverseClass;
     SkDEBUGCODE(SkBool8 fInSetContext;)
 
-    static SkShader* CreateBitmapShader(const SkBitmap& src,
-                                        TileMode, TileMode,
-                                        void* storage, size_t storageSize);
-    friend class SkAutoBitmapShaderInstall;
     typedef SkFlattenable INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/core/SkStream.h
+++ b/gfx/skia/trunk/include/core/SkStream.h
@@ -184,43 +184,51 @@ public:
         @param buffer the address of at least size bytes to be written to the stream
         @param size The number of bytes in buffer to write to the stream
         @return true on success
     */
     virtual bool write(const void* buffer, size_t size) = 0;
     virtual void newline();
     virtual void flush();
 
+    virtual size_t bytesWritten() const = 0;
+
     // helpers
 
     bool    write8(U8CPU);
     bool    write16(U16CPU);
     bool    write32(uint32_t);
 
     bool    writeText(const char text[]);
     bool    writeDecAsText(int32_t);
     bool    writeBigDecAsText(int64_t, int minDigits = 0);
     bool    writeHexAsText(uint32_t, int minDigits = 0);
     bool    writeScalarAsText(SkScalar);
 
     bool    writeBool(bool v) { return this->write8(v); }
     bool    writeScalar(SkScalar);
     bool    writePackedUInt(size_t);
 
-    bool writeStream(SkStream* input, size_t length);
+    bool    writeStream(SkStream* input, size_t length);
 
     /**
      * Append an SkData object to the stream, such that it can be read
      * out of the stream using SkStream::readData().
      *
      * Note that the encoding method used to write the SkData object
      * to the stream may change over time.  This method DOES NOT
      * just write the raw content of the SkData object to the stream.
      */
     bool writeData(const SkData*);
+
+    /**
+     * This returns the number of bytes in the stream required to store
+     * 'value'.
+     */
+    static int SizeOfPackedUInt(size_t value);
 };
 
 ////////////////////////////////////////////////////////////////////////////////////////
 
 #include "SkString.h"
 #include <stdio.h>
 
 struct SkFILE;
@@ -360,30 +368,31 @@ public:
     virtual ~SkFILEWStream();
 
     /** Returns true if the current path could be opened.
     */
     bool isValid() const { return fFILE != NULL; }
 
     virtual bool write(const void* buffer, size_t size) SK_OVERRIDE;
     virtual void flush() SK_OVERRIDE;
+    virtual size_t bytesWritten() const SK_OVERRIDE;
 
 private:
     SkFILE* fFILE;
 
     typedef SkWStream INHERITED;
 };
 
 class SkMemoryWStream : public SkWStream {
 public:
     SK_DECLARE_INST_COUNT(SkMemoryWStream)
 
     SkMemoryWStream(void* buffer, size_t size);
     virtual bool write(const void* buffer, size_t size) SK_OVERRIDE;
-    size_t bytesWritten() const { return fBytesWritten; }
+    virtual size_t bytesWritten() const SK_OVERRIDE { return fBytesWritten; }
 
 private:
     char*   fBuffer;
     size_t  fMaxLength;
     size_t  fBytesWritten;
 
     typedef SkWStream INHERITED;
 };
@@ -391,22 +400,22 @@ private:
 class SK_API SkDynamicMemoryWStream : public SkWStream {
 public:
     SK_DECLARE_INST_COUNT(SkDynamicMemoryWStream)
 
     SkDynamicMemoryWStream();
     virtual ~SkDynamicMemoryWStream();
 
     virtual bool write(const void* buffer, size_t size) SK_OVERRIDE;
+    virtual size_t bytesWritten() const SK_OVERRIDE { return fBytesWritten; }
     // random access write
     // modifies stream and returns true if offset + size is less than or equal to getOffset()
     bool write(const void* buffer, size_t offset, size_t size);
     bool read(void* buffer, size_t offset, size_t size);
     size_t getOffset() const { return fBytesWritten; }
-    size_t bytesWritten() const { return fBytesWritten; }
 
     // copy what has been written to the stream into dst
     void copyTo(void* dst) const;
 
     /**
      *  Return a copy of the data written so far. This call is responsible for
      *  calling unref() when they are finished with the data.
      */
@@ -432,22 +441,25 @@ private:
     friend class SkBlockMemoryRefCnt;
 
     typedef SkWStream INHERITED;
 };
 
 
 class SK_API SkDebugWStream : public SkWStream {
 public:
+    SkDebugWStream() : fBytesWritten(0) {}
     SK_DECLARE_INST_COUNT(SkDebugWStream)
 
     // overrides
     virtual bool write(const void* buffer, size_t size) SK_OVERRIDE;
     virtual void newline() SK_OVERRIDE;
+    virtual size_t bytesWritten() const SK_OVERRIDE { return fBytesWritten; }
 
 private:
+    size_t fBytesWritten;
     typedef SkWStream INHERITED;
 };
 
 // for now
 typedef SkFILEStream SkURLStream;
 
 #endif
--- a/gfx/skia/trunk/include/core/SkSurface.h
+++ b/gfx/skia/trunk/include/core/SkSurface.h
@@ -47,20 +47,17 @@ public:
     static SkSurface* NewRaster(const SkImageInfo&);
 
     /**
      *  Helper version of NewRaster. It creates a SkImageInfo with the
      *  specified width and height, and populates the rest of info to match
      *  pixels in SkPMColor format.
      */
     static SkSurface* NewRasterPMColor(int width, int height) {
-        SkImageInfo info = {
-            width, height, kPMColor_SkColorType, kPremul_SkAlphaType
-        };
-        return NewRaster(info);
+        return NewRaster(SkImageInfo::MakeN32Premul(width, height));
     }
 
     /**
      *  Return a new surface whose contents will be recorded into a picture.
      *  When this surface is drawn into another canvas, its contents will be
      *  "replayed" into that canvas.
      */
     static SkSurface* NewPicture(int width, int height);
@@ -146,16 +143,28 @@ public:
      *  Thought the caller could get a snapshot image explicitly, and draw that,
      *  it seems that directly drawing a surface into another canvas might be
      *  a common pattern, and that we could possibly be more efficient, since
      *  we'd know that the "snapshot" need only live until we've handed it off
      *  to the canvas.
      */
     void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*);
 
+    /**
+     *  If the surface has direct access to its pixels (i.e. they are in local
+     *  RAM) return the const-address of those pixels, and if not null, return
+     *  the ImageInfo and rowBytes. The returned address is only valid while
+     *  the surface object is in scope, and no API call is made on the surface
+     *  or its canvas.
+     *
+     *  On failure, returns NULL and the info and rowBytes parameters are
+     *  ignored.
+     */
+    const void* peekPixels(SkImageInfo* info, size_t* rowBytes);
+
 protected:
     SkSurface(int width, int height);
     SkSurface(const SkImageInfo&);
 
     // called by subclass if their contents have changed
     void dirtyGenerationID() {
         fGenerationID = 0;
     }
--- a/gfx/skia/trunk/include/core/SkTDArray.h
+++ b/gfx/skia/trunk/include/core/SkTDArray.h
@@ -153,38 +153,23 @@ public:
 
     /**
      *  Sets the number of elements in the array.
      *  If the array does not have space for count elements, it will increase
      *  the storage allocated to some amount greater than that required.
      *  It will never shrink the shrink the storage.
      */
     void setCount(int count) {
-        //  TODO(mtklein): eliminate this method, setCountExact -> setCount
         SkASSERT(count >= 0);
         if (count > fReserve) {
             this->resizeStorageToAtLeast(count);
         }
         fCount = count;
     }
 
-    /**
-     *  Sets the number of elements in the array.
-     *  If the array does not have space for count elements, it will increase
-     *  the storage allocated to exactly the amount required, with no remaining
-     *  reserved space.
-     *  It will never shrink the shrink the storage.
-     */
-    void setCountExact(int count) {
-        if (count > fReserve) {
-            this->resizeStorageToExact(count);
-        }
-        fCount = count;
-    }
-
     void setReserve(int reserve) {
         if (reserve > fReserve) {
             this->resizeStorageToAtLeast(reserve);
         }
     }
 
     T* prepend() {
         this->adjustCount(1);
@@ -378,40 +363,27 @@ private:
      *  Adjusts the number of elements in the array.
      *  This is the same as calling setCount(count() + delta).
      */
     void adjustCount(int delta) {
         this->setCount(fCount + delta);
     }
 
     /**
-     *  This resizes the storage to *exactly* count elements, growing or
-     *  shrinking the allocation as needed. It does not ASSERT anything about
-     *  the previous allocation size, or about fCount.
-     *
-     *  note: does NOT modify fCount
-     */
-    void resizeStorageToExact(int count) {
-        SkASSERT(count >= 0);
-        fArray = (T*)sk_realloc_throw(fArray, count * sizeof(T));
-#ifdef SK_DEBUG
-        fData = (ArrayT*)fArray;
-#endif
-        fReserve = count;
-    }
-
-    /**
      *  Increase the storage allocation such that it can hold (fCount + extra)
      *  elements.
      *  It never shrinks the allocation, and it may increase the allocation by
      *  more than is strictly required, based on a private growth heuristic.
      *
      *  note: does NOT modify fCount
      */
     void resizeStorageToAtLeast(int count) {
         SkASSERT(count > fReserve);
-        int space = count + 4;
-        space += space>>2;
-        this->resizeStorageToExact(space);
+        fReserve = count + 4;
+        fReserve += fReserve / 4;
+        fArray = (T*)sk_realloc_throw(fArray, fReserve * sizeof(T));
+#ifdef SK_DEBUG
+        fData = (ArrayT*)fArray;
+#endif
     }
 };
 
 #endif
--- a/gfx/skia/trunk/include/core/SkTLazy.h
+++ b/gfx/skia/trunk/include/core/SkTLazy.h
@@ -70,16 +70,26 @@ public:
             *fPtr = src;
         } else {
             fPtr = new (SkTCast<T*>(fStorage)) T(src);
         }
         return fPtr;
     }
 
     /**
+     * Destroy the lazy object (if it was created via init() or set())
+     */
+    void reset() {
+        if (this->isValid()) {
+            fPtr->~T();
+            fPtr = NULL;
+        }
+    }
+
+    /**
      *  Returns true if a valid object has been initialized in the SkTLazy,
      *  false otherwise.
      */
     bool isValid() const { return NULL != fPtr; }
 
     /**
      * Returns the object. This version should only be called when the caller
      * knows that the object has been initialized.
--- a/gfx/skia/trunk/include/core/SkTemplates.h
+++ b/gfx/skia/trunk/include/core/SkTemplates.h
@@ -6,16 +6,18 @@
  * found in the LICENSE file.
  */
 
 
 #ifndef SkTemplates_DEFINED
 #define SkTemplates_DEFINED
 
 #include "SkTypes.h"
+#include <limits>
+#include <limits.h>
 #include <new>
 
 /** \file SkTemplates.h
 
     This file contains light-weight template classes for type-safe and exception-safe
     resource management.
 */
 
@@ -59,16 +61,25 @@ template <typename D, typename S> static
 template <typename D, typename S> static D* SkTAddOffset(S* ptr, size_t byteOffset) {
     // The intermediate char* has the same const-ness as D as this produces better error messages.
     // This relies on the fact that reinterpret_cast can add constness, but cannot remove it.
     return reinterpret_cast<D*>(
         reinterpret_cast<typename SkTConstType<char, SkTIsConst<D>::value>::type*>(ptr) + byteOffset
     );
 }
 
+/** SkTSetBit<N, T>::value is a T with the Nth bit set. */
+template<unsigned N, typename T = uintmax_t> struct SkTSetBit {
+    static const T value = static_cast<T>(1) << N;
+    SK_COMPILE_ASSERT(sizeof(T)*CHAR_BIT > N, SkTSetBit_N_too_large);
+    SK_COMPILE_ASSERT(std::numeric_limits<T>::is_integer, SkTSetBit_T_must_be_integer);
+    SK_COMPILE_ASSERT(!std::numeric_limits<T>::is_signed, SkTSetBit_T_must_be_unsigned);
+    SK_COMPILE_ASSERT(std::numeric_limits<T>::radix == 2, SkTSetBit_T_radix_must_be_2);
+};
+
 /** \class SkAutoTCallVProc
 
     Call a function when this goes out of scope. The template uses two
     parameters, the object, and a function that is to be called in the destructor.
     If detach() is called, the object reference is set to null. If the object
     reference is null when the destructor is called, we do not call the
     function.
 */
deleted file mode 100644
--- a/gfx/skia/trunk/include/core/SkThread_platform.h
+++ /dev/null
@@ -1,194 +0,0 @@
-
-/*
- * 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.
- */
-
-
-#ifndef SkThread_platform_DEFINED
-#define SkThread_platform_DEFINED
-
-#if defined(SK_BUILD_FOR_ANDROID)
-
-#if !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
-
-#include <stdint.h>
-
-/* Just use the GCC atomic intrinsics. They're supported by the NDK toolchain,
- * have reasonable performance, and provide full memory barriers
- */
-static inline __attribute__((always_inline)) int32_t sk_atomic_inc(int32_t *addr) {
-    return __sync_fetch_and_add(addr, 1);
-}
-
-static inline __attribute__((always_inline)) int32_t sk_atomic_add(int32_t *addr, int32_t inc) {
-    return __sync_fetch_and_add(addr, inc);
-}
-
-static inline __attribute__((always_inline)) int32_t sk_atomic_dec(int32_t *addr) {
-    return __sync_fetch_and_add(addr, -1);
-}
-static inline __attribute__((always_inline)) void sk_membar_aquire__after_atomic_dec() { }
-
-static inline __attribute__((always_inline)) int32_t sk_atomic_conditional_inc(int32_t* addr) {
-    int32_t value = *addr;
-
-    while (true) {
-        if (value == 0) {
-            return 0;
-        }
-
-        int32_t before = __sync_val_compare_and_swap(addr, value, value + 1);
-
-        if (before == value) {
-            return value;
-        } else {
-            value = before;
-        }
-    }
-}
-static inline __attribute__((always_inline)) void sk_membar_aquire__after_atomic_conditional_inc() { }
-
-#else // SK_BUILD_FOR_ANDROID_FRAMEWORK
-
-/* The platform atomics operations are slightly more efficient than the
- * GCC built-ins, so use them.
- */
-#include <utils/Atomic.h>
-
-#define sk_atomic_inc(addr)         android_atomic_inc(addr)
-#define sk_atomic_add(addr, inc)    android_atomic_add(inc, addr)
-#define sk_atomic_dec(addr)         android_atomic_dec(addr)
-
-static inline __attribute__((always_inline)) void sk_membar_aquire__after_atomic_dec() {
-    //HACK: Android is actually using full memory barriers.
-    //      Should this change, uncomment below.
-    //int dummy;
-    //android_atomic_aquire_store(0, &dummy);
-}
-static inline __attribute__((always_inline)) int32_t sk_atomic_conditional_inc(int32_t* addr) {
-    while (true) {
-        int32_t value = *addr;
-        if (value == 0) {
-            return 0;
-        }
-        if (0 == android_atomic_release_cas(value, value + 1, addr)) {
-            return value;
-        }
-    }
-}
-static inline __attribute__((always_inline)) void sk_membar_aquire__after_atomic_conditional_inc() {
-    //HACK: Android is actually using full memory barriers.
-    //      Should this change, uncomment below.
-    //int dummy;
-    //android_atomic_aquire_store(0, &dummy);
-}
-
-#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK
-
-#else  // !SK_BUILD_FOR_ANDROID
-
-/** Implemented by the porting layer, this function adds one to the int
-    specified by the address (in a thread-safe manner), and returns the
-    previous value.
-    No additional memory barrier is required.
-    This must act as a compiler barrier.
-*/
-SK_API int32_t sk_atomic_inc(int32_t* addr);
-
-/** Implemented by the porting layer, this function adds inc to the int
-    specified by the address (in a thread-safe manner), and returns the
-    previous value.
-    No additional memory barrier is required.
-    This must act as a compiler barrier.
- */
-SK_API int32_t sk_atomic_add(int32_t* addr, int32_t inc);
-
-/** Implemented by the porting layer, this function subtracts one from the int
-    specified by the address (in a thread-safe manner), and returns the
-    previous value.
-    Expected to act as a release (SL/S) memory barrier and a compiler barrier.
-*/
-SK_API int32_t sk_atomic_dec(int32_t* addr);
-/** If sk_atomic_dec does not act as an aquire (L/SL) barrier, this is expected
-    to act as an aquire (L/SL) memory barrier and as a compiler barrier.
-*/
-SK_API void sk_membar_aquire__after_atomic_dec();
-
-/** Implemented by the porting layer, this function adds one to the int
-    specified by the address iff the int specified by the address is not zero
-    (in a thread-safe manner), and returns the previous value.
-    No additional memory barrier is required.
-    This must act as a compiler barrier.
-*/
-SK_API int32_t sk_atomic_conditional_inc(int32_t*);
-/** If sk_atomic_conditional_inc does not act as an aquire (L/SL) barrier, this
-    is expected to act as an aquire (L/SL) memory barrier and as a compiler
-    barrier.
-*/
-SK_API void sk_membar_aquire__after_atomic_conditional_inc();
-
-#endif // !SK_BUILD_FOR_ANDROID
-
-#ifdef SK_USE_POSIX_THREADS
-
-#include <pthread.h>
-
-// A SkBaseMutex is a POD structure that can be directly initialized
-// at declaration time with SK_DECLARE_STATIC/GLOBAL_MUTEX. This avoids the
-// generation of a static initializer in the final machine code (and
-// a corresponding static finalizer).
-//
-struct SkBaseMutex {
-    void    acquire() { pthread_mutex_lock(&fMutex); }
-    void    release() { pthread_mutex_unlock(&fMutex); }
-    pthread_mutex_t  fMutex;
-};
-
-// Using POD-style initialization prevents the generation of a static initializer
-// and keeps the acquire() implementation small and fast.
-#define SK_DECLARE_STATIC_MUTEX(name)   static SkBaseMutex  name = { PTHREAD_MUTEX_INITIALIZER }
-
-// Special case used when the static mutex must be available globally.
-#define SK_DECLARE_GLOBAL_MUTEX(name)   SkBaseMutex  name = { PTHREAD_MUTEX_INITIALIZER }
-
-// A normal mutex that requires to be initialized through normal C++ construction,
-// i.e. when it's a member of another class, or allocated on the heap.
-class SK_API SkMutex : public SkBaseMutex, SkNoncopyable {
-public:
-    SkMutex();
-    ~SkMutex();
-};
-
-#else // !SK_USE_POSIX_THREADS
-
-// In the generic case, SkBaseMutex and SkMutex are the same thing, and we
-// can't easily get rid of static initializers.
-//
-class SK_API SkMutex : SkNoncopyable {
-public:
-    SkMutex();
-    ~SkMutex();
-
-    void    acquire();
-    void    release();
-
-private:
-    bool fIsGlobal;
-    enum {
-        kStorageIntCount = 64
-    };
-    uint32_t    fStorage[kStorageIntCount];
-};
-
-typedef SkMutex SkBaseMutex;
-
-#define SK_DECLARE_STATIC_MUTEX(name)           static SkBaseMutex  name
-#define SK_DECLARE_GLOBAL_MUTEX(name)           SkBaseMutex  name
-
-#endif // !SK_USE_POSIX_THREADS
-
-
-#endif
--- a/gfx/skia/trunk/include/core/SkTypes.h
+++ b/gfx/skia/trunk/include/core/SkTypes.h
@@ -110,30 +110,47 @@ inline void operator delete(void* p) {
     #define SkPARAM(var)
 
     // unlike SkASSERT, this guy executes its condition in the non-debug build
     #define SkAssertResult(cond)        cond
 #endif
 
 #ifdef SK_DEVELOPER
     #define SkDEVCODE(code)             code
+#else
+    #define SkDEVCODE(code)
+#endif
+
+#ifdef SK_IGNORE_TO_STRING
+    #define SK_TO_STRING_NONVIRT()
+    #define SK_TO_STRING_VIRT()
+    #define SK_TO_STRING_PUREVIRT()
+    #define SK_TO_STRING_OVERRIDE()
+#else
     // the 'toString' helper functions convert Sk* objects to human-readable
     // form in developer mode
-    #define SK_DEVELOPER_TO_STRING()    virtual void toString(SkString* str) const SK_OVERRIDE;
-#else
-    #define SkDEVCODE(code)
-    #define SK_DEVELOPER_TO_STRING()
+    #define SK_TO_STRING_NONVIRT() void toString(SkString* str) const;
+    #define SK_TO_STRING_VIRT() virtual void toString(SkString* str) const;
+    #define SK_TO_STRING_PUREVIRT() virtual void toString(SkString* str) const = 0;
+    #define SK_TO_STRING_OVERRIDE() virtual void toString(SkString* str) const SK_OVERRIDE;
 #endif
 
 template <bool>
 struct SkCompileAssert {
 };
 
+// Uses static_cast<bool>(expr) instead of bool(expr) due to
+// https://connect.microsoft.com/VisualStudio/feedback/details/832915
+
+// The extra parentheses in SkCompileAssert<(...)> are a work around for
+// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57771
+// which was fixed in gcc 4.8.2.
 #define SK_COMPILE_ASSERT(expr, msg) \
-    typedef SkCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] SK_UNUSED
+    typedef SkCompileAssert<(static_cast<bool>(expr))> \
+            msg[static_cast<bool>(expr) ? 1 : -1] SK_UNUSED
 
 /*
  *  Usage:  SK_MACRO_CONCAT(a, b)   to construct the symbol ab
  *
  *  SK_MACRO_CONCAT_IMPL_PRIV just exists to make this work. Do not use directly
  *
  */
 #define SK_MACRO_CONCAT(X, Y)           SK_MACRO_CONCAT_IMPL_PRIV(X, Y)
@@ -214,25 +231,27 @@ typedef uint8_t SkBool8;
     SK_API int8_t      SkToS8(intmax_t);
     SK_API uint8_t     SkToU8(uintmax_t);
     SK_API int16_t     SkToS16(intmax_t);
     SK_API uint16_t    SkToU16(uintmax_t);
     SK_API int32_t     SkToS32(intmax_t);
     SK_API uint32_t    SkToU32(uintmax_t);
     SK_API int         SkToInt(intmax_t);
     SK_API unsigned    SkToUInt(uintmax_t);
+    SK_API size_t      SkToSizeT(uintmax_t);
 #else
     #define SkToS8(x)   ((int8_t)(x))
     #define SkToU8(x)   ((uint8_t)(x))
     #define SkToS16(x)  ((int16_t)(x))
     #define SkToU16(x)  ((uint16_t)(x))
     #define SkToS32(x)  ((int32_t)(x))
     #define SkToU32(x)  ((uint32_t)(x))
     #define SkToInt(x)  ((int)(x))
     #define SkToUInt(x) ((unsigned)(x))
+    #define SkToSizeT(x) ((size_t)(x))
 #endif
 
 /** Returns 0 or 1 based on the condition
 */
 #define SkToBool(cond)  ((cond) != 0)
 
 #define SK_MaxS16   32767
 #define SK_MinS16   -32767
--- a/gfx/skia/trunk/include/core/SkWriter32.h
+++ b/gfx/skia/trunk/include/core/SkWriter32.h
@@ -5,55 +5,52 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
 
 
 #ifndef SkWriter32_DEFINED
 #define SkWriter32_DEFINED
 
+#include "SkData.h"
 #include "SkMatrix.h"
 #include "SkPath.h"
 #include "SkPoint.h"
 #include "SkRRect.h"
 #include "SkRect.h"
 #include "SkRegion.h"
 #include "SkScalar.h"
 #include "SkStream.h"
-#include "SkTDArray.h"
+#include "SkTemplates.h"
 #include "SkTypes.h"
 
 class SkWriter32 : SkNoncopyable {
 public:
     /**
      *  The caller can specify an initial block of storage, which the caller manages.
      *
      *  SkWriter32 will try to back reserve and write calls with this external storage until the
      *  first time an allocation doesn't fit.  From then it will use dynamically allocated storage.
      *  This used to be optional behavior, but pipe now relies on it.
      */
-    SkWriter32(void* external = NULL, size_t externalBytes = 0)
-        : fData(0)
-        , fCapacity(0)
-        , fUsed(0)
-        , fExternal(0)
-    {
+    SkWriter32(void* external = NULL, size_t externalBytes = 0) {
         this->reset(external, externalBytes);
     }
 
     // return the current offset (will always be a multiple of 4)
     size_t bytesWritten() const { return fUsed; }
 
     SK_ATTR_DEPRECATED("use bytesWritten")
     size_t size() const { return this->bytesWritten(); }
 
     void reset(void* external = NULL, size_t externalBytes = 0) {
         SkASSERT(SkIsAlign4((uintptr_t)external));
         SkASSERT(SkIsAlign4(externalBytes));
 
+        fSnapshot.reset(NULL);
         fData = (uint8_t*)external;
         fCapacity = externalBytes;
         fUsed = 0;
         fExternal = external;
     }
 
     // Returns the current buffer.
     // The pointer may be invalidated by any future write calls.
@@ -70,33 +67,34 @@ public:
             this->growToAtLeast(totalRequired);
         }
         fUsed = totalRequired;
         return (uint32_t*)(fData + offset);
     }
 
     /**
      *  Read a T record at offset, which must be a multiple of 4. Only legal if the record
-     *  was writtern atomically using the write methods below.
+     *  was written atomically using the write methods below.
      */
     template<typename T>
     const T& readTAt(size_t offset) const {
         SkASSERT(SkAlign4(offset) == offset);
         SkASSERT(offset < fUsed);
         return *(T*)(fData + offset);
     }
 
     /**
      *  Overwrite a T record at offset, which must be a multiple of 4. Only legal if the record
-     *  was writtern atomically using the write methods below.
+     *  was written atomically using the write methods below.
      */
     template<typename T>
     void overwriteTAt(size_t offset, const T& value) {
         SkASSERT(SkAlign4(offset) == offset);
         SkASSERT(offset < fUsed);
+        SkASSERT(fSnapshot.get() == NULL);
         *(T*)(fData + offset) = value;
     }
 
     bool writeBool(bool value) {
         this->write32(value);
         return value;
     }
 
@@ -230,24 +228,37 @@ public:
     }
 
     // read from the stream, and write up to length bytes. Return the actual
     // number of bytes written.
     size_t readFromStream(SkStream* stream, size_t length) {
         return stream->read(this->reservePad(length), length);
     }
 
+    /**
+     *  Captures a snapshot of the data as it is right now, and return it.
+     *  Multiple calls without intervening writes may return the same SkData,
+     *  but this is not guaranteed.
+     *  Future appends will not affect the returned buffer.
+     *  It is illegal to call overwriteTAt after this without an intervening
+     *  append. It may cause the snapshot buffer to be corrupted.
+     *  Callers must unref the returned SkData.
+     *  This is not thread safe, it should only be called on the writing thread,
+     *  the result however can be shared across threads.
+     */
+    SkData* snapshotAsData() const;
 private:
     void growToAtLeast(size_t size);
 
-    uint8_t* fData;                // Points to either fInternal or fExternal.
-    size_t fCapacity;              // Number of bytes we can write to fData.
-    size_t fUsed;                  // Number of bytes written.
-    void* fExternal;               // Unmanaged memory block.
-    SkTDArray<uint8_t> fInternal;  // Managed memory block.
+    uint8_t* fData;                    // Points to either fInternal or fExternal.
+    size_t fCapacity;                  // Number of bytes we can write to fData.
+    size_t fUsed;                      // Number of bytes written.
+    void* fExternal;                   // Unmanaged memory block.
+    SkAutoTMalloc<uint8_t> fInternal;  // Managed memory block.
+    SkAutoTUnref<SkData> fSnapshot;    // Holds the result of last asData.
 };
 
 /**
  *  Helper class to allocated SIZE bytes as part of the writer, and to provide
  *  that storage to the constructor as its initial storage buffer.
  *
  *  This wrapper ensures proper alignment rules are met for the storage.
  */
--- a/gfx/skia/trunk/include/core/SkXfermode.h
+++ b/gfx/skia/trunk/include/core/SkXfermode.h
@@ -27,18 +27,16 @@ class SkString;
  *
  *  All subclasses are required to be reentrant-safe : it must be legal to share
  *  the same instance between several threads.
  */
 class SK_API SkXfermode : public SkFlattenable {
 public:
     SK_DECLARE_INST_COUNT(SkXfermode)
 
-    SkXfermode() {}
-
     virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const;
     virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const;
     virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const;
 
     /** Enum of possible coefficients to describe some xfermodes
@@ -208,33 +206,38 @@ public:
         simply test the return value.  effect, src, and dst must all be NULL or all non-NULL.
      */
     static bool AsNewEffectOrCoeff(SkXfermode*,
                                    GrEffectRef** effect,
                                    Coeff* src,
                                    Coeff* dst,
                                    GrTexture* background = NULL);
 
-    SkDEVCODE(virtual void toString(SkString* str) const = 0;)
+    SK_TO_STRING_PUREVIRT()
     SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
     SK_DEFINE_FLATTENABLE_TYPE(SkXfermode)
 
 protected:
     SkXfermode(SkReadBuffer& rb) : SkFlattenable(rb) {}
 
     /** The default implementation of xfer32/xfer16/xferA8 in turn call this
         method, 1 color at a time (upscaled to a SkPMColor). The default
         implmentation of this method just returns dst. If performance is
         important, your subclass should override xfer32/xfer16/xferA8 directly.
 
         This method will not be called directly by the client, so it need not
         be implemented if your subclass has overridden xfer32/xfer16/xferA8
     */
     virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkXfermode() {}
+
 private:
     enum {
         kModeCount = kLastMode + 1
     };
 
     friend class SkGraphics;
     static void Term();
 
@@ -245,41 +248,48 @@ private:
 
 /** \class SkProcXfermode
 
     SkProcXfermode is a xfermode that applies the specified proc to its colors.
     This class is not exported to java.
 */
 class SkProcXfermode : public SkXfermode {
 public:
-    SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {}
+    static SkProcXfermode* Create(SkXfermodeProc proc) {
+        return SkNEW_ARGS(SkProcXfermode, (proc));
+    }
 
     // overrides from SkXfermode
     virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const SK_OVERRIDE;
     virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const SK_OVERRIDE;
     virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const SK_OVERRIDE;
 
-    SK_DEVELOPER_TO_STRING()
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcXfermode)
 
 protected:
     SkProcXfermode(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
     // allow subclasses to update this after we unflatten
     void setProc(SkXfermodeProc proc) {
         fProc = proc;
     }
 
     SkXfermodeProc getProc() const {
         return fProc;
     }
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {}
+
 private:
     SkXfermodeProc  fProc;
 
     typedef SkXfermode INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/device/xps/SkXPSDevice.h
+++ b/gfx/skia/trunk/include/device/xps/SkXPSDevice.h
@@ -62,18 +62,16 @@ public:
         const SkRect* mediaBox = NULL,
         const SkRect* bleedBox = NULL,
         const SkRect* artBox = NULL,
         const SkRect* cropBox = NULL);
 
     virtual bool endSheet();
     virtual bool endPortfolio();
 
-    virtual uint32_t getDeviceCapabilities() SK_OVERRIDE;
-
 protected:
     virtual void clear(SkColor color) SK_OVERRIDE;
 
     virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
 
     virtual void drawPoints(
         const SkDraw&,
         SkCanvas::PointMode mode,
@@ -307,21 +305,17 @@ private:
         const SkIRect& clip, SkIRect* clipIRect);
 
     HRESULT applyMask(
         const SkDraw& d,
         const SkMask& mask,
         const SkVector& ppuScale,
         IXpsOMPath* shadedPath);
 
-    // override from SkBaseDevice
-    virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
-                                                   int width, int height,
-                                                   bool isOpaque,
-                                                   Usage usage) SK_OVERRIDE;
+    virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE;
 
     // Disable the default copy and assign implementation.
     SkXPSDevice(const SkXPSDevice&);
     void operator=(const SkXPSDevice&);
 
     typedef SkBitmapDevice INHERITED;
 };
 
--- a/gfx/skia/trunk/include/effects/Sk1DPathEffect.h
+++ b/gfx/skia/trunk/include/effects/Sk1DPathEffect.h
@@ -47,31 +47,39 @@ public:
 
     /** Dash by replicating the specified path.
         @param path The path to replicate (dash)
         @param advance The space between instances of path
         @param phase distance (mod advance) along path for its initial position
         @param style how to transform path at each point (based on the current
                      position and tangent)
     */
-    SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Style);
+    static SkPath1DPathEffect* Create(const SkPath& path, SkScalar advance, SkScalar phase,
+                                      Style style) {
+        return SkNEW_ARGS(SkPath1DPathEffect, (path, advance, phase, style));
+    }
 
     virtual bool filterPath(SkPath*, const SkPath&,
                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect)
 
 protected:
     SkPath1DPathEffect(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
     // overrides from Sk1DPathEffect
     virtual SkScalar begin(SkScalar contourLength) const SK_OVERRIDE;
     virtual SkScalar next(SkPath*, SkScalar, SkPathMeasure&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Style);
+
 private:
     SkPath      fPath;          // copied from constructor
     SkScalar    fAdvance;       // copied from constructor
     SkScalar    fInitialOffset; // computed from phase
     Style       fStyle;         // copied from constructor
 
     typedef Sk1DPathEffect INHERITED;
 };
--- a/gfx/skia/trunk/include/effects/Sk2DPathEffect.h
+++ b/gfx/skia/trunk/include/effects/Sk2DPathEffect.h
@@ -9,17 +9,19 @@
 #define Sk2DPathEffect_DEFINED
 
 #include "SkPath.h"
 #include "SkPathEffect.h"
 #include "SkMatrix.h"
 
 class SK_API Sk2DPathEffect : public SkPathEffect {
 public:
-    Sk2DPathEffect(const SkMatrix& mat);
+    static Sk2DPathEffect* Create(const SkMatrix& mat) {
+        return SkNEW_ARGS(Sk2DPathEffect, (mat));
+    }
 
     virtual bool filterPath(SkPath*, const SkPath&,
                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk2DPathEffect)
 
 protected:
     /** New virtual, to be overridden by subclasses.
@@ -39,66 +41,85 @@ protected:
     virtual void nextSpan(int u, int v, int ucount, SkPath* dst) const;
 
     const SkMatrix& getMatrix() const { return fMatrix; }
 
     // protected so that subclasses can call this during unflattening
     Sk2DPathEffect(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    Sk2DPathEffect(const SkMatrix& mat);
+
 private:
     SkMatrix    fMatrix, fInverse;
     bool        fMatrixIsInvertible;
 
     // illegal
     Sk2DPathEffect(const Sk2DPathEffect&);
     Sk2DPathEffect& operator=(const Sk2DPathEffect&);
 
     friend class Sk2DPathEffectBlitter;
     typedef SkPathEffect INHERITED;
 };
 
 class SK_API SkLine2DPathEffect : public Sk2DPathEffect {
 public:
-    SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
-    : Sk2DPathEffect(matrix), fWidth(width) {}
+    static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) {
+        return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix));
+    }
 
     virtual bool filterPath(SkPath* dst, const SkPath& src,
                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect)
 
 protected:
     virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE;
 
     SkLine2DPathEffect(SkReadBuffer&);
 
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
+    : Sk2DPathEffect(matrix), fWidth(width) {}
+
 private:
     SkScalar fWidth;
 
     typedef Sk2DPathEffect INHERITED;
 };
 
 class SK_API SkPath2DPathEffect : public Sk2DPathEffect {
 public:
     /**
      *  Stamp the specified path to fill the shape, using the matrix to define
      *  the latice.
      */
-    SkPath2DPathEffect(const SkMatrix&, const SkPath&);
+    static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path) {
+        return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path));
+    }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect)
 
 protected:
     SkPath2DPathEffect(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
     virtual void next(const SkPoint&, int u, int v, SkPath*) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkPath2DPathEffect(const SkMatrix&, const SkPath&);
+
 private:
     SkPath  fPath;
 
     typedef Sk2DPathEffect INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkAvoidXfermode.h
+++ b/gfx/skia/trunk/include/effects/SkAvoidXfermode.h
@@ -32,33 +32,40 @@ public:
                Tolerance near 0: avoid any colors even remotely similar to the op-color
                Tolerance near 255: avoid only colors nearly identical to the op-color
 
         Target: In this mode, drawing only occurs on destination pixels that
                 are similar to the op-color
                 Tolerance near 0: draw only on colors that are nearly identical to the op-color
                 Tolerance near 255: draw on any colors even remotely similar to the op-color
      */
-    SkAvoidXfermode(SkColor opColor, U8CPU tolerance, Mode mode);
+    static SkAvoidXfermode* Create(SkColor opColor, U8CPU tolerance, Mode mode) {
+        return SkNEW_ARGS(SkAvoidXfermode, (opColor, tolerance, mode));
+    }
 
     // overrides from SkXfermode
     virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const SK_OVERRIDE;
     virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const SK_OVERRIDE;
     virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const SK_OVERRIDE;
 
-    SK_DEVELOPER_TO_STRING()
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAvoidXfermode)
 
 protected:
     SkAvoidXfermode(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkAvoidXfermode(SkColor opColor, U8CPU tolerance, Mode mode);
+
 private:
     SkColor     fOpColor;
     uint32_t    fDistMul;   // x.14
     Mode        fMode;
 
     typedef SkXfermode INHERITED;
 };
 
--- a/gfx/skia/trunk/include/effects/SkBicubicImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkBicubicImageFilter.h
@@ -15,40 +15,40 @@
 
 /*! \class SkBicubicImageFilter
     Bicubic resampling image filter.  This filter does a 16-tap bicubic
     filter using the given matrix.
  */
 
 class SK_API SkBicubicImageFilter : public SkImageFilter {
 public:
+    virtual ~SkBicubicImageFilter();
+
+    static SkBicubicImageFilter* CreateMitchell(const SkSize& scale, SkImageFilter* input = NULL);
+
+    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBicubicImageFilter)
+
+protected:
     /** Construct a (scaling-only) bicubic resampling image filter.
         @param scale        How much to scale the image.
         @param coefficients The 16 coefficients of the bicubic matrix.
         @param input        The input image filter.  If NULL, the src bitmap
                             passed to filterImage() is used instead.
     */
-
     SkBicubicImageFilter(const SkSize& scale, const SkScalar coefficients[16],
                          SkImageFilter* input = NULL);
-    static SkBicubicImageFilter* CreateMitchell(const SkSize& scale, SkImageFilter* input = NULL);
-    virtual ~SkBicubicImageFilter();
-
-    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBicubicImageFilter)
-
-protected:
     SkBicubicImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
 
 #if SK_SUPPORT_GPU
     virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; }
-    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
+    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
                                 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 #endif
 
 private:
     SkSize    fScale;
     SkScalar  fCoefficients[16];
     typedef SkImageFilter INHERITED;
 };
deleted file mode 100644
--- a/gfx/skia/trunk/include/effects/SkBitmapAlphaThresholdShader.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkShader.h"
-#include "SkBitmap.h"
-#include "SkRegion.h"
-#include "SkString.h"
-
-class SK_API SkBitmapAlphaThresholdShader : public SkShader {
-public:
-    /**
-     * Creates a shader that samples a bitmap and a region. If the sample is inside the region
-     * the alpha of the bitmap color is boosted up to a threshold value. If it is
-     * outside the region then the bitmap alpha is decreased to the threshold value.
-     * The 0,0 point of the region corresponds to the upper left corner of the bitmap
-     * Currently, this only has a GPU implementation, doesn't respect the paint's bitmap
-     * filter setting, and always uses clamp mode.
-     */
-    static SkShader* Create(const SkBitmap& bitmap, const SkRegion& region, U8CPU threshold);
-};
--- a/gfx/skia/trunk/include/effects/SkBitmapSource.h
+++ b/gfx/skia/trunk/include/effects/SkBitmapSource.h
@@ -8,28 +8,39 @@
 #ifndef SkBitmapSource_DEFINED
 #define SkBitmapSource_DEFINED
 
 #include "SkImageFilter.h"
 #include "SkBitmap.h"
 
 class SK_API SkBitmapSource : public SkImageFilter {
 public:
-    explicit SkBitmapSource(const SkBitmap& bitmap);
-    SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, const SkRect& dstRect);
+    static SkBitmapSource* Create(const SkBitmap& bitmap) {
+        return SkNEW_ARGS(SkBitmapSource, (bitmap));
+    }
+    static SkBitmapSource* Create(const SkBitmap& bitmap, const SkRect& srcRect,
+                                  const SkRect& dstRect) {
+        return SkNEW_ARGS(SkBitmapSource, (bitmap, srcRect, dstRect));
+    }
     virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource)
 
 protected:
     explicit SkBitmapSource(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
     virtual bool onFilterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    explicit SkBitmapSource(const SkBitmap& bitmap);
+    SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, const SkRect& dstRect);
+
 private:
     SkBitmap fBitmap;
     SkRect   fSrcRect, fDstRect;
     typedef SkImageFilter INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkBlurDrawLooper.h
+++ b/gfx/skia/trunk/include/effects/SkBlurDrawLooper.h
@@ -38,21 +38,21 @@ public:
     SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy,
                      uint32_t flags = kNone_BlurFlag);
 
 //    SK_ATTR_DEPRECATED("use sigma version")
     SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color,
                      uint32_t flags = kNone_BlurFlag);
     virtual ~SkBlurDrawLooper();
 
-    // overrides from SkDrawLooper
-    virtual void init(SkCanvas*);
-    virtual bool next(SkCanvas*, SkPaint* paint);
+    virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const SK_OVERRIDE;
 
-    SK_DEVELOPER_TO_STRING()
+    virtual size_t contextSize() const SK_OVERRIDE { return sizeof(BlurDrawLooperContext); }
+
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper)
 
 protected:
     SkBlurDrawLooper(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
 private:
     SkMaskFilter*   fBlur;
@@ -61,16 +61,26 @@ private:
     SkColor         fBlurColor;
     uint32_t        fBlurFlags;
 
     enum State {
         kBeforeEdge,
         kAfterEdge,
         kDone
     };
-    State   fState;
+
+    class BlurDrawLooperContext : public SkDrawLooper::Context {
+    public:
+        explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper);
+
+        virtual bool next(SkCanvas* canvas, SkPaint* paint) SK_OVERRIDE;
+
+    private:
+        const SkBlurDrawLooper* fLooper;
+        State fState;
+    };
 
     void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags);
 
     typedef SkDrawLooper INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkBlurImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkBlurImageFilter.h
@@ -8,35 +8,46 @@
 #ifndef SkBlurImageFilter_DEFINED
 #define SkBlurImageFilter_DEFINED
 
 #include "SkImageFilter.h"
 #include "SkSize.h"
 
 class SK_API SkBlurImageFilter : public SkImageFilter {
 public:
-    SkBlurImageFilter(SkScalar sigmaX,
-                      SkScalar sigmaY,
-                      SkImageFilter* input = NULL,
-                      const CropRect* cropRect = NULL);
+    static SkBlurImageFilter* Create(SkScalar sigmaX,
+                                     SkScalar sigmaY,
+                                     SkImageFilter* input = NULL,
+                                     const CropRect* cropRect = NULL) {
+        return SkNEW_ARGS(SkBlurImageFilter, (sigmaX, sigmaY, input, cropRect));
+    }
+
     virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilter)
 
 protected:
     explicit SkBlurImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
     virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
                                 SkIRect* dst) const SK_OVERRIDE;
 
     bool canFilterImageGPU() const SK_OVERRIDE { return true; }
-    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
+    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
                                 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkBlurImageFilter(SkScalar sigmaX,
+                      SkScalar sigmaY,
+                      SkImageFilter* input = NULL,
+                      const CropRect* cropRect = NULL);
+
 private:
     SkSize   fSigma;
     typedef SkImageFilter INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkColorFilterImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkColorFilterImageFilter.h
@@ -20,17 +20,17 @@ public:
     virtual ~SkColorFilterImageFilter();
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorFilterImageFilter)
 
 protected:
     SkColorFilterImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
 
     virtual bool asColorFilter(SkColorFilter**) const SK_OVERRIDE;
 
 private:
     SkColorFilterImageFilter(SkColorFilter* cf,
                              SkImageFilter* input,
                              const CropRect* cropRect = NULL);
--- a/gfx/skia/trunk/include/effects/SkColorMatrixFilter.h
+++ b/gfx/skia/trunk/include/effects/SkColorMatrixFilter.h
@@ -8,41 +8,51 @@
 #ifndef SkColorMatrixFilter_DEFINED
 #define SkColorMatrixFilter_DEFINED
 
 #include "SkColorFilter.h"
 #include "SkColorMatrix.h"
 
 class SK_API SkColorMatrixFilter : public SkColorFilter {
 public:
-    explicit SkColorMatrixFilter(const SkColorMatrix&);
-    SkColorMatrixFilter(const SkScalar array[20]);
+    static SkColorMatrixFilter* Create(const SkColorMatrix& cm) {
+        return SkNEW_ARGS(SkColorMatrixFilter, (cm));
+    }
+    static SkColorMatrixFilter* Create(const SkScalar array[20]) {
+        return SkNEW_ARGS(SkColorMatrixFilter, (array));
+    }
 
     // overrides from SkColorFilter
     virtual void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const SK_OVERRIDE;
     virtual void filterSpan16(const uint16_t src[], int count, uint16_t[]) const SK_OVERRIDE;
     virtual uint32_t getFlags() const SK_OVERRIDE;
     virtual bool asColorMatrix(SkScalar matrix[20]) const SK_OVERRIDE;
 #if SK_SUPPORT_GPU
     virtual GrEffectRef* asNewEffect(GrContext*) const SK_OVERRIDE;
 #endif
 
     struct State {
         int32_t fArray[20];
         int     fShift;
     };
 
-    SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
+    SK_TO_STRING_OVERRIDE()
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorMatrixFilter)
 
 protected:
     SkColorMatrixFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    explicit SkColorMatrixFilter(const SkColorMatrix&);
+    SkColorMatrixFilter(const SkScalar array[20]);
+
 private:
     SkColorMatrix fMatrix;
 
     typedef void (*Proc)(const State&, unsigned r, unsigned g, unsigned b,
                          unsigned a, int32_t result[4]);
 
     Proc        fProc;
     State       fState;
--- a/gfx/skia/trunk/include/effects/SkComposeImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkComposeImageFilter.h
@@ -7,25 +7,33 @@
 
 #ifndef SkComposeImageFilter_DEFINED
 #define SkComposeImageFilter_DEFINED
 
 #include "SkImageFilter.h"
 
 class SK_API SkComposeImageFilter : public SkImageFilter {
 public:
-    SkComposeImageFilter(SkImageFilter* outer, SkImageFilter* inner) : INHERITED(outer, inner) {}
     virtual ~SkComposeImageFilter();
 
+    static SkComposeImageFilter* Create(SkImageFilter* outer, SkImageFilter* inner) {
+        return SkNEW_ARGS(SkComposeImageFilter, (outer, inner));
+    }
+
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeImageFilter)
 
 protected:
     explicit SkComposeImageFilter(SkReadBuffer& buffer);
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
     virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkComposeImageFilter(SkImageFilter* outer, SkImageFilter* inner) : INHERITED(outer, inner) {}
+
 private:
     typedef SkImageFilter INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkCornerPathEffect.h
+++ b/gfx/skia/trunk/include/effects/SkCornerPathEffect.h
@@ -15,27 +15,34 @@
     SkCornerPathEffect is a subclass of SkPathEffect that can turn sharp corners
     into various treatments (e.g. rounded corners)
 */
 class SK_API SkCornerPathEffect : public SkPathEffect {
 public:
     /** radius must be > 0 to have an effect. It specifies the distance from each corner
         that should be "rounded".
     */
-    SkCornerPathEffect(SkScalar radius);
+    static SkCornerPathEffect* Create(SkScalar radius) {
+        return SkNEW_ARGS(SkCornerPathEffect, (radius));
+    }
     virtual ~SkCornerPathEffect();
 
     virtual bool filterPath(SkPath* dst, const SkPath& src,
                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCornerPathEffect)
 
 protected:
     SkCornerPathEffect(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkCornerPathEffect(SkScalar radius);
+
 private:
     SkScalar    fRadius;
 
     typedef SkPathEffect INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkDashPathEffect.h
+++ b/gfx/skia/trunk/include/effects/SkDashPathEffect.h
@@ -31,18 +31,20 @@ public:
          10 pixels on
          20 pixels off
          ...
         A phase of -5, 25, 55, 85, etc. would all result in the same path,
          because the sum of all the intervals is 30.
 
         Note: only affects stroked paths.
     */
-    SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase,
-                     bool scaleToFit = false);
+    static SkDashPathEffect* Create(const SkScalar intervals[], int count,
+                                    SkScalar phase, bool scaleToFit = false) {
+        return SkNEW_ARGS(SkDashPathEffect, (intervals, count, phase, scaleToFit));
+    }
     virtual ~SkDashPathEffect();
 
     virtual bool filterPath(SkPath* dst, const SkPath& src,
                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
 
     virtual bool asPoints(PointData* results, const SkPath& src,
                           const SkStrokeRec&, const SkMatrix&,
                           const SkRect*) const SK_OVERRIDE;
@@ -50,16 +52,22 @@ public:
     virtual Factory getFactory() const SK_OVERRIDE;
 
     static SkFlattenable* CreateProc(SkReadBuffer&);
 
 protected:
     SkDashPathEffect(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase,
+                     bool scaleToFit = false);
+
 private:
     SkScalar*   fIntervals;
     int32_t     fCount;
     // computed from phase
     SkScalar    fInitialDashLength;
     int32_t     fInitialDashIndex;
     SkScalar    fIntervalLength;
     bool        fScaleToFit;
--- a/gfx/skia/trunk/include/effects/SkDiscretePathEffect.h
+++ b/gfx/skia/trunk/include/effects/SkDiscretePathEffect.h
@@ -15,26 +15,33 @@
     This path effect chops a path into discrete segments, and randomly displaces them.
 */
 class SK_API SkDiscretePathEffect : public SkPathEffect {
 public:
     /** Break the path into segments of segLength length, and randomly move the endpoints
         away from the original path by a maximum of deviation.
         Note: works on filled or framed paths
     */
-    SkDiscretePathEffect(SkScalar segLength, SkScalar deviation);
+    static SkDiscretePathEffect* Create(SkScalar segLength, SkScalar deviation) {
+        return SkNEW_ARGS(SkDiscretePathEffect, (segLength, deviation));
+    }
 
     virtual bool filterPath(SkPath* dst, const SkPath& src,
                             SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect)
 
 protected:
     SkDiscretePathEffect(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkDiscretePathEffect(SkScalar segLength, SkScalar deviation);
+
 private:
     SkScalar fSegLength, fPerterb;
 
     typedef SkPathEffect INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkDisplacementMapEffect.h
+++ b/gfx/skia/trunk/include/effects/SkDisplacementMapEffect.h
@@ -13,50 +13,61 @@
 
 class SK_API SkDisplacementMapEffect : public SkImageFilter {
 public:
     enum ChannelSelectorType {
         kUnknown_ChannelSelectorType,
         kR_ChannelSelectorType,
         kG_ChannelSelectorType,
         kB_ChannelSelectorType,
-        kA_ChannelSelectorType,
-        kKeyBits = 3 // Max value is 4, so 3 bits are required at most
+        kA_ChannelSelectorType
     };
 
-    SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
-                            ChannelSelectorType yChannelSelector,
-                            SkScalar scale, SkImageFilter* displacement,
-                            SkImageFilter* color = NULL,
-                            const CropRect* cropRect = NULL);
+    ~SkDisplacementMapEffect();
 
-    ~SkDisplacementMapEffect();
+    static SkDisplacementMapEffect* Create(ChannelSelectorType xChannelSelector,
+                                           ChannelSelectorType yChannelSelector,
+                                           SkScalar scale, SkImageFilter* displacement,
+                                           SkImageFilter* color = NULL,
+                                           const CropRect* cropRect = NULL) {
+        return SkNEW_ARGS(SkDisplacementMapEffect, (xChannelSelector, yChannelSelector, scale,
+                                                    displacement, color, cropRect));
+    }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDisplacementMapEffect)
 
     virtual bool onFilterImage(Proxy* proxy,
                                const SkBitmap& src,
-                               const SkMatrix& ctm,
+                               const Context& ctx,
                                SkBitmap* dst,
                                SkIPoint* offset) const SK_OVERRIDE;
     virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
 
     virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
                                 SkIRect* dst) const SK_OVERRIDE;
 
 #if SK_SUPPORT_GPU
     virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; }
-    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
+    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
                                 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 #endif
 
 protected:
     explicit SkDisplacementMapEffect(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
+                            ChannelSelectorType yChannelSelector,
+                            SkScalar scale, SkImageFilter* displacement,
+                            SkImageFilter* color = NULL,
+                            const CropRect* cropRect = NULL);
+
 private:
     ChannelSelectorType fXChannelSelector;
     ChannelSelectorType fYChannelSelector;
     SkScalar fScale;
     typedef SkImageFilter INHERITED;
     const SkImageFilter* getDisplacementInput() const { return getInput(0); }
     const SkImageFilter* getColorInput() const { return getInput(1); }
 };
--- a/gfx/skia/trunk/include/effects/SkDropShadowImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkDropShadowImageFilter.h
@@ -6,27 +6,42 @@
  */
 
 #include "SkColor.h"
 #include "SkImageFilter.h"
 #include "SkScalar.h"
 
 class SK_API SkDropShadowImageFilter : public SkImageFilter {
 public:
-    SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigma, SkColor, SkImageFilter* input = NULL);
-    SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor, SkImageFilter* input = NULL, const CropRect* cropRect = NULL);
+    static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, SkScalar sigma,
+                                           SkColor color, SkImageFilter* input = NULL) {
+        return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigma, color, input));
+    }
+    static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy,
+                                           SkScalar sigmaX, SkScalar sigmaY, SkColor color,
+                                           SkImageFilter* input = NULL,
+                                           const CropRect* cropRect = NULL) {
+        return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY,
+                                                    color, input, cropRect));
+    }
     virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter)
 
 protected:
     explicit SkDropShadowImageFilter(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
-    virtual bool onFilterImage(Proxy*, const SkBitmap& source, const SkMatrix&, SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+    virtual bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
     virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
                                 SkIRect* dst) const SK_OVERRIDE;
 
-
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigma, SkColor,
+                            SkImageFilter* input = NULL);
+    SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor,
+                            SkImageFilter* input = NULL, const CropRect* cropRect = NULL);
 
 private:
     SkScalar fDx, fDy, fSigmaX, fSigmaY;
     SkColor fColor;
     typedef SkImageFilter INHERITED;
 };
--- a/gfx/skia/trunk/include/effects/SkEmbossMaskFilter.h
+++ b/gfx/skia/trunk/include/effects/SkEmbossMaskFilter.h
@@ -18,35 +18,39 @@ class SK_API SkEmbossMaskFilter : public
 public:
     struct Light {
         SkScalar    fDirection[3];  // x,y,z
         uint16_t    fPad;
         uint8_t     fAmbient;
         uint8_t     fSpecular;      // exponent, 4.4 right now
     };
 
-    SkEmbossMaskFilter(SkScalar blurSigma, const Light& light);
-
-    SK_ATTR_DEPRECATED("use sigma version")
-    SkEmbossMaskFilter(const Light& light, SkScalar blurRadius);
+    static SkEmbossMaskFilter* Create(SkScalar blurSigma, const Light& light) {
+        return SkNEW_ARGS(SkEmbossMaskFilter, (blurSigma, light));
+    }
 
     // overrides from SkMaskFilter
     //  This method is not exported to java.
     virtual SkMask::Format getFormat() const SK_OVERRIDE;
     //  This method is not exported to java.
     virtual bool filterMask(SkMask* dst, const SkMask& src, const SkMatrix&,
                             SkIPoint* margin) const SK_OVERRIDE;
 
-    SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmbossMaskFilter)
 
 protected:
     SkEmbossMaskFilter(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkEmbossMaskFilter(SkScalar blurSigma, const Light& light);
+
 private:
     Light       fLight;
     SkScalar    fBlurSigma;
 
     typedef SkMaskFilter INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkKernel33MaskFilter.h
+++ b/gfx/skia/trunk/include/effects/SkKernel33MaskFilter.h
@@ -7,53 +7,60 @@
 
 #ifndef SkKernel33MaskFilter_DEFINED
 #define SkKernel33MaskFilter_DEFINED
 
 #include "SkMaskFilter.h"
 
 class SK_API SkKernel33ProcMaskFilter : public SkMaskFilter {
 public:
-    SkKernel33ProcMaskFilter(unsigned percent256 = 256)
-        : fPercent256(percent256) {}
-
     virtual uint8_t computeValue(uint8_t* const* srcRows) const = 0;
 
     virtual SkMask::Format getFormat() const SK_OVERRIDE;
     virtual bool filterMask(SkMask*, const SkMask&, const SkMatrix&,
                             SkIPoint*) const SK_OVERRIDE;
 
-    SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
+    SK_TO_STRING_OVERRIDE()
 
 protected:
+    SkKernel33ProcMaskFilter(unsigned percent256 = 256)
+        : fPercent256(percent256) {}
     SkKernel33ProcMaskFilter(SkReadBuffer& rb);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
 private:
     int fPercent256;
 
     typedef SkMaskFilter INHERITED;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
 
 class SK_API SkKernel33MaskFilter : public SkKernel33ProcMaskFilter {
 public:
+    static SkKernel33MaskFilter* Create(const int coeff[3][3], int shift, int percent256 = 256) {
+        return SkNEW_ARGS(SkKernel33MaskFilter, (coeff, shift, percent256));
+    }
+
+    // override from SkKernel33ProcMaskFilter
+    virtual uint8_t computeValue(uint8_t* const* srcRows) const SK_OVERRIDE;
+
+    SK_TO_STRING_OVERRIDE()
+    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkKernel33MaskFilter)
+
+protected:
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
     SkKernel33MaskFilter(const int coeff[3][3], int shift, int percent256 = 256)
             : SkKernel33ProcMaskFilter(percent256) {
         memcpy(fKernel, coeff, 9 * sizeof(int));
         fShift = shift;
     }
 
-    // override from SkKernel33ProcMaskFilter
-    virtual uint8_t computeValue(uint8_t* const* srcRows) const SK_OVERRIDE;
-
-    SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
-    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkKernel33MaskFilter)
-
 private:
     int fKernel[3][3];
     int fShift;
 
     SkKernel33MaskFilter(SkReadBuffer& rb);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
     typedef SkKernel33ProcMaskFilter INHERITED;
--- a/gfx/skia/trunk/include/effects/SkLayerDrawLooper.h
+++ b/gfx/skia/trunk/include/effects/SkLayerDrawLooper.h
@@ -19,59 +19,51 @@ public:
 
             SkLayerDrawLooper();
     virtual ~SkLayerDrawLooper();
 
     /**
      *  Bits specifies which aspects of the layer's paint should replace the
      *  corresponding aspects on the draw's paint.
      *  kEntirePaint_Bits means use the layer's paint completely.
-     *  0 means ignore the layer's paint... except that LayerInfo's fFlagsMask
-     *  and fColorMode are always applied.
+     *  0 means ignore the layer's paint... except for fColorMode, which is
+     *  always applied.
      */
     enum Bits {
         kStyle_Bit      = 1 << 0,   //!< use this layer's Style/stroke settings
         kTextSkewX_Bit  = 1 << 1,   //!< use this layer's textskewx
         kPathEffect_Bit = 1 << 2,   //!< use this layer's patheffect
         kMaskFilter_Bit = 1 << 3,   //!< use this layer's maskfilter
         kShader_Bit     = 1 << 4,   //!< use this layer's shader
         kColorFilter_Bit = 1 << 5,  //!< use this layer's colorfilter
         kXfermode_Bit   = 1 << 6,   //!< use this layer's xfermode
 
         /**
          *  Use the layer's paint entirely, with these exceptions:
          *  - We never override the draw's paint's text_encoding, since that is
          *    used to interpret the text/len parameters in draw[Pos]Text.
-         *  - Flags and Color are always computed using the LayerInfo's
-         *    fFlagsMask and fColorMode.
+         *  - Color is always computed using the LayerInfo's fColorMode.
          */
         kEntirePaint_Bits = -1
 
     };
     typedef int32_t BitFlags;
 
     /**
      *  Info for how to apply the layer's paint and offset.
      *
-     *  fFlagsMask selects which flags in the layer's paint should be applied.
-     *      result = (draw-flags & ~fFlagsMask) | (layer-flags & fFlagsMask)
-     *  In the extreme:
-     *      If fFlagsMask is 0, we ignore all of the layer's flags
-     *      If fFlagsMask is -1, we use all of the layer's flags
-     *
      *  fColorMode controls how we compute the final color for the layer:
      *      The layer's paint's color is treated as the SRC
      *      The draw's paint's color is treated as the DST
      *      final-color = Mode(layers-color, draws-color);
      *  Any SkXfermode::Mode will work. Two common choices are:
      *      kSrc_Mode: to use the layer's color, ignoring the draw's
      *      kDst_Mode: to just keep the draw's color, ignoring the layer's
      */
     struct SK_API LayerInfo {
-        uint32_t            fFlagsMask; // SkPaint::Flags
         BitFlags            fPaintBits;
         SkXfermode::Mode    fColorMode;
         SkVector            fOffset;
         bool                fPostTranslate; //!< applies to fOffset
 
         /**
          *  Initial the LayerInfo. Defaults to settings that will draw the
          *  layer with no changes: e.g.
@@ -97,43 +89,92 @@ public:
     /**
      *  This layer will with the original paint and no offset.
      */
     void addLayer() { this->addLayer(0, 0); }
 
     /// Similar to addLayer, but adds a layer to the top.
     SkPaint* addLayerOnTop(const LayerInfo&);
 
-    // overrides from SkDrawLooper
-    virtual void init(SkCanvas*);
-    virtual bool next(SkCanvas*, SkPaint* paint);
+    virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const SK_OVERRIDE;
+
+    virtual size_t contextSize() const SK_OVERRIDE { return sizeof(LayerDrawLooperContext); }
 
-    SK_DEVELOPER_TO_STRING()
-    SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerDrawLooper)
+    SK_TO_STRING_OVERRIDE()
+
+    /// Implements Flattenable.
+    virtual Factory getFactory() const SK_OVERRIDE { return CreateProc; }
+    static SkFlattenable* CreateProc(SkReadBuffer& buffer);
 
 protected:
-    SkLayerDrawLooper(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
 private:
     struct Rec {
         Rec*    fNext;
         SkPaint fPaint;
         LayerInfo fInfo;
     };
     Rec*    fRecs;
     Rec*    fTopRec;
     int     fCount;
 
     // state-machine during the init/next cycle
-    Rec* fCurrRec;
+    class LayerDrawLooperContext : public SkDrawLooper::Context {
+    public:
+        explicit LayerDrawLooperContext(const SkLayerDrawLooper* looper);
 
-    static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&);
+    protected:
+        virtual bool next(SkCanvas*, SkPaint* paint) SK_OVERRIDE;
+
+    private:
+        Rec* fCurrRec;
+
+        static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&);
+    };
 
     class MyRegistrar : public SkFlattenable::Registrar {
     public:
         MyRegistrar();
     };
 
     typedef SkDrawLooper INHERITED;
+
+public:
+    class SK_API Builder {
+    public:
+        Builder();
+        ~Builder();
+
+        /**
+         *  Call for each layer you want to add (from top to bottom).
+         *  This returns a paint you can modify, but that ptr is only valid until
+         *  the next call made to addLayer().
+         */
+        SkPaint* addLayer(const LayerInfo&);
+
+        /**
+         *  This layer will draw with the original paint, at the specified offset
+         */
+        void addLayer(SkScalar dx, SkScalar dy);
+
+        /**
+         *  This layer will with the original paint and no offset.
+         */
+        void addLayer() { this->addLayer(0, 0); }
+
+        /// Similar to addLayer, but adds a layer to the top.
+        SkPaint* addLayerOnTop(const LayerInfo&);
+
+        /**
+          * Pass list of layers on to newly built looper and return it. This will
+          * also reset the builder, so it can be used to build another looper.
+          */
+        SkLayerDrawLooper* detachLooper();
+
+    private:
+        Rec* fRecs;
+        Rec* fTopRec;
+        int  fCount;
+    };
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkLayerRasterizer.h
+++ b/gfx/skia/trunk/include/effects/SkLayerRasterizer.h
@@ -13,40 +13,80 @@
 #include "SkRasterizer.h"
 #include "SkDeque.h"
 #include "SkScalar.h"
 
 class SkPaint;
 
 class SK_API SkLayerRasterizer : public SkRasterizer {
 public:
-            SkLayerRasterizer();
     virtual ~SkLayerRasterizer();
 
+    class SK_API Builder {
+    public:
+        Builder();
+        ~Builder();
+
+        void addLayer(const SkPaint& paint) {
+            this->addLayer(paint, 0, 0);
+        }
+
+        /**
+          *  Add a new layer (above any previous layers) to the rasterizer.
+          *  The layer will extract those fields that affect the mask from
+          *  the specified paint, but will not retain a reference to the paint
+          *  object itself, so it may be reused without danger of side-effects.
+          */
+        void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy);
+
+        /**
+          *  Pass queue of layers on to newly created layer rasterizer and return it. The builder
+          *  cannot be used any more after calling this function.
+          */
+        SkLayerRasterizer* detachRasterizer();
+
+    private:
+        SkDeque* fLayers;
+    };
+
+#ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API
     void addLayer(const SkPaint& paint) {
         this->addLayer(paint, 0, 0);
     }
 
     /**    Add a new layer (above any previous layers) to the rasterizer.
         The layer will extract those fields that affect the mask from
         the specified paint, but will not retain a reference to the paint
         object itself, so it may be reused without danger of side-effects.
     */
     void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy);
+#endif
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer)
 
 protected:
+    SkLayerRasterizer(SkDeque* layers);
     SkLayerRasterizer(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
     // override from SkRasterizer
     virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix,
                              const SkIRect* clipBounds,
                              SkMask* mask, SkMask::CreateMode mode) const;
 
+#ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API
+public:
+#endif
+    SkLayerRasterizer();
+
 private:
-    SkDeque fLayers;
+#ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API
+    SkDeque* fLayers;
+#else
+    const SkDeque* const fLayers;
+#endif
+
+    static SkDeque* ReadLayers(SkReadBuffer& buffer);
 
     typedef SkRasterizer INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkLerpXfermode.h
+++ b/gfx/skia/trunk/include/effects/SkLerpXfermode.h
@@ -23,17 +23,17 @@ public:
     // overrides from SkXfermode
     virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const SK_OVERRIDE;
     virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const SK_OVERRIDE;
     virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count,
                         const SkAlpha aa[]) const SK_OVERRIDE;
 
-    SK_DEVELOPER_TO_STRING()
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLerpXfermode)
 
 protected:
     SkLerpXfermode(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
 private:
     SkLerpXfermode(unsigned scale256);
--- a/gfx/skia/trunk/include/effects/SkLumaColorFilter.h
+++ b/gfx/skia/trunk/include/effects/SkLumaColorFilter.h
@@ -26,17 +26,17 @@ public:
     static SkColorFilter* Create();
 
     virtual void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const SK_OVERRIDE;
 
 #if SK_SUPPORT_GPU
     virtual GrEffectRef* asNewEffect(GrContext*) const SK_OVERRIDE;
 #endif
 
-    SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaColorFilter)
 
 protected:
     SkLumaColorFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
 private:
     SkLumaColorFilter();
--- a/gfx/skia/trunk/include/effects/SkMagnifierImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkMagnifierImageFilter.h
@@ -9,29 +9,36 @@
 #ifndef SkMagnifierImageFilter_DEFINED
 #define SkMagnifierImageFilter_DEFINED
 
 #include "SkRect.h"
 #include "SkImageFilter.h"
 
 class SK_API SkMagnifierImageFilter : public SkImageFilter {
 public:
-    SkMagnifierImageFilter(SkRect srcRect, SkScalar inset);
+    static SkMagnifierImageFilter* Create(const SkRect& srcRect, SkScalar inset) {
+        return SkNEW_ARGS(SkMagnifierImageFilter, (srcRect, inset));
+    }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMagnifierImageFilter)
 
 protected:
     explicit SkMagnifierImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 #if SK_SUPPORT_GPU
     virtual bool asNewEffect(GrEffectRef** effect, GrTexture* texture, const SkMatrix& matrix, const SkIRect& bounds) const SK_OVERRIDE;
 #endif
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset);
+
 private:
     SkRect fSrcRect;
     SkScalar fInset;
     typedef SkImageFilter INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkMatrixConvolutionImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkMatrixConvolutionImageFilter.h
@@ -23,71 +23,88 @@ class SK_API SkMatrixConvolutionImageFil
 public:
     /*! \enum TileMode */
     enum TileMode {
       kClamp_TileMode,         /*!< Clamp to the image's edge pixels. */
       kRepeat_TileMode,        /*!< Wrap around to the image's opposite edge. */
       kClampToBlack_TileMode,  /*!< Fill with transparent black. */
     };
 
+    virtual ~SkMatrixConvolutionImageFilter();
+
     /** Construct a matrix convolution image filter.
-        @param kernelSize  The kernel size in pixels, in each dimension (N by M).
-        @param kernel      The image processing kernel.  Must contain N * M
-                           elements, in row order.
-        @param gain        A scale factor applied to each pixel after
-                           convolution.  This can be used to normalize the
-                           kernel, if it does not sum to 1.
-        @param bias        A bias factor added to each pixel after convolution.
-        @param target      An offset applied to each pixel coordinate before
-                           convolution.  This can be used to center the kernel
-                           over the image (e.g., a 3x3 kernel should have a
-                           target of {1, 1}).
-        @param tileMode    How accesses outside the image are treated.  (@see
-                           TileMode).
+        @param kernelSize     The kernel size in pixels, in each dimension (N by M).
+        @param kernel         The image processing kernel.  Must contain N * M
+                              elements, in row order.
+        @param gain           A scale factor applied to each pixel after
+                              convolution.  This can be used to normalize the
+                              kernel, if it does not sum to 1.
+        @param bias           A bias factor added to each pixel after convolution.
+        @param kernelOffset   An offset applied to each pixel coordinate before
+                              convolution.  This can be used to center the kernel
+                              over the image (e.g., a 3x3 kernel should have an
+                              offset of {1, 1}).
+        @param tileMode       How accesses outside the image are treated.  (@see
+                              TileMode).
         @param convolveAlpha  If true, all channels are convolved.  If false,
-                           only the RGB channels are convolved, and
-                           alpha is copied from the source image.
-        @param input       The input image filter.  If NULL, the src bitmap
-                           passed to filterImage() is used instead.
-        @param cropRect    The rectangle to which the output processing will be limited.
+                              only the RGB channels are convolved, and
+                              alpha is copied from the source image.
+        @param input          The input image filter.  If NULL, the src bitmap
+                              passed to filterImage() is used instead.
+        @param cropRect       The rectangle to which the output processing will be limited.
     */
-
-    SkMatrixConvolutionImageFilter(const SkISize& kernelSize,
-                                   const SkScalar* kernel,
-                                   SkScalar gain,
-                                   SkScalar bias,
-                                   const SkIPoint& target,
-                                   TileMode tileMode,
-                                   bool convolveAlpha,
-                                   SkImageFilter* input = NULL,
-                                   const CropRect* cropRect = NULL);
-    virtual ~SkMatrixConvolutionImageFilter();
+    static SkMatrixConvolutionImageFilter* Create(const SkISize& kernelSize,
+                                                  const SkScalar* kernel,
+                                                  SkScalar gain,
+                                                  SkScalar bias,
+                                                  const SkIPoint& kernelOffset,
+                                                  TileMode tileMode,
+                                                  bool convolveAlpha,
+                                                  SkImageFilter* input = NULL,
+                                                  const CropRect* cropRect = NULL) {
+        return SkNEW_ARGS(SkMatrixConvolutionImageFilter, (kernelSize, kernel, gain, bias,
+                                                           kernelOffset, tileMode, convolveAlpha,
+                                                           input, cropRect));
+    }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixConvolutionImageFilter)
 
 protected:
     SkMatrixConvolutionImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
 
 #if SK_SUPPORT_GPU
     virtual bool asNewEffect(GrEffectRef** effect,
                              GrTexture*,
-                             const SkMatrix& matrix,
+                             const SkMatrix& ctm,
                              const SkIRect& bounds) const SK_OVERRIDE;
 #endif
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkMatrixConvolutionImageFilter(const SkISize& kernelSize,
+                                   const SkScalar* kernel,
+                                   SkScalar gain,
+                                   SkScalar bias,
+                                   const SkIPoint& kernelOffset,
+                                   TileMode tileMode,
+                                   bool convolveAlpha,
+                                   SkImageFilter* input = NULL,
+                                   const CropRect* cropRect = NULL);
+
 private:
     SkISize   fKernelSize;
     SkScalar* fKernel;
     SkScalar  fGain;
     SkScalar  fBias;
-    SkIPoint  fTarget;
+    SkIPoint  fKernelOffset;
     TileMode  fTileMode;
     bool      fConvolveAlpha;
     typedef SkImageFilter INHERITED;
 
     template <class PixelFetcher, bool convolveAlpha>
     void filterPixels(const SkBitmap& src,
                       SkBitmap* result,
                       const SkIRect& rect,
--- a/gfx/skia/trunk/include/effects/SkMergeImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkMergeImageFilter.h
@@ -9,32 +9,47 @@
 #define SkMergeImageFilter_DEFINED
 
 #include "SkImageFilter.h"
 
 #include "SkXfermode.h"
 
 class SK_API SkMergeImageFilter : public SkImageFilter {
 public:
-    SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second,
-                       SkXfermode::Mode = SkXfermode::kSrcOver_Mode,
-                       const CropRect* cropRect = NULL);
-    SkMergeImageFilter(SkImageFilter* filters[], int count,
-                       const SkXfermode::Mode modes[] = NULL,
-                       const CropRect* cropRect = NULL);
     virtual ~SkMergeImageFilter();
 
+    static SkMergeImageFilter* Create(SkImageFilter* first, SkImageFilter* second,
+                                      SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode,
+                                      const CropRect* cropRect = NULL) {
+        return SkNEW_ARGS(SkMergeImageFilter, (first, second, mode, cropRect));
+    }
+    static SkMergeImageFilter* Create(SkImageFilter* filters[], int count,
+                                      const SkXfermode::Mode modes[] = NULL,
+                                      const CropRect* cropRect = NULL) {
+        return SkNEW_ARGS(SkMergeImageFilter, (filters, count, modes, cropRect));
+    }
+
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter)
 
 protected:
     SkMergeImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second,
+                       SkXfermode::Mode = SkXfermode::kSrcOver_Mode,
+                       const CropRect* cropRect = NULL);
+    SkMergeImageFilter(SkImageFilter* filters[], int count,
+                       const SkXfermode::Mode modes[] = NULL,
+                       const CropRect* cropRect = NULL);
 private:
     uint8_t*            fModes; // SkXfermode::Mode
 
     // private storage, to avoid dynamically allocating storage for our copy
     // of the modes (unless the count is so large we can't fit).
     intptr_t    fStorage[16];
 
     void initAllocModes();
--- a/gfx/skia/trunk/include/effects/SkMorphologyImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkMorphologyImageFilter.h
@@ -10,89 +10,108 @@
 #define SkMorphologyImageFilter_DEFINED
 
 #include "SkColor.h"
 #include "SkImageFilter.h"
 #include "SkSize.h"
 
 class SK_API SkMorphologyImageFilter : public SkImageFilter {
 public:
-    SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, const CropRect* cropRect);
     virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
     virtual bool onFilterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) const SK_OVERRIDE;
 
     /**
      * All morphology procs have the same signature: src is the source buffer, dst the
      * destination buffer, radius is the morphology radius, width and height are the bounds
      * of the destination buffer (in pixels), and srcStride and dstStride are the
      * number of pixels per row in each buffer. All buffers are 8888.
      */
 
     typedef void (*Proc)(const SkPMColor* src, SkPMColor* dst, int radius,
                          int width, int height, int srcStride, int dstStride);
 
 protected:
+    SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input,
+                            const CropRect* cropRect);
     bool filterImageGeneric(Proc procX, Proc procY,
-                            Proxy*, const SkBitmap& src, const SkMatrix&,
+                            Proxy*, const SkBitmap& src, const Context&,
                             SkBitmap* result, SkIPoint* offset) const;
     SkMorphologyImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 #if SK_SUPPORT_GPU
     virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; }
     bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src,
-                               const SkMatrix& ctm, SkBitmap* result,
+                               const Context& ctm, SkBitmap* result,
                                SkIPoint* offset) const;
 #endif
 
     SkISize    radius() const { return fRadius; }
 
 private:
     SkISize    fRadius;
     typedef SkImageFilter INHERITED;
 };
 
 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter {
 public:
-    SkDilateImageFilter(int radiusX, int radiusY,
-                        SkImageFilter* input = NULL,
-                        const CropRect* cropRect = NULL)
-    : INHERITED(radiusX, radiusY, input, cropRect) {}
+    static SkDilateImageFilter* Create(int radiusX, int radiusY,
+                                       SkImageFilter* input = NULL,
+                                       const CropRect* cropRect = NULL) {
+        return SkNEW_ARGS(SkDilateImageFilter, (radiusX, radiusY, input, cropRect));
+    }
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 #if SK_SUPPORT_GPU
-    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
+    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context&,
                                 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 #endif
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter)
 
 protected:
     SkDilateImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {}
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkDilateImageFilter(int radiusX, int radiusY,
+                        SkImageFilter* input = NULL,
+                        const CropRect* cropRect = NULL)
+    : INHERITED(radiusX, radiusY, input, cropRect) {}
+
 private:
     typedef SkMorphologyImageFilter INHERITED;
 };
 
 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter {
 public:
-    SkErodeImageFilter(int radiusX, int radiusY,
-                       SkImageFilter* input = NULL,
-                       const CropRect* cropRect = NULL)
-    : INHERITED(radiusX, radiusY, input, cropRect) {}
+    static SkErodeImageFilter* Create(int radiusX, int radiusY,
+                                      SkImageFilter* input = NULL,
+                                      const CropRect* cropRect = NULL) {
+        return SkNEW_ARGS(SkErodeImageFilter, (radiusX, radiusY, input, cropRect));
+    }
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 #if SK_SUPPORT_GPU
-    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
+    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context&,
                                 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 #endif
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter)
 
 protected:
     SkErodeImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {}
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkErodeImageFilter(int radiusX, int radiusY,
+                       SkImageFilter* input = NULL,
+                       const CropRect* cropRect = NULL)
+    : INHERITED(radiusX, radiusY, input, cropRect) {}
+
 private:
     typedef SkMorphologyImageFilter INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkOffsetImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkOffsetImageFilter.h
@@ -10,26 +10,34 @@
 
 #include "SkImageFilter.h"
 #include "SkPoint.h"
 
 class SK_API SkOffsetImageFilter : public SkImageFilter {
     typedef SkImageFilter INHERITED;
 
 public:
-    SkOffsetImageFilter(SkScalar dx, SkScalar dy, SkImageFilter* input = NULL,
-                        const CropRect* cropRect = NULL);
+    static SkOffsetImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input = NULL,
+                                       const CropRect* cropRect = NULL) {
+        return SkNEW_ARGS(SkOffsetImageFilter, (dx, dy, input, cropRect));
+    }
     virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE;
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkOffsetImageFilter)
 
 protected:
     SkOffsetImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
     virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkOffsetImageFilter(SkScalar dx, SkScalar dy, SkImageFilter* input = NULL,
+                        const CropRect* cropRect = NULL);
+
 private:
     SkVector fOffset;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkPerlinNoiseShader.h
+++ b/gfx/skia/trunk/include/effects/SkPerlinNoiseShader.h
@@ -64,48 +64,48 @@ public:
 
     virtual bool setContext(const SkBitmap& device, const SkPaint& paint,
                             const SkMatrix& matrix);
     virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
     virtual void shadeSpan16(int x, int y, uint16_t[], int count) SK_OVERRIDE;
 
     virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const SK_OVERRIDE;
 
-    SK_DEVELOPER_TO_STRING()
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader)
 
 protected:
     SkPerlinNoiseShader(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
 private:
     SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, SkScalar baseFrequencyX,
                         SkScalar baseFrequencyY, int numOctaves, SkScalar seed,
-                        const SkISize* tileSize = NULL);
+                        const SkISize* tileSize);
     virtual ~SkPerlinNoiseShader();
 
-    void setTileSize(const SkISize&);
-
-    void initPaint(PaintingData& paintingData);
-
     SkScalar noise2D(int channel, const PaintingData& paintingData,
-                     const StitchData& stitchData, const SkPoint& noiseVector);
+                     const StitchData& stitchData, const SkPoint& noiseVector) const;
 
     SkScalar calculateTurbulenceValueForPoint(int channel, const PaintingData& paintingData,
-                                              StitchData& stitchData, const SkPoint& point);
+                                              StitchData& stitchData, const SkPoint& point) const;
 
-    SkPMColor shade(const SkPoint& point, StitchData& stitchData);
+    SkPMColor shade(const SkPoint& point, StitchData& stitchData) const;
 
-    SkPerlinNoiseShader::Type fType;
-    SkScalar fBaseFrequencyX;
-    SkScalar fBaseFrequencyY;
-    int fNumOctaves;
-    SkScalar fSeed;
-    SkISize fTileSize;
-    bool fStitchTiles;
+    // TODO (scroggo): Once all SkShaders are created from a factory, and we have removed the
+    // constructor that creates SkPerlinNoiseShader from an SkReadBuffer, several fields can
+    // be made constant.
+    /*const*/ SkPerlinNoiseShader::Type fType;
+    /*const*/ SkScalar                  fBaseFrequencyX;
+    /*const*/ SkScalar                  fBaseFrequencyY;
+    /*const*/ int                       fNumOctaves;
+    /*const*/ SkScalar                  fSeed;
+    /*const*/ SkISize                   fTileSize;
+    /*const*/ bool                      fStitchTiles;
+    // TODO (scroggo): Once setContext creates a new object, place this on that object.
     SkMatrix fMatrix;
 
     PaintingData* fPaintingData;
 
     typedef SkShader INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkPictureImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkPictureImageFilter.h
@@ -11,38 +11,48 @@
 #include "SkImageFilter.h"
 #include "SkPicture.h"
 
 class SK_API SkPictureImageFilter : public SkImageFilter {
 public:
     /**
      *  Refs the passed-in picture.
      */
-    explicit SkPictureImageFilter(SkPicture* picture);
+    static SkPictureImageFilter* Create(SkPicture* picture) {
+        return SkNEW_ARGS(SkPictureImageFilter, (picture));
+    }
 
     /**
-     *  Refs the passed-in picture. rect can be used to crop or expand the destination rect when
+     *  Refs the passed-in picture. cropRect can be used to crop or expand the destination rect when
      *  the picture is drawn. (No scaling is implied by the dest rect; only the CTM is applied.)
      */
-    SkPictureImageFilter(SkPicture* picture, const SkRect& rect);
+    static SkPictureImageFilter* Create(SkPicture* picture, const SkRect& cropRect) {
+        return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect));
+    }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter)
 
 protected:
     virtual ~SkPictureImageFilter();
     /*  Constructs an SkPictureImageFilter object from an SkReadBuffer.
      *  Note: If the SkPictureImageFilter object construction requires bitmap
      *  decoding, the decoder must be set on the SkReadBuffer parameter by calling
      *  SkReadBuffer::setBitmapDecoder() before calling this constructor.
      *  @param SkReadBuffer Serialized picture data.
      */
     explicit SkPictureImageFilter(SkReadBuffer&);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    explicit SkPictureImageFilter(SkPicture* picture);
+    SkPictureImageFilter(SkPicture* picture, const SkRect& cropRect);
+
 private:
     SkPicture* fPicture;
-    SkRect     fRect;
+    SkRect     fCropRect;
     typedef SkImageFilter INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkPixelXorXfermode.h
+++ b/gfx/skia/trunk/include/effects/SkPixelXorXfermode.h
@@ -12,27 +12,34 @@
 
 /** SkPixelXorXfermode implements a simple pixel xor (op ^ src ^ dst).
     This transformation does not follow premultiplied conventions, therefore
     this proc *always* returns an opaque color (alpha == 255). Thus it is
     not really usefull for operating on blended colors.
 */
 class SK_API SkPixelXorXfermode : public SkXfermode {
 public:
-    SkPixelXorXfermode(SkColor opColor) : fOpColor(opColor) {}
+    static SkPixelXorXfermode* Create(SkColor opColor) {
+        return SkNEW_ARGS(SkPixelXorXfermode, (opColor));
+    }
 
-    SK_DEVELOPER_TO_STRING()
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPixelXorXfermode)
 
 protected:
     SkPixelXorXfermode(SkReadBuffer& rb);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
     // override from SkXfermode
     virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkPixelXorXfermode(SkColor opColor) : fOpColor(opColor) {}
+
 private:
     SkColor fOpColor;
 
     typedef SkXfermode INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkRectShaderImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkRectShaderImageFilter.h
@@ -32,17 +32,17 @@ public:
     virtual ~SkRectShaderImageFilter();
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRectShaderImageFilter)
 
 protected:
     SkRectShaderImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
 
 private:
     SkRectShaderImageFilter(SkShader* s, const CropRect* rect);
     SkShader*  fShader;
 
     typedef SkImageFilter INHERITED;
 };
--- a/gfx/skia/trunk/include/effects/SkResizeImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkResizeImageFilter.h
@@ -16,36 +16,48 @@
 
 /*! \class SkResizeImageFilter
     Resampling image filter. This filter draws its source image resampled using the given scale
     values.
  */
 
 class SK_API SkResizeImageFilter : public SkImageFilter {
 public:
+    virtual ~SkResizeImageFilter();
+
     /** Construct a (scaling-only) resampling image filter.
      *  @param sx           The x scale parameter to apply when resizing.
      *  @param sy           The y scale parameter to apply when resizing.
      *  @param filterLevel  The quality of filtering to apply when scaling.
      *  @param input        The input image filter.  If NULL, the src bitmap
      *                      passed to filterImage() is used instead.
      */
+    static SkResizeImageFilter* Create(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLevel,
+                                       SkImageFilter* input = NULL) {
+        return SkNEW_ARGS(SkResizeImageFilter, (sx, sy, filterLevel, input));
+    }
 
-    SkResizeImageFilter(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLevel,
-                        SkImageFilter* input = NULL);
-    virtual ~SkResizeImageFilter();
+    virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkResizeImageFilter)
 
 protected:
     SkResizeImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
+    virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
+                                SkIRect* dst) const SK_OVERRIDE;
+
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkResizeImageFilter(SkScalar sx, SkScalar sy, SkPaint::FilterLevel filterLevel,
+                        SkImageFilter* input = NULL);
 
 private:
     SkScalar              fSx, fSy;
     SkPaint::FilterLevel  fFilterLevel;
     typedef SkImageFilter INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkStippleMaskFilter.h
+++ b/gfx/skia/trunk/include/effects/SkStippleMaskFilter.h
@@ -10,33 +10,40 @@
 
 #include "SkMaskFilter.h"
 
 /**
  * Simple MaskFilter that creates a screen door stipple pattern.
  */
 class SK_API SkStippleMaskFilter : public SkMaskFilter {
 public:
-    SkStippleMaskFilter() : INHERITED() {
+    static SkStippleMaskFilter* Create() {
+        return SkNEW(SkStippleMaskFilter);
     }
 
     virtual bool filterMask(SkMask* dst, const SkMask& src,
                             const SkMatrix& matrix,
                             SkIPoint* margin) const SK_OVERRIDE;
 
     // getFormat is from SkMaskFilter
     virtual SkMask::Format getFormat() const SK_OVERRIDE {
         return SkMask::kA8_Format;
     }
 
-    SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkStippleMaskFilter);
 
 protected:
     SkStippleMaskFilter(SkReadBuffer& buffer)
     : SkMaskFilter(buffer) {
     }
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkStippleMaskFilter() : INHERITED() {
+    }
+
 private:
     typedef SkMaskFilter INHERITED;
 };
 
 #endif // SkStippleMaskFilter_DEFINED
--- a/gfx/skia/trunk/include/effects/SkTableMaskFilter.h
+++ b/gfx/skia/trunk/include/effects/SkTableMaskFilter.h
@@ -13,51 +13,59 @@
 
 /** \class SkTableMaskFilter
 
     Applies a table lookup on each of the alpha values in the mask.
     Helper methods create some common tables (e.g. gamma, clipping)
  */
 class SK_API SkTableMaskFilter : public SkMaskFilter {
 public:
-    SkTableMaskFilter();
-    SkTableMaskFilter(const uint8_t table[256]);
     virtual ~SkTableMaskFilter();
 
     /** Utility that sets the gamma table
      */
     static void MakeGammaTable(uint8_t table[256], SkScalar gamma);
 
     /** Utility that creates a clipping table: clamps values below min to 0
         and above max to 255, and rescales the remaining into 0..255
      */
     static void MakeClipTable(uint8_t table[256], uint8_t min, uint8_t max);
 
+    static SkTableMaskFilter* Create(const uint8_t table[256]) {
+        return SkNEW_ARGS(SkTableMaskFilter, (table));
+    }
+
     static SkTableMaskFilter* CreateGamma(SkScalar gamma) {
         uint8_t table[256];
         MakeGammaTable(table, gamma);
         return SkNEW_ARGS(SkTableMaskFilter, (table));
     }
 
     static SkTableMaskFilter* CreateClip(uint8_t min, uint8_t max) {
         uint8_t table[256];
         MakeClipTable(table, min, max);
         return SkNEW_ARGS(SkTableMaskFilter, (table));
     }
 
     virtual SkMask::Format getFormat() const SK_OVERRIDE;
     virtual bool filterMask(SkMask*, const SkMask&, const SkMatrix&,
                             SkIPoint*) const SK_OVERRIDE;
 
-    SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTableMaskFilter)
 
 protected:
     SkTableMaskFilter(SkReadBuffer& rb);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkTableMaskFilter();
+    SkTableMaskFilter(const uint8_t table[256]);
+
 private:
     uint8_t fTable[256];
 
     typedef SkMaskFilter INHERITED;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkTestImageFilters.h
+++ b/gfx/skia/trunk/include/effects/SkTestImageFilters.h
@@ -2,25 +2,28 @@
 #define _SkTestImageFilters_h
 
 #include "SkImageFilter.h"
 #include "SkPoint.h"
 
 // Fun mode that scales down (only) and then scales back up to look pixelated
 class SK_API SkDownSampleImageFilter : public SkImageFilter {
 public:
-    SkDownSampleImageFilter(SkScalar scale) : INHERITED(0), fScale(scale) {}
+    static SkDownSampleImageFilter* Create(SkScalar scale) {
+        return SkNEW_ARGS(SkDownSampleImageFilter, (scale));
+    }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDownSampleImageFilter)
 
 protected:
+    SkDownSampleImageFilter(SkScalar scale) : INHERITED(0), fScale(scale) {}
     SkDownSampleImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
-    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
+    virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
                                SkBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
 
 private:
     SkScalar fScale;
 
     typedef SkImageFilter INHERITED;
 };
 
--- a/gfx/skia/trunk/include/effects/SkTileImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkTileImageFilter.h
@@ -9,32 +9,40 @@
 #define SkTileImageFilter_DEFINED
 
 #include "SkImageFilter.h"
 
 class SK_API SkTileImageFilter : public SkImageFilter {
     typedef SkImageFilter INHERITED;
 
 public:
-    /** Tile image filter constructor
+    /** Create a tile image filter
         @param srcRect  Defines the pixels to tile
         @param dstRect  Defines the pixels where tiles are drawn
         @param input    Input from which the subregion defined by srcRect will be tiled
     */
-    SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, SkImageFilter* input)
-        : INHERITED(input), fSrcRect(srcRect), fDstRect(dstRect) {}
+    static SkTileImageFilter* Create(const SkRect& srcRect, const SkRect& dstRect,
+                                     SkImageFilter* input) {
+        return SkNEW_ARGS(SkTileImageFilter, (srcRect, dstRect, input));
+    }
 
-    virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
+    virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx,
                                SkBitmap* dst, SkIPoint* offset) const SK_OVERRIDE;
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTileImageFilter)
 
 protected:
     explicit SkTileImageFilter(SkReadBuffer& buffer);
 
     virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkTileImageFilter(const SkRect& srcRect, const SkRect& dstRect, SkImageFilter* input)
+        : INHERITED(input), fSrcRect(srcRect), fDstRect(dstRect) {}
+
 private:
     SkRect fSrcRect;
     SkRect fDstRect;
 };
 
 #endif
--- a/gfx/skia/trunk/include/effects/SkTransparentShader.h
+++ b/gfx/skia/trunk/include/effects/SkTransparentShader.h
@@ -16,17 +16,17 @@ public:
 
     virtual uint32_t getFlags() SK_OVERRIDE;
     virtual bool    setContext(const SkBitmap& device,
                                const SkPaint& paint,
                                const SkMatrix& matrix) SK_OVERRIDE;
     virtual void    shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
     virtual void    shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
 
-    SK_DEVELOPER_TO_STRING()
+    SK_TO_STRING_OVERRIDE()
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader)
 
 private:
     // these are a cache from the call to setContext()
     const SkBitmap* fDevice;
     uint8_t         fAlpha;
 
     SkTransparentShader(SkReadBuffer& buffer) : INHERITED(buffer) {}
--- a/gfx/skia/trunk/include/effects/SkXfermodeImageFilter.h
+++ b/gfx/skia/trunk/include/effects/SkXfermodeImageFilter.h
@@ -16,36 +16,45 @@ class SkXfermode;
 class SK_API SkXfermodeImageFilter : public SkImageFilter {
     /**
      * This filter takes an xfermode, and uses it to composite the foreground
      * over the background.  If foreground or background is NULL, the input
      * bitmap (src) is used instead.
       */
 
 public:
-    SkXfermodeImageFilter(SkXfermode* mode, SkImageFilter* background,
-                          SkImageFilter* foreground = NULL, const CropRect* cropRect = NULL);
+    virtual ~SkXfermodeImageFilter();
 
-    virtual ~SkXfermodeImageFilter();
+    static SkXfermodeImageFilter* Create(SkXfermode* mode, SkImageFilter* background,
+                                         SkImageFilter* foreground = NULL,
+                                         const CropRect* cropRect = NULL) {
+        return SkNEW_ARGS(SkXfermodeImageFilter, (mode, background, foreground, cropRect));
+    }
 
     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkXfermodeImageFilter)
 
     virtual bool onFilterImage(Proxy* proxy,
                                const SkBitmap& src,
-                               const SkMatrix& ctm,
+                               const Context& ctx,
                                SkBitmap* dst,
                                SkIPoint* offset) const SK_OVERRIDE;
 #if SK_SUPPORT_GPU
     virtual bool canFilterImageGPU() const SK_OVERRIDE { return !cropRectIsSet(); }
-    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
+    virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
                                 SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
 #endif
 
 protected:
     explicit SkXfermodeImageFilter(SkReadBuffer& buffer);
     virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
 
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+    SkXfermodeImageFilter(SkXfermode* mode, SkImageFilter* background,
+                          SkImageFilter* foreground = NULL, const CropRect* cropRect = NULL);
+
 private:
     SkXfermode* fMode;
     typedef SkImageFilter INHERITED;
 };
 
 #endif
deleted file mode 100644
--- a/gfx/skia/trunk/include/gpu/GrBitmapTextContext.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 GrBitmapTextContext_DEFINED
-#define GrBitmapTextContext_DEFINED
-
-#include "GrTextContext.h"
-
-class GrTextStrike;
-
-/*
- * This class implements GrTextContext using standard bitmap fonts
- */
-class GrBitmapTextContext : public GrTextContext {
-public:
-    GrBitmapTextContext(GrContext*, const GrPaint&, SkColor);
-    virtual ~GrBitmapTextContext();
-
-    virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
-                         GrFontScaler*) SK_OVERRIDE;
-
-private:
-    GrContext::AutoMatrix  fAutoMatrix;
-    GrTextStrike*          fStrike;
-
-    void flushGlyphs();                 // automatically called by destructor
-
-    enum {
-        kMinRequestedGlyphs      = 1,
-        kDefaultRequestedGlyphs  = 64,
-        kMinRequestedVerts       = kMinRequestedGlyphs * 4,
-        kDefaultRequestedVerts   = kDefaultRequestedGlyphs * 4,
-    };
-
-    SkColor                 fSkPaintColor;
-    SkPoint*                fVertices;
-    int32_t                 fMaxVertices;
-    GrTexture*              fCurrTexture;
-    int                     fCurrVertex;
-};
-
-#endif
--- a/gfx/skia/trunk/include/gpu/GrContext.h
+++ b/gfx/skia/trunk/include/gpu/GrContext.h
@@ -301,16 +301,29 @@ public:
     int getMaxRenderTargetSize() const;
 
     /**
      * Returns the max sample count for a render target. It will be 0 if MSAA
      * is not supported.
      */
     int getMaxSampleCount() const;
 
+    /**
+     * Returns the recommended sample count for a render target when using this
+     * context.
+     *
+     * @param  config the configuration of the render target.
+     * @param  dpi the display density in dots per inch.
+     *
+     * @return sample count that should be perform well and have good enough
+     *         rendering quality for the display. Alternatively returns 0 if
+     *         MSAA is not supported or recommended to be used by default.
+     */
+    int getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) const;
+
     ///////////////////////////////////////////////////////////////////////////
     // Backend Surfaces
 
     /**
      * Wraps an existing texture with a GrTexture object.
      *
      * OpenGL: if the object is a texture Gr may change its GL texture params
      *         when it is drawn.
deleted file mode 100644
--- a/gfx/skia/trunk/include/gpu/GrDistanceFieldTextContext.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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 GrDistanceFieldTextContext_DEFINED
-#define GrDistanceFieldTextContext_DEFINED
-
-#include "GrTextContext.h"
-
-class GrTextStrike;
-
-/*
- * This class implements GrTextContext using distance field fonts
- */
-class GrDistanceFieldTextContext : public GrTextContext {
-public:
-    GrDistanceFieldTextContext(GrContext*, const GrPaint&, SkColor, SkScalar textRatio);
-    virtual ~GrDistanceFieldTextContext();
-
-    virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
-                                 GrFontScaler*) SK_OVERRIDE;
-
-private:
-    GrTextStrike*           fStrike;
-    SkScalar                fTextRatio;
-
-    void flushGlyphs();                 // automatically called by destructor
-
-    enum {
-        kMinRequestedGlyphs      = 1,
-        kDefaultRequestedGlyphs  = 64,
-        kMinRequestedVerts       = kMinRequestedGlyphs * 4,
-        kDefaultRequestedVerts   = kDefaultRequestedGlyphs * 4,
-    };
-
-    SkColor                 fSkPaintColor;
-    SkPoint*                fVertices;
-    int32_t                 fMaxVertices;
-    GrTexture*              fCurrTexture;
-    int                     fCurrVertex;
-};
-
-#endif
--- a/gfx/skia/trunk/include/gpu/GrTBackendEffectFactory.h
+++ b/gfx/skia/trunk/include/gpu/GrTBackendEffectFactory.h
@@ -59,17 +59,17 @@ public:
                (transformKey << (kEffectKeyBits+kTextureKeyBits)) |
                (textureKey << kEffectKeyBits) |
                (effectKey);
     }
 
     /** Returns a new instance of the appropriate *GL* implementation class
         for the given GrEffect; caller is responsible for deleting
         the object. */
-    virtual GLEffect* createGLInstance(const GrDrawEffect& drawEffect) const SK_OVERRIDE {
+    virtual GrGLEffect* createGLInstance(const GrDrawEffect& drawEffect) const SK_OVERRIDE {
         return SkNEW_ARGS(GLEffect, (*this, drawEffect));
     }