diff --git a/engine/platform/graphics/DecodingImageGenerator.cpp b/engine/platform/graphics/DecodingImageGenerator.cpp index 72be8ef6b6f..25d355968b7 100644 --- a/engine/platform/graphics/DecodingImageGenerator.cpp +++ b/engine/platform/graphics/DecodingImageGenerator.cpp @@ -34,8 +34,8 @@ namespace blink { DecodingImageGenerator::DecodingImageGenerator(PassRefPtr frameGenerator, const SkImageInfo& info, size_t index) - : m_frameGenerator(frameGenerator) - , m_imageInfo(info) + : SkImageGenerator(info) + , m_frameGenerator(frameGenerator) , m_frameIndex(index) , m_generationId(0) { @@ -58,24 +58,18 @@ SkData* DecodingImageGenerator::onRefEncodedData() return 0; } -bool DecodingImageGenerator::onGetInfo(SkImageInfo* info) -{ - *info = m_imageInfo; - return true; -} - -SkImageGenerator::Result DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctable[], int* ctableCount) +SkImageGenerator::Result DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options& options, SkPMColor ctable[], int* ctableCount) { TRACE_EVENT1("blink", "DecodingImageGenerator::getPixels", "index", static_cast(m_frameIndex)); // Implementation doesn't support scaling yet so make sure we're not given a different size. - if (info.width() != m_imageInfo.width() || info.height() != m_imageInfo.height() || info.colorType() != m_imageInfo.colorType()) { + if (info.width() != info.width() || info.height() != info.height() || info.colorType() != info.colorType()) { // ImageFrame may have changed the owning SkBitmap to kOpaque_SkAlphaType after sniffing the encoded data, so if we see a request // for opaque, that is ok even if our initial alphatype was not opaque. return Result::kInvalidScale; } - bool decoded = m_frameGenerator->decodeAndScale(m_imageInfo, m_frameIndex, pixels, rowBytes); + bool decoded = m_frameGenerator->decodeAndScale(info, m_frameIndex, pixels, rowBytes); return decoded ? Result::kSuccess : Result::kInvalidInput; } diff --git a/engine/platform/graphics/DecodingImageGenerator.h b/engine/platform/graphics/DecodingImageGenerator.h index fb2d21eb398..c3826be215b 100644 --- a/engine/platform/graphics/DecodingImageGenerator.h +++ b/engine/platform/graphics/DecodingImageGenerator.h @@ -50,13 +50,11 @@ public: protected: virtual SkData* onRefEncodedData() override; - virtual bool onGetInfo(SkImageInfo*) override; - virtual Result onGetPixels(const SkImageInfo&, void* pixels, size_t rowBytes, SkPMColor ctable[], int* ctableCount) override; + virtual Result onGetPixels(const SkImageInfo&, void* pixels, size_t rowBytes, const Options& options, SkPMColor ctable[], int* ctableCount) override; virtual bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3]) override; private: RefPtr m_frameGenerator; - SkImageInfo m_imageInfo; size_t m_frameIndex; size_t m_generationId; }; diff --git a/engine/platform/graphics/Path.cpp b/engine/platform/graphics/Path.cpp index 9151dd725ff..5ac7f788d43 100644 --- a/engine/platform/graphics/Path.cpp +++ b/engine/platform/graphics/Path.cpp @@ -481,17 +481,17 @@ void Path::translate(const FloatSize& size) bool Path::subtractPath(const Path& other) { - return Op(m_path, other.m_path, kDifference_PathOp, &m_path); + return Op(m_path, other.m_path, kDifference_SkPathOp, &m_path); } bool Path::intersectPath(const Path& other) { - return Op(m_path, other.m_path, kIntersect_PathOp, &m_path); + return Op(m_path, other.m_path, kIntersect_SkPathOp, &m_path); } bool Path::unionPath(const Path& other) { - return Op(m_path, other.m_path, kUnion_PathOp, &m_path); + return Op(m_path, other.m_path, kUnion_SkPathOp, &m_path); } #if ENABLE(ASSERT) diff --git a/engine/platform/graphics/skia/GaneshUtils.cpp b/engine/platform/graphics/skia/GaneshUtils.cpp index 18b16fa5e8a..05bcac32a07 100644 --- a/engine/platform/graphics/skia/GaneshUtils.cpp +++ b/engine/platform/graphics/skia/GaneshUtils.cpp @@ -42,12 +42,12 @@ bool ensureTextureBackedSkBitmap(GrContext* gr, SkBitmap& bitmap, const IntSize& return false; GrTextureDesc desc; desc.fConfig = config; - desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; + desc.fFlags = kRenderTarget_GrSurfaceFlag; desc.fSampleCnt = 0; desc.fOrigin = origin; desc.fWidth = size.width(); desc.fHeight = size.height(); - SkAutoTUnref texture(gr->createUncachedTexture(desc, 0, 0)); + SkAutoTUnref texture(gr->textureProvider()->createTexture(desc, false, 0, 0)); if (!texture.get()) return false; diff --git a/engine/platform/graphics/skia/SkiaUtils.cpp b/engine/platform/graphics/skia/SkiaUtils.cpp index e7d932c8432..8da890b7849 100644 --- a/engine/platform/graphics/skia/SkiaUtils.cpp +++ b/engine/platform/graphics/skia/SkiaUtils.cpp @@ -147,7 +147,7 @@ bool SkPathContainsPoint(const SkPath& originalPath, const FloatPoint& point, Sk biggestCoord = std::max(std::max(biggestCoord, fX + 1), fY + 1); const SkScalar kMaxCoordinate = SkIntToScalar(1 << 15); - SkScalar scale = SkScalarDiv(kMaxCoordinate, biggestCoord); + SkScalar scale = kMaxCoordinate / biggestCoord; SkRegion rgn; SkRegion clip; diff --git a/shell/gpu/ganesh_surface.cc b/shell/gpu/ganesh_surface.cc index e64853f8e83..bc175aeb505 100644 --- a/shell/gpu/ganesh_surface.cc +++ b/shell/gpu/ganesh_surface.cc @@ -20,7 +20,8 @@ GaneshSurface::GaneshSurface(intptr_t window_fbo, desc.fOrigin = kBottomLeft_GrSurfaceOrigin; desc.fRenderTargetHandle = window_fbo; - auto target = skia::AdoptRef(context->gr()->wrapBackendRenderTarget(desc)); + auto target = skia::AdoptRef( + context->gr()->textureProvider()->wrapBackendRenderTarget(desc)); DCHECK(target); surface_ = skia::AdoptRef(SkSurface::NewRenderTargetDirect(target.get())); DCHECK(surface_);