From 7c87227702176a8023a914031e83fac8ea6c2dc2 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 26 Jul 2016 12:33:37 -0700 Subject: [PATCH] Update Skia (#2825) --- DEPS | 2 +- flutter/lib/ui/painting/picture_recorder.cc | 5 +-- .../platform/fonts/skia/FontCacheSkia.cpp | 11 +------ .../platform/graphics/GraphicsContext.cpp | 33 ------------------- .../platform/graphics/GraphicsContext.h | 4 --- sky/engine/platform/graphics/Pattern.cpp | 2 +- .../graphics/skia/NativeImageSkia.cpp | 2 +- sky/shell/gpu/direct/ganesh_canvas.cc | 2 +- 8 files changed, 6 insertions(+), 55 deletions(-) diff --git a/DEPS b/DEPS index bf88dda19..641e28b36 100644 --- a/DEPS +++ b/DEPS @@ -21,7 +21,7 @@ vars = { 'chromium_git': 'https://chromium.googlesource.com', 'mojo_sdk_revision': 'b200aa62c93647a0421b9239804ef5ce1509ab20', 'base_revision': '672b04e54b937ec899429a6bd5409c5a6300d151', - 'skia_revision': '8cc209111876b7c78b5ec577c9221d8ed5e21024', + 'skia_revision': 'd1bdd1fcbd308afb9903f39d231742f5c951cf07', # Note: When updating the Dart revision, ensure that all entries that are # dependencies of dart are also updated diff --git a/flutter/lib/ui/painting/picture_recorder.cc b/flutter/lib/ui/painting/picture_recorder.cc index f98af6e8d..2256f2536 100644 --- a/flutter/lib/ui/painting/picture_recorder.cc +++ b/flutter/lib/ui/painting/picture_recorder.cc @@ -47,10 +47,7 @@ bool PictureRecorder::isRecording() { } SkCanvas* PictureRecorder::BeginRecording(SkRect bounds) { - return picture_recorder_.beginRecording( - bounds, - &rtree_factory_, - SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag); + return picture_recorder_.beginRecording(bounds, &rtree_factory_); } scoped_refptr PictureRecorder::endRecording() { diff --git a/sky/engine/platform/fonts/skia/FontCacheSkia.cpp b/sky/engine/platform/fonts/skia/FontCacheSkia.cpp index 52067a641..ca15a8c5f 100644 --- a/sky/engine/platform/fonts/skia/FontCacheSkia.cpp +++ b/sky/engine/platform/fonts/skia/FontCacheSkia.cpp @@ -219,16 +219,7 @@ sk_sp FontCache::createTypeface(const FontDescription& fontDescripti if (typeface) return typeface; - int legacyStyle = SkTypeface::kNormal; - if (fontDescription.weight() >= FontWeight600) - legacyStyle |= SkTypeface::kBold; - if (fontDescription.style()) - legacyStyle |= SkTypeface::kItalic; - - // FIXME: Use fm, SkFontStyle and matchFamilyStyle instead of this legacy - // API. To make this work, we need to understand the extra fallback behavior - // in CreateFromName. - return SkTypeface::MakeFromName(name.data(), static_cast(legacyStyle)); + return SkTypeface::MakeFromName(name.data(), style); } #if !OS(WIN) diff --git a/sky/engine/platform/graphics/GraphicsContext.cpp b/sky/engine/platform/graphics/GraphicsContext.cpp index 72d4ad4ff..f942dd061 100644 --- a/sky/engine/platform/graphics/GraphicsContext.cpp +++ b/sky/engine/platform/graphics/GraphicsContext.cpp @@ -794,39 +794,6 @@ void GraphicsContext::drawTiledImage(Image* image, const IntRect& dest, const In image->drawTiled(this, dest, srcRect, tileScaleFactor, hRule, vRule, op); } -void GraphicsContext::writePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, int x, int y) -{ - if (contextDisabled()) - return; - - m_canvas->writePixels(info, pixels, rowBytes, x, y); - - if (regionTrackingEnabled()) { - SkRect rect = SkRect::MakeXYWH(x, y, info.width(), info.height()); - SkPaint paint; - - paint.setXfermodeMode(SkXfermode::kSrc_Mode); - if (kOpaque_SkAlphaType != info.alphaType()) - paint.setAlpha(0x80); // signal to m_trackedRegion that we are not fully opaque - - m_trackedRegion.didDrawRect(this, rect, paint, 0); - // more efficient would be to call markRectAsOpaque or MarkRectAsNonOpaque directly, - // rather than cons-ing up a paint with an xfermode and alpha - } -} - -void GraphicsContext::writePixels(const SkBitmap& bitmap, int x, int y) -{ - if (contextDisabled()) - return; - - if (!bitmap.getTexture()) { - SkAutoLockPixels alp(bitmap); - if (bitmap.getPixels()) - writePixels(bitmap.info(), bitmap.getPixels(), bitmap.rowBytes(), x, y); - } -} - void GraphicsContext::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint* paint) { if (contextDisabled()) diff --git a/sky/engine/platform/graphics/GraphicsContext.h b/sky/engine/platform/graphics/GraphicsContext.h index f08cefa98..92df2b77c 100644 --- a/sky/engine/platform/graphics/GraphicsContext.h +++ b/sky/engine/platform/graphics/GraphicsContext.h @@ -267,10 +267,6 @@ public: const FloatSize& tileScaleFactor, Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile, CompositeOperator = CompositeSourceOver); - // These methods write to the canvas and modify the opaque region, if tracked. - // Also drawLine(const IntPoint& point1, const IntPoint& point2) and fillRoundedRect - void writePixels(const SkImageInfo&, const void* pixels, size_t rowBytes, int x, int y); - void writePixels(const SkBitmap&, int x, int y); void drawBitmap(const SkBitmap&, SkScalar, SkScalar, const SkPaint* = 0); void drawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&, const SkPaint* = 0); void drawOval(const SkRect&, const SkPaint&); diff --git a/sky/engine/platform/graphics/Pattern.cpp b/sky/engine/platform/graphics/Pattern.cpp index 872adeb47..8b096e162 100644 --- a/sky/engine/platform/graphics/Pattern.cpp +++ b/sky/engine/platform/graphics/Pattern.cpp @@ -85,7 +85,7 @@ SkShader* Pattern::shader() // we explicitly require non-opaquness, since we are going to add a transparent strip. SkImageInfo newInfo = SkImageInfo::Make( info.width() + expandW, info.height() + expandH, info.colorType(), - kPremul_SkAlphaType, info.profileType()); + kPremul_SkAlphaType, sk_ref_sp(info.colorSpace())); SkBitmap bm2; bm2.allocPixels(newInfo); diff --git a/sky/engine/platform/graphics/skia/NativeImageSkia.cpp b/sky/engine/platform/graphics/skia/NativeImageSkia.cpp index 4a6a0691b..7455b2024 100644 --- a/sky/engine/platform/graphics/skia/NativeImageSkia.cpp +++ b/sky/engine/platform/graphics/skia/NativeImageSkia.cpp @@ -176,7 +176,7 @@ static SkBitmap createBitmapWithSpace(const SkBitmap& bitmap, int spaceWidth, in SkImageInfo info = bitmap.info(); SkImageInfo newInfo = SkImageInfo::Make( info.width() + spaceWidth, info.height() + spaceHeight, - info.colorType(), kPremul_SkAlphaType, info.profileType()); + info.colorType(), kPremul_SkAlphaType, sk_ref_sp(info.colorSpace())); SkBitmap result; result.allocPixels(newInfo); diff --git a/sky/shell/gpu/direct/ganesh_canvas.cc b/sky/shell/gpu/direct/ganesh_canvas.cc index 399325c01..a738ba20e 100644 --- a/sky/shell/gpu/direct/ganesh_canvas.cc +++ b/sky/shell/gpu/direct/ganesh_canvas.cc @@ -75,7 +75,7 @@ SkCanvas* GaneshCanvas::GetCanvas(int32_t fbo, const SkISize& size) { skia::RefPtr target = skia::AdoptRef( gr_context_->textureProvider()->wrapBackendRenderTarget(desc)); DCHECK(target); - sk_surface_ = SkSurface::MakeRenderTargetDirect(target.get()); + sk_surface_ = SkSurface::MakeRenderTargetDirect(target.get(), nullptr); DCHECK(sk_surface_); return sk_surface_->getCanvas(); } -- GitLab