Skip to content

Commit

Permalink
Update Skia (flutter#2626)
Browse files Browse the repository at this point in the history
  • Loading branch information
abarth committed Apr 27, 2016
1 parent 402efb9 commit 625e937
Show file tree
Hide file tree
Showing 132 changed files with 91 additions and 12,857 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ vars = {
'chromium_git': 'https://chromium.googlesource.com',
'mojo_sdk_revision': '0003a0c9bf29902779397b67139a5738c5834934',
'base_revision': '672b04e54b937ec899429a6bd5409c5a6300d151',
'skia_revision': 'ddf0713f0ba4ea75ca49a4ed6b4249eef72da1ce',
'skia_revision': '409ed73237c1fc42ea49ae89efdc4cddc7b6f600',

# Note: When updating the Dart revision, ensure that all entries that are
# dependencies of dart are also updated
Expand Down
4 changes: 2 additions & 2 deletions flow/layers/backdrop_filter_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class BackdropFilterLayer : public ContainerLayer {
BackdropFilterLayer();
~BackdropFilterLayer() override;

void set_filter(SkImageFilter* filter) { filter_ = skia::SharePtr(filter); }
void set_filter(sk_sp<SkImageFilter> filter) { filter_ = std::move(filter); }

protected:
void Paint(PaintContext& context) override;

private:
skia::RefPtr<SkImageFilter> filter_;
sk_sp<SkImageFilter> filter_;

DISALLOW_COPY_AND_ASSIGN(BackdropFilterLayer);
};
Expand Down
6 changes: 3 additions & 3 deletions flow/layers/color_filter_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ ColorFilterLayer::~ColorFilterLayer() {
}

void ColorFilterLayer::Paint(PaintContext& context) {
skia::RefPtr<SkColorFilter> color_filter =
skia::AdoptRef(SkColorFilter::CreateModeFilter(color_, transfer_mode_));
sk_sp<SkColorFilter> color_filter =
SkColorFilter::MakeModeFilter(color_, transfer_mode_);
SkPaint paint;
paint.setColorFilter(color_filter.get());
paint.setColorFilter(std::move(color_filter));

SkAutoCanvasRestore save(&context.canvas, false);
context.canvas.saveLayer(&paint_bounds(), &paint);
Expand Down
6 changes: 3 additions & 3 deletions flow/layers/picture_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PictureLayer : public Layer {

void set_offset(const SkPoint& offset) { offset_ = offset; }

void set_picture(SkPicture* picture) { picture_ = skia::SharePtr(picture); }
void set_picture(sk_sp<SkPicture> picture) { picture_ = std::move(picture); }

SkPicture* picture() const { return picture_.get(); }

Expand All @@ -25,10 +25,10 @@ class PictureLayer : public Layer {

private:
SkPoint offset_;
skia::RefPtr<SkPicture> picture_;
sk_sp<SkPicture> picture_;

// If we rasterized the picture separately, image_ holds the pixels.
skia::RefPtr<SkImage> image_;
sk_sp<SkImage> image_;

DISALLOW_COPY_AND_ASSIGN(PictureLayer);
};
Expand Down
8 changes: 4 additions & 4 deletions flow/raster_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RasterCache::Entry::Entry() {
RasterCache::Entry::~Entry() {
}

skia::RefPtr<SkImage> RasterCache::GetPrerolledImage(GrContext* context,
sk_sp<SkImage> RasterCache::GetPrerolledImage(GrContext* context,
SkPicture* picture,
const SkMatrix& ctm) {
#if ENABLE_RASTER_CACHE
Expand Down Expand Up @@ -79,15 +79,15 @@ skia::RefPtr<SkImage> RasterCache::GetPrerolledImage(GrContext* context,
"width", physical_size.width(),
"height", physical_size.height());
SkImageInfo info = SkImageInfo::MakeN32Premul(physical_size);
skia::RefPtr<SkSurface> surface = skia::AdoptRef(
SkSurface::NewRenderTarget(context, SkBudgeted::kYes, info));
sk_sp<SkSurface> surface =
SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, info);
if (surface) {
SkCanvas* canvas = surface->getCanvas();
canvas->clear(SK_ColorTRANSPARENT);
canvas->scale(scaleX, scaleY);
canvas->translate(-rect.left(), -rect.top());
canvas->drawPicture(picture);
entry.image = skia::AdoptRef(surface->newImageSnapshot());
entry.image = surface->makeImageSnapshot();
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions flow/raster_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RasterCache {
RasterCache();
~RasterCache();

skia::RefPtr<SkImage> GetPrerolledImage(
sk_sp<SkImage> GetPrerolledImage(
GrContext* context, SkPicture* picture, const SkMatrix& ctm);
void SweepAfterFrame();

Expand All @@ -35,7 +35,7 @@ class RasterCache {
bool used_this_frame = false;
int access_count = 0;
SkISize physical_size;
skia::RefPtr<SkImage> image;
sk_sp<SkImage> image;
};

using Cache = std::unordered_map<uint32_t, Entry>;
Expand Down
4 changes: 2 additions & 2 deletions mojo/skia/ganesh_framebuffer_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ GaneshFramebufferSurface::GaneshFramebufferSurface(
desc.fStencilBits = stencil_bits;
desc.fRenderTargetHandle = framebuffer_binding;

surface_ = ::skia::AdoptRef(SkSurface::NewFromBackendRenderTarget(
scope.gr_context().get(), desc, nullptr));
surface_ = SkSurface::MakeFromBackendRenderTarget(
scope.gr_context().get(), desc, nullptr);
DCHECK(surface_);
}

Expand Down
2 changes: 1 addition & 1 deletion mojo/skia/ganesh_framebuffer_surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class GaneshFramebufferSurface {
SkCanvas* canvas() const { return surface_->getCanvas(); }

private:
::skia::RefPtr<SkSurface> surface_;
sk_sp<SkSurface> surface_;

DISALLOW_COPY_AND_ASSIGN(GaneshFramebufferSurface);
};
Expand Down
6 changes: 3 additions & 3 deletions mojo/skia/ganesh_image_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void ReleaseThunk(void* data) {
}
} // namespace

::skia::RefPtr<SkImage> CreateImageFromTexture(
sk_sp<SkImage> CreateImageFromTexture(
const GaneshContext::Scope& scope,
uint32_t texture_id,
uint32_t width,
Expand All @@ -47,9 +47,9 @@ ::skia::RefPtr<SkImage> CreateImageFromTexture(
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = origin;
desc.fTextureHandle = reinterpret_cast<GrBackendObject>(&info);
return ::skia::AdoptRef(SkImage::NewFromTexture(
return SkImage::MakeFromTexture(
scope.gr_context().get(), desc, kPremul_SkAlphaType, &ReleaseThunk,
new base::Closure(release_callback)));
new base::Closure(release_callback));
}

MailboxTextureImageGenerator::MailboxTextureImageGenerator(
Expand Down
2 changes: 1 addition & 1 deletion mojo/skia/ganesh_image_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace skia {
// Creates an SkImage from a GL texture.
// The underlying texture must be kept alive for as long as the SkImage exists.
// Invokes |release_callback| when the SkImage is deleted.
::skia::RefPtr<SkImage> CreateImageFromTexture(
sk_sp<SkImage> CreateImageFromTexture(
const GaneshContext::Scope& scope,
uint32_t texture_id,
uint32_t width,
Expand Down
6 changes: 3 additions & 3 deletions mojo/skia/ganesh_texture_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ GaneshTextureSurface::GaneshTextureSurface(const GaneshContext::Scope& scope,
desc.fSampleCnt = 0;
desc.fTextureHandle = reinterpret_cast<GrBackendObject>(&info);

surface_ = ::skia::AdoptRef(SkSurface::NewFromBackendTexture(
scope.gr_context().get(), desc, nullptr));
surface_ = SkSurface::MakeFromBackendTexture(
scope.gr_context().get(), desc, nullptr);
DCHECK(surface_);
}

GaneshTextureSurface::~GaneshTextureSurface() {}

std::unique_ptr<GLTexture> GaneshTextureSurface::TakeTexture() {
surface_->getCanvas()->flush();
surface_.clear();
surface_ = nullptr;
return std::move(texture_);
}

Expand Down
2 changes: 1 addition & 1 deletion mojo/skia/ganesh_texture_surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class GaneshTextureSurface {

private:
std::unique_ptr<GLTexture> texture_;
::skia::RefPtr<SkSurface> surface_;
sk_sp<SkSurface> surface_;

DISALLOW_COPY_AND_ASSIGN(GaneshTextureSurface);
};
Expand Down
6 changes: 0 additions & 6 deletions skia/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,6 @@ component("skia") {
"ext/image_operations.h",
"ext/opacity_draw_filter.cc",
"ext/opacity_draw_filter.h",
"ext/pixel_ref_utils.cc",
"ext/pixel_ref_utils.h",
"ext/platform_canvas.cc",
"ext/platform_canvas.h",
"ext/platform_device.cc",
Expand Down Expand Up @@ -326,8 +324,6 @@ component("skia") {
"//third_party/skia/src/utils/SkFrontBufferedStream.cpp",
"//third_party/skia/src/utils/SkInterpolator.cpp",
"//third_party/skia/src/utils/SkLayer.cpp",
"//third_party/skia/src/utils/SkMD5.cpp",
"//third_party/skia/src/utils/SkMD5.h",
"//third_party/skia/src/utils/SkMeshUtils.cpp",
"//third_party/skia/src/utils/SkNinePatch.cpp",
"//third_party/skia/src/utils/SkOSFile.cpp",
Expand Down Expand Up @@ -414,7 +410,6 @@ component("skia") {
sources -= [
"//third_party/skia/src/ports/SkOSFile_posix.cpp",
"//third_party/skia/src/ports/SkTLS_pthread.cpp",
"//third_party/skia/src/ports/SkTime_Unix.cpp",
]
} else {
sources -= [
Expand Down Expand Up @@ -614,7 +609,6 @@ test("skia_unittests") {
"ext/bitmap_platform_device_mac_unittest.cc",
"ext/convolver_unittest.cc",
"ext/image_operations_unittest.cc",
"ext/pixel_ref_utils_unittest.cc",
"ext/platform_canvas_unittest.cc",
"ext/recursive_gaussian_convolution_unittest.cc",
"ext/refptr_unittest.cc",
Expand Down
Loading

0 comments on commit 625e937

Please sign in to comment.