From ede7bac43fbc69b9fdf1c178890ba6353f5bb140 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Sun, 23 Jul 2017 15:30:02 -0400 Subject: use unique_ptr for codec factories Will need guards for android (at least) Bug: skia: Change-Id: I2bb8e656997984489ef1f2e41cd3d301c4e7b947 Reviewed-on: https://skia-review.googlesource.com/26040 Reviewed-by: Mike Klein Commit-Queue: Mike Reed --- dm/DM.cpp | 2 +- dm/DMSrcSink.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'dm') diff --git a/dm/DM.cpp b/dm/DM.cpp index 1b8888935b..698a79c962 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -531,7 +531,7 @@ static void push_codec_srcs(Path path) { info("Couldn't read %s.", path.c_str()); return; } - std::unique_ptr codec(SkCodec::NewFromData(encoded)); + std::unique_ptr codec = SkCodec::MakeFromData(encoded); if (nullptr == codec.get()) { info("Couldn't create codec for %s.", path.c_str()); return; diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 6876254ce7..0e295a09c9 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -419,7 +419,7 @@ Error CodecSrc::draw(SkCanvas* canvas) const { return SkStringPrintf("Couldn't read %s.", fPath.c_str()); } - std::unique_ptr codec(SkCodec::NewFromData(encoded)); + std::unique_ptr codec(SkCodec::MakeFromData(encoded)); if (nullptr == codec.get()) { return SkStringPrintf("Couldn't create codec for %s.", fPath.c_str()); } @@ -757,7 +757,7 @@ Error CodecSrc::draw(SkCanvas* canvas) const { SkISize CodecSrc::size() const { sk_sp encoded(SkData::MakeFromFileName(fPath.c_str())); - std::unique_ptr codec(SkCodec::NewFromData(encoded)); + std::unique_ptr codec(SkCodec::MakeFromData(encoded)); if (nullptr == codec) { return {0, 0}; } @@ -818,8 +818,8 @@ Error AndroidCodecSrc::draw(SkCanvas* canvas) const { if (!encoded) { return SkStringPrintf("Couldn't read %s.", fPath.c_str()); } - std::unique_ptr codec(SkAndroidCodec::NewFromData(encoded)); - if (nullptr == codec.get()) { + std::unique_ptr codec(SkAndroidCodec::MakeFromData(encoded)); + if (nullptr == codec) { return SkStringPrintf("Couldn't create android codec for %s.", fPath.c_str()); } @@ -869,7 +869,7 @@ Error AndroidCodecSrc::draw(SkCanvas* canvas) const { SkISize AndroidCodecSrc::size() const { sk_sp encoded(SkData::MakeFromFileName(fPath.c_str())); - std::unique_ptr codec(SkAndroidCodec::NewFromData(encoded)); + std::unique_ptr codec(SkAndroidCodec::MakeFromData(encoded)); if (nullptr == codec) { return {0, 0}; } @@ -990,7 +990,7 @@ Error ImageGenSrc::draw(SkCanvas* canvas) const { SkISize ImageGenSrc::size() const { sk_sp encoded(SkData::MakeFromFileName(fPath.c_str())); - std::unique_ptr codec(SkCodec::NewFromData(encoded)); + std::unique_ptr codec(SkCodec::MakeFromData(encoded)); if (nullptr == codec) { return {0, 0}; } @@ -1052,8 +1052,8 @@ Error ColorCodecSrc::draw(SkCanvas* canvas) const { return SkStringPrintf("Couldn't read %s.", fPath.c_str()); } - std::unique_ptr codec(SkCodec::NewFromData(encoded)); - if (nullptr == codec.get()) { + std::unique_ptr codec(SkCodec::MakeFromData(encoded)); + if (nullptr == codec) { return SkStringPrintf("Couldn't create codec for %s.", fPath.c_str()); } @@ -1123,7 +1123,7 @@ Error ColorCodecSrc::draw(SkCanvas* canvas) const { SkISize ColorCodecSrc::size() const { sk_sp encoded(SkData::MakeFromFileName(fPath.c_str())); - std::unique_ptr codec(SkCodec::NewFromData(encoded)); + std::unique_ptr codec(SkCodec::MakeFromData(encoded)); if (nullptr == codec) { return {0, 0}; } -- cgit v1.2.3