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

Unified Diff: bench/XfermodeBench.cpp

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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
Index: bench/XfermodeBench.cpp
diff --git a/bench/XfermodeBench.cpp b/bench/XfermodeBench.cpp
index 9eae7cef6c0474a427f956cffbf8ee4ebc13dc4b..829c437e092e9eb3cd80b7ecaa735fd02a58975b 100644
--- a/bench/XfermodeBench.cpp
+++ b/bench/XfermodeBench.cpp
@@ -16,7 +16,7 @@
class XfermodeBench : public Benchmark {
public:
XfermodeBench(SkXfermode::Mode mode, bool aa) {
- fXfermode.reset(SkXfermode::Create(mode));
+ fXfermode = SkXfermode::Make(mode);
fAA = aa;
SkASSERT(fXfermode.get() || SkXfermode::kSrcOver_Mode == mode);
fName.printf("Xfermode_%s%s", SkXfermode::ModeName(mode), aa ? "_aa" : "");
@@ -39,7 +39,7 @@ protected:
SkRandom random;
for (int i = 0; i < loops; ++i) {
SkPaint paint;
- paint.setXfermode(fXfermode.get());
+ paint.setXfermode(fXfermode);
paint.setColor(random.nextU());
if (fAA) {
// Draw text to exercise AA code paths.
@@ -68,9 +68,9 @@ protected:
}
private:
- SkAutoTUnref<SkXfermode> fXfermode;
- SkString fName;
- bool fAA;
+ sk_sp<SkXfermode> fXfermode;
+ SkString fName;
+ bool fAA;
typedef Benchmark INHERITED;
};
@@ -87,8 +87,7 @@ protected:
void onDraw(int loops, SkCanvas* canvas) override {
for (int outer = 0; outer < loops * 10; ++outer) {
for (int i = 0; i <= SkXfermode::kLastMode; ++i) {
- SkXfermode* xfer = SkXfermode::Create(SkXfermode::Mode(i));
- SkSafeUnref(xfer);
+ (void)SkXfermode::Make(SkXfermode::Mode(i));
}
}
}

Powered by Google App Engine
This is Rietveld 408576698