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

Unified Diff: gm/tilemodes_scaled.cpp

Issue 232913003: Make sure SkDrawLooper objects can only be allocated on the heap. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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: gm/tilemodes_scaled.cpp
diff --git a/gm/tilemodes_scaled.cpp b/gm/tilemodes_scaled.cpp
index 932d3f72200c174c60b41e5bb4b668f54dbb9edb..ef3c2b99e0432d2dccee2ff1ab0257676798112e 100644
--- a/gm/tilemodes_scaled.cpp
+++ b/gm/tilemodes_scaled.cpp
@@ -55,10 +55,11 @@ static const SkColorType gColorTypes[] = {
};
class ScaledTilingGM : public skiagm::GM {
- SkBlurDrawLooper fLooper;
+ SkAutoTUnref<SkBlurDrawLooper> fLooper;
public:
ScaledTilingGM(bool powerOfTwoSize)
- : fLooper(SkIntToScalar(1), SkIntToScalar(2), SkIntToScalar(2), 0x88000000)
+ : fLooper(SkBlurDrawLooper::Create(SkIntToScalar(1), SkIntToScalar(2),
+ SkIntToScalar(2), 0x88000000))
, fPowerOfTwoSize(powerOfTwoSize) {
}
@@ -117,7 +118,7 @@ protected:
SkString str;
p.setAntiAlias(true);
p.setDither(true);
- p.setLooper(&fLooper);
+ p.setLooper(fLooper);
str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]);
p.setTextAlign(SkPaint::kCenter_Align);
@@ -157,7 +158,7 @@ protected:
SkPaint p;
SkString str;
p.setAntiAlias(true);
- p.setLooper(&fLooper);
+ p.setLooper(fLooper);
str.printf("%s, %s", gColorTypeNames[i], gFilterNames[j]);
canvas->drawText(str.c_str(), str.size(), scale*x, scale*(y + r.height() * 2 / 3), p);
}

Powered by Google App Engine
This is Rietveld 408576698