Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Unified Diff: src/core/SkBlitter.cpp

Issue 1772463002: use Make instead of Create to return a shared shader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBitmapProcShader.cpp ('k') | src/core/SkColorFilterShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBlitter.cpp
diff --git a/src/core/SkBlitter.cpp b/src/core/SkBlitter.cpp
index bb5cfb72e3af36efa20663c014f8d1f2e3b14499..9fcab9c98225ec5ea18ccb1e8f8b40a0eb772fe7 100644
--- a/src/core/SkBlitter.cpp
+++ b/src/core/SkBlitter.cpp
@@ -584,13 +584,7 @@ SkBlitter* SkBlitterClipper::apply(SkBlitter* blitter, const SkRegion* clip,
class Sk3DShader : public SkShader {
public:
- Sk3DShader(SkShader* proxy) : fProxy(proxy) {
- SkSafeRef(proxy);
- }
-
- virtual ~Sk3DShader() {
- SkSafeUnref(fProxy);
- }
+ Sk3DShader(sk_sp<SkShader> proxy) : fProxy(std::move(proxy)) {}
size_t onContextSize(const ContextRec& rec) const override {
size_t size = sizeof(Sk3DShaderContext);
@@ -727,18 +721,17 @@ public:
protected:
void flatten(SkWriteBuffer& buffer) const override {
- buffer.writeFlattenable(fProxy);
+ buffer.writeFlattenable(fProxy.get());
}
private:
- SkShader* fProxy;
+ sk_sp<SkShader> fProxy;
typedef SkShader INHERITED;
};
SkFlattenable* Sk3DShader::CreateProc(SkReadBuffer& buffer) {
- SkAutoTUnref<SkShader> shader(buffer.readShader());
- return new Sk3DShader(shader);
+ return new Sk3DShader(buffer.readShader());
}
class Sk3DBlitter : public SkBlitter {
@@ -822,7 +815,7 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
if (origPaint.getMaskFilter() != nullptr &&
origPaint.getMaskFilter()->getFormat() == SkMask::k3D_Format) {
- shader3D = new Sk3DShader(shader);
+ shader3D = new Sk3DShader(sk_sp<SkShader>(SkSafeRef(shader)));
// we know we haven't initialized lazyPaint yet, so just do it
paint.writable()->setShader(shader3D)->unref();
shader = shader3D;
« no previous file with comments | « src/core/SkBitmapProcShader.cpp ('k') | src/core/SkColorFilterShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698