Convert SkAutoTUnref<SkData> to sk_sp<SkData>.
With the move from SkData::NewXXX to SkData::MakeXXX most
SkAutoTUnref<SkData> were changed to sk_sp<SkData>. However,
there are still a few SkAutoTUnref<SkData> around, so clean
them up.
Review-Url: https://codereview.chromium.org/2212493002
diff --git a/bench/AndroidCodecBench.cpp b/bench/AndroidCodecBench.cpp
index 97e1176..6443ce6 100644
--- a/bench/AndroidCodecBench.cpp
+++ b/bench/AndroidCodecBench.cpp
@@ -29,7 +29,7 @@
}
void AndroidCodecBench::onDelayedSetup() {
- SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromData(fData));
+ SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromData(fData.get()));
SkISize scaledSize = codec->getSampledDimensions(fSampleSize);
fInfo = codec->getInfo().makeWH(scaledSize.width(), scaledSize.height())
@@ -46,7 +46,7 @@
SkAndroidCodec::AndroidOptions options;
options.fSampleSize = fSampleSize;
for (int i = 0; i < n; i++) {
- codec.reset(SkAndroidCodec::NewFromData(fData));
+ codec.reset(SkAndroidCodec::NewFromData(fData.get()));
#ifdef SK_DEBUG
const SkCodec::Result result =
#endif
diff --git a/bench/AndroidCodecBench.h b/bench/AndroidCodecBench.h
index fdbec52..8cdd7fe 100644
--- a/bench/AndroidCodecBench.h
+++ b/bench/AndroidCodecBench.h
@@ -30,7 +30,7 @@
private:
SkString fName;
- SkAutoTUnref<SkData> fData;
+ sk_sp<SkData> fData;
const int fSampleSize;
SkImageInfo fInfo; // Set in onDelayedSetup.
SkAutoMalloc fPixelStorage; // Set in onDelayedSetup.
diff --git a/bench/BitmapRegionDecoderBench.cpp b/bench/BitmapRegionDecoderBench.cpp
index dd60b18..709ad0e 100644
--- a/bench/BitmapRegionDecoderBench.cpp
+++ b/bench/BitmapRegionDecoderBench.cpp
@@ -36,7 +36,8 @@
}
void BitmapRegionDecoderBench::onDelayedSetup() {
- fBRD.reset(SkBitmapRegionDecoder::Create(fData, SkBitmapRegionDecoder::kAndroidCodec_Strategy));
+ fBRD.reset(SkBitmapRegionDecoder::Create(fData.get(),
+ SkBitmapRegionDecoder::kAndroidCodec_Strategy));
}
void BitmapRegionDecoderBench::onDraw(int n, SkCanvas* canvas) {
diff --git a/bench/BitmapRegionDecoderBench.h b/bench/BitmapRegionDecoderBench.h
index 69588b2..2fb56ad 100644
--- a/bench/BitmapRegionDecoderBench.h
+++ b/bench/BitmapRegionDecoderBench.h
@@ -36,7 +36,7 @@
private:
SkString fName;
SkAutoTDelete<SkBitmapRegionDecoder> fBRD;
- SkAutoTUnref<SkData> fData;
+ sk_sp<SkData> fData;
const SkColorType fColorType;
const uint32_t fSampleSize;
const SkIRect fSubset;
diff --git a/bench/CodecBench.cpp b/bench/CodecBench.cpp
index 9bd404d..e3bf1cc 100644
--- a/bench/CodecBench.cpp
+++ b/bench/CodecBench.cpp
@@ -26,7 +26,7 @@
alpha_type_to_str(alphaType));
#ifdef SK_DEBUG
// Ensure that we can create an SkCodec from this data.
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData));
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData.get()));
SkASSERT(codec);
#endif
}
@@ -40,7 +40,7 @@
}
void CodecBench::onDelayedSetup() {
- SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData));
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fData.get()));
fInfo = codec->getInfo().makeColorType(fColorType)
.makeAlphaType(fAlphaType)
@@ -59,7 +59,7 @@
}
for (int i = 0; i < n; i++) {
colorCount = 256;
- codec.reset(SkCodec::NewFromData(fData));
+ codec.reset(SkCodec::NewFromData(fData.get()));
#ifdef SK_DEBUG
const SkCodec::Result result =
#endif
diff --git a/bench/CodecBench.h b/bench/CodecBench.h
index b465eae..5b4db24 100644
--- a/bench/CodecBench.h
+++ b/bench/CodecBench.h
@@ -32,7 +32,7 @@
SkString fName;
const SkColorType fColorType;
const SkAlphaType fAlphaType;
- SkAutoTUnref<SkData> fData;
+ sk_sp<SkData> fData;
SkImageInfo fInfo; // Set in onDelayedSetup.
SkAutoMalloc fPixelStorage;
typedef Benchmark INHERITED;
diff --git a/bench/EncoderBench.cpp b/bench/EncoderBench.cpp
index 8a82a7c..d7ddfbc 100644
--- a/bench/EncoderBench.cpp
+++ b/bench/EncoderBench.cpp
@@ -54,7 +54,7 @@
void onDraw(int loops, SkCanvas*) override {
for (int i = 0; i < loops; i++) {
- SkAutoTUnref<SkData> data(SkImageEncoder::EncodeData(fBitmap, fType, fQuality));
+ sk_sp<SkData> data(SkImageEncoder::EncodeData(fBitmap, fType, fQuality));
SkASSERT(data);
}
}