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

Unified Diff: gm/imagefiltersgraph.cpp

Issue 203273002: Put SimpleOffsetFilter on heap. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: interface Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefiltersgraph.cpp
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index 8885f0d23127e6f2d4f66e301577871517a5c760..83903792d4e858b73850b495a727e07793bbf923 100644
--- a/gm/imagefiltersgraph.cpp
+++ b/gm/imagefiltersgraph.cpp
@@ -26,8 +26,9 @@
// perform a draw and this one does.
class SimpleOffsetFilter : public SkImageFilter {
public:
- SimpleOffsetFilter(SkScalar dx, SkScalar dy, SkImageFilter* input)
- : SkImageFilter(input), fDX(dx), fDY(dy) {}
+ static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input) {
+ return SkNEW_ARGS(SimpleOffsetFilter, (dx, dy, input));
+ }
virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx,
SkBitmap* dst, SkIPoint* offset) const SK_OVERRIDE {
@@ -70,6 +71,9 @@ protected:
}
private:
+ SimpleOffsetFilter(SkScalar dx, SkScalar dy, SkImageFilter* input)
+ : SkImageFilter(input), fDX(dx), fDY(dy) {}
+
SkScalar fDX, fDY;
};
@@ -157,11 +161,12 @@ protected:
0, 0, 0, 0.5f, 0 };
SkAutoTUnref<SkColorMatrixFilter> matrixCF(SkColorMatrixFilter::Create(matrix));
SkAutoTUnref<SkImageFilter> matrixFilter(SkColorFilterImageFilter::Create(matrixCF));
- SimpleOffsetFilter offsetFilter(SkIntToScalar(10), SkIntToScalar(10), matrixFilter);
+ SkAutoTUnref<SkImageFilter> offsetFilter(
+ SimpleOffsetFilter::Create(10.0f, 10.f, matrixFilter));
SkAutoTUnref<SkXfermode> arith(SkArithmeticMode::Create(0, SK_Scalar1, SK_Scalar1, 0));
SkAutoTUnref<SkXfermodeImageFilter> arithFilter(
- SkXfermodeImageFilter::Create(arith, matrixFilter, &offsetFilter));
+ SkXfermodeImageFilter::Create(arith, matrixFilter, offsetFilter));
SkPaint paint;
paint.setImageFilter(arithFilter);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698