Skip to content

Instantly share code, notes, and snippets.

@chinmaygarde
Created June 30, 2015 19:21
Show Gist options
  • Save chinmaygarde/827aaaee5f78bf884547 to your computer and use it in GitHub Desktop.
Save chinmaygarde/827aaaee5f78bf884547 to your computer and use it in GitHub Desktop.
diff --git a/DEPS b/DEPS
index 0a6fd25..3422ceb 100644
--- a/DEPS
+++ b/DEPS
@@ -20,7 +20,7 @@
vars = {
'chromium_git': 'https://chromium.googlesource.com',
'dart_svn': 'https://dart.googlecode.com',
- 'skia_revision': '409fd66a5afcef5f165f7ccec7c3473add231752',
+ 'skia_revision': '7b971f0152299ae9a924252a9bfd220318497bdd',
'v8_revision': '230d131d173ab2d60291d303177bc04ec3f6e519',
'angle_revision': 'bdd419f9f5b006e913606e7363125942c8ae06bc',
'buildtools_revision': 'fa660d47fa1a6c649d5c29e001348447c55709e6',
diff --git a/skia/ext/analysis_canvas.cc b/skia/ext/analysis_canvas.cc
index 0ff1660..d7b2f0e 100644
--- a/skia/ext/analysis_canvas.cc
+++ b/skia/ext/analysis_canvas.cc
@@ -325,7 +325,7 @@ bool AnalysisCanvas::GetColorIfSolid(SkColor* color) const {
return false;
}
-bool AnalysisCanvas::abortDrawing() {
+bool AnalysisCanvas::abort() {
// Early out as soon as we have more than one draw op.
// TODO(vmpstr): Investigate if 1 is the correct metric here. We need to
// balance the amount of time we spend analyzing vs how many tiles would be
diff --git a/skia/ext/analysis_canvas.h b/skia/ext/analysis_canvas.h
index 6af139f..f21b8d0 100644
--- a/skia/ext/analysis_canvas.h
+++ b/skia/ext/analysis_canvas.h
@@ -7,7 +7,7 @@
#include "base/compiler_specific.h"
#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkDrawPictureCallback.h"
+#include "third_party/skia/include/core/SkPicture.h"
namespace skia {
@@ -15,7 +15,8 @@ namespace skia {
// (specified as a clip rectangle) of an SkPicture as the picture is
// played back through it.
// To use: play a picture into the canvas, and then check result.
-class SK_API AnalysisCanvas : public SkCanvas, public SkDrawPictureCallback {
+class SK_API AnalysisCanvas : public SkCanvas,
+ public SkPicture::AbortCallback {
public:
AnalysisCanvas(int width, int height);
~AnalysisCanvas() override;
@@ -26,8 +27,8 @@ class SK_API AnalysisCanvas : public SkCanvas, public SkDrawPictureCallback {
void SetForceNotSolid(bool flag);
void SetForceNotTransparent(bool flag);
- // SkDrawPictureCallback override.
- bool abortDrawing() override;
+ // SkPicture::AbortCallback override.
+ bool abort() override;
// SkCanvas overrides.
void onDrawPaint(const SkPaint& paint) override;
diff --git a/sky/engine/platform/graphics/DecodingImageGenerator.cpp b/sky/engine/platform/graphics/DecodingImageGenerator.cpp
index 72be8ef..25d3559 100644
--- a/sky/engine/platform/graphics/DecodingImageGenerator.cpp
+++ b/sky/engine/platform/graphics/DecodingImageGenerator.cpp
@@ -34,8 +34,8 @@
namespace blink {
DecodingImageGenerator::DecodingImageGenerator(PassRefPtr<ImageFrameGenerator> 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<int>(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/sky/engine/platform/graphics/DecodingImageGenerator.h b/sky/engine/platform/graphics/DecodingImageGenerator.h
index a2e948e..19578e6 100644
--- a/sky/engine/platform/graphics/DecodingImageGenerator.h
+++ b/sky/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<ImageFrameGenerator> m_frameGenerator;
- SkImageInfo m_imageInfo;
size_t m_frameIndex;
size_t m_generationId;
};
diff --git a/sky/engine/platform/graphics/Path.cpp b/sky/engine/platform/graphics/Path.cpp
index 9151dd7..5ac7f78 100644
--- a/sky/engine/platform/graphics/Path.cpp
+++ b/sky/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/sky/engine/platform/graphics/skia/GaneshUtils.cpp b/sky/engine/platform/graphics/skia/GaneshUtils.cpp
index 18b16fa..05bcac3 100644
--- a/sky/engine/platform/graphics/skia/GaneshUtils.cpp
+++ b/sky/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<GrTexture> texture(gr->createUncachedTexture(desc, 0, 0));
+ SkAutoTUnref<GrTexture> texture(gr->textureProvider()->createTexture(desc, false, 0, 0));
if (!texture.get())
return false;
diff --git a/sky/engine/platform/graphics/skia/SkiaUtils.cpp b/sky/engine/platform/graphics/skia/SkiaUtils.cpp
index e7d932c..8da890b 100644
--- a/sky/engine/platform/graphics/skia/SkiaUtils.cpp
+++ b/sky/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/sky/shell/gpu/ganesh_surface.cc b/sky/shell/gpu/ganesh_surface.cc
index e64853f..bc175ae 100644
--- a/sky/shell/gpu/ganesh_surface.cc
+++ b/sky/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_);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment