Make sure SkDrawLooper objects can only be allocated on the heap.
Make constructors of SkLayerDrawLooper and SkBlurDrawLooper non-public.
Remove addLayer* methods from SkLayerDrawLooper. SkLayerDrawLooper::Builder is
used to create new objects.
Provide factory method for creating SkBlurDrawLooper.
BUG=2141
R=scroggo@google.com, reed@google.com, djsollen@google.com
Author: dominikg@chromium.org
Review URL: https://codereview.chromium.org/232913003
git-svn-id: http://skia.googlecode.com/svn/trunk@14200 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/tilemodes_scaled.cpp b/gm/tilemodes_scaled.cpp
index bbb86a7..e9c6c99 100644
--- a/gm/tilemodes_scaled.cpp
+++ b/gm/tilemodes_scaled.cpp
@@ -13,6 +13,7 @@
#include "SkColorPriv.h"
#include "SkColorFilter.h"
#include "SkTypeface.h"
+#include "SkBlurMask.h"
// effects
#include "SkGradientShader.h"
@@ -55,10 +56,12 @@
};
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(0x88000000,
+ SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(1)),
+ SkIntToScalar(2), SkIntToScalar(2)))
, fPowerOfTwoSize(powerOfTwoSize) {
}
@@ -117,7 +120,7 @@
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 +160,7 @@
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);
}