aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects/SkTableMaskFilter.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-21 10:13:32 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-21 10:13:32 +0000
commit7c9d0f3104408a64d52b84643f116179022d73bd (patch)
tree85aa1d482887cfed57315f1ce8f1d928001236ae /include/effects/SkTableMaskFilter.h
parent0b45dc45d67144421904555ccf53782cc8d9969d (diff)
Factory methods for heap-allocated SkMaskFilter 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 SkMaskFilter and its subclasses non-public and instead provides factory methods for creating these objects on the heap. We temporarily keep constructor of publicly visible classes public behind a flag. BUG=skia:2187 R=scroggo@google.com, mtklein@google.com, reed@google.com Author: dominikg@chromium.org Review URL: https://codereview.chromium.org/173633003 git-svn-id: http://skia.googlecode.com/svn/trunk@13527 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/effects/SkTableMaskFilter.h')
-rw-r--r--include/effects/SkTableMaskFilter.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/effects/SkTableMaskFilter.h b/include/effects/SkTableMaskFilter.h
index 1c2bbd7a1b..63b32b2bd3 100644
--- a/include/effects/SkTableMaskFilter.h
+++ b/include/effects/SkTableMaskFilter.h
@@ -18,8 +18,6 @@
*/
class SK_API SkTableMaskFilter : public SkMaskFilter {
public:
- SkTableMaskFilter();
- SkTableMaskFilter(const uint8_t table[256]);
virtual ~SkTableMaskFilter();
/** Utility that sets the gamma table
@@ -31,6 +29,10 @@ public:
*/
static void MakeClipTable(uint8_t table[256], uint8_t min, uint8_t max);
+ static SkTableMaskFilter* Create(const uint8_t table[256]) {
+ return SkNEW_ARGS(SkTableMaskFilter, (table));
+ }
+
static SkTableMaskFilter* CreateGamma(SkScalar gamma) {
uint8_t table[256];
MakeGammaTable(table, gamma);
@@ -54,6 +56,12 @@ protected:
SkTableMaskFilter(SkReadBuffer& rb);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+ SkTableMaskFilter();
+ SkTableMaskFilter(const uint8_t table[256]);
+
private:
uint8_t fTable[256];