From 0a2bf90dccba3bde188e0386a7f0c60e6dde1ae9 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Thu, 20 Feb 2014 20:40:19 +0000 Subject: Factory methods for heap-allocated SkPathEffect and SkXfermode objects. This is part of an effort to ensure that all SkPaint effects can only be allocated on the heap. This patch makes the constructors of SkPathEffect, SkXfermode and their subclasses non-public and instead provides factory methods for creating these objects on the heap. We temporarily keep the constructors of the following classes public to not break Chrome/Blink: SkXfermode SkCornerPathEffect SkDashPathEffect BUG=skia:2187 R=scroggo@google.com, reed@google.com, mtklein@google.com, bungeman@google.com Author: dominikg@chromium.org Review URL: https://codereview.chromium.org/166583002 git-svn-id: http://skia.googlecode.com/svn/trunk@13519 2bbb7eff-a529-9590-31e7-b0007b416f81 --- bench/DashBench.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'bench') diff --git a/bench/DashBench.cpp b/bench/DashBench.cpp index 2e4bc376bc..365eee9841 100644 --- a/bench/DashBench.cpp +++ b/bench/DashBench.cpp @@ -71,8 +71,8 @@ protected: SkPath path; this->makePath(&path); - paint.setPathEffect(new SkDashPathEffect(fIntervals.begin(), - fIntervals.count(), 0))->unref(); + paint.setPathEffect(SkDashPathEffect::Create(fIntervals.begin(), + fIntervals.count(), 0))->unref(); if (fDoClip) { SkRect r = path.getBounds(); @@ -186,7 +186,7 @@ public: proc(&fPath); SkScalar vals[] = { SkIntToScalar(4), SkIntToScalar(4) }; - fPE.reset(new SkDashPathEffect(vals, 2, 0)); + fPE.reset(SkDashPathEffect::Create(vals, 2, 0)); } protected: @@ -224,7 +224,7 @@ public: fIsRound = isRound; SkScalar vals[] = { SK_Scalar1, SK_Scalar1 }; - fPE.reset(new SkDashPathEffect(vals, 2, 0)); + fPE.reset(SkDashPathEffect::Create(vals, 2, 0)); } protected: @@ -263,7 +263,7 @@ public: fDoAA = doAA; SkScalar vals[] = { SkIntToScalar(dashLength), SkIntToScalar(dashLength) }; - fPathEffect.reset(new SkDashPathEffect(vals, 2, SK_Scalar1, false)); + fPathEffect.reset(SkDashPathEffect::Create(vals, 2, SK_Scalar1, false)); } protected: @@ -323,8 +323,8 @@ public: // deliberately pick intervals that won't be caught by asPoints(), so // we can test the filterPath code-path. const SkScalar intervals[] = { 2, 1, 1, 1 }; - fPathEffect.reset(new SkDashPathEffect(intervals, - SK_ARRAY_COUNT(intervals), 0)); + fPathEffect.reset(SkDashPathEffect::Create(intervals, + SK_ARRAY_COUNT(intervals), 0)); SkScalar cx = 640 / 2; // center X SkScalar cy = 480 / 2; // center Y -- cgit v1.2.3