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

Unified Diff: gm/blurroundrect.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: rebase 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
« no previous file with comments | « bench/RectoriBench.cpp ('k') | gm/circles.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/blurroundrect.cpp
diff --git a/gm/blurroundrect.cpp b/gm/blurroundrect.cpp
index 6c3903fd4070f03c2ae7fdbc4c89363bdc392e2e..f688380f0e0253e6b96d6ca406c5fcd150d89c6d 100644
--- a/gm/blurroundrect.cpp
+++ b/gm/blurroundrect.cpp
@@ -53,7 +53,7 @@ public:
}
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
- SkLayerDrawLooper* looper = new SkLayerDrawLooper;
+ SkLayerDrawLooper::Builder looperBuilder;
{
SkLayerDrawLooper::LayerInfo info;
info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit
@@ -61,7 +61,7 @@ public:
info.fColorMode = SkXfermode::kSrc_Mode;
info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0));
info.fPostTranslate = false;
- SkPaint* paint = looper->addLayerOnTop(info);
+ SkPaint* paint = looperBuilder.addLayerOnTop(info);
SkMaskFilter* maskFilter = SkBlurMaskFilter::Create(
SkBlurMaskFilter::kNormal_BlurStyle,
SkBlurMask::ConvertRadiusToSigma(SK_ScalarHalf),
@@ -74,12 +74,12 @@ public:
}
{
SkLayerDrawLooper::LayerInfo info;
- looper->addLayerOnTop(info);
+ looperBuilder.addLayerOnTop(info);
}
SkPaint paint;
canvas->drawRect(fRRect.rect(), paint);
- paint.setLooper(looper)->unref();
+ paint.setLooper(looperBuilder.detachLooper())->unref();
paint.setColor(SK_ColorCYAN);
paint.setAntiAlias(true);
« no previous file with comments | « bench/RectoriBench.cpp ('k') | gm/circles.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698