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

Unified Diff: include/effects/SkKernel33MaskFilter.h

Issue 173633003: Factory methods for heap-allocated SkMaskFilter objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add SkTableMaskFilter::Create(table) and remove deprecated SkEmbossMaskFilter constructor. Created 6 years, 10 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 | « include/effects/SkEmbossMaskFilter.h ('k') | include/effects/SkStippleMaskFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkKernel33MaskFilter.h
diff --git a/include/effects/SkKernel33MaskFilter.h b/include/effects/SkKernel33MaskFilter.h
index bcd9b26b848148f13205725ef86b36487b77fe26..5530094cc546affff3d5c2492c587b9fe3466f9a 100644
--- a/include/effects/SkKernel33MaskFilter.h
+++ b/include/effects/SkKernel33MaskFilter.h
@@ -12,9 +12,6 @@
class SK_API SkKernel33ProcMaskFilter : public SkMaskFilter {
public:
- SkKernel33ProcMaskFilter(unsigned percent256 = 256)
- : fPercent256(percent256) {}
-
virtual uint8_t computeValue(uint8_t* const* srcRows) const = 0;
virtual SkMask::Format getFormat() const SK_OVERRIDE;
@@ -24,6 +21,8 @@ public:
SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
protected:
+ SkKernel33ProcMaskFilter(unsigned percent256 = 256)
+ : fPercent256(percent256) {}
SkKernel33ProcMaskFilter(SkReadBuffer& rb);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
@@ -37,10 +36,8 @@ private:
class SK_API SkKernel33MaskFilter : public SkKernel33ProcMaskFilter {
public:
- SkKernel33MaskFilter(const int coeff[3][3], int shift, int percent256 = 256)
- : SkKernel33ProcMaskFilter(percent256) {
- memcpy(fKernel, coeff, 9 * sizeof(int));
- fShift = shift;
+ static SkKernel33MaskFilter* Create(const int coeff[3][3], int shift, int percent256 = 256) {
+ return SkNEW_ARGS(SkKernel33MaskFilter, (coeff, shift, percent256));
}
// override from SkKernel33ProcMaskFilter
@@ -49,6 +46,16 @@ public:
SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkKernel33MaskFilter)
+protected:
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+ SkKernel33MaskFilter(const int coeff[3][3], int shift, int percent256 = 256)
+ : SkKernel33ProcMaskFilter(percent256) {
+ memcpy(fKernel, coeff, 9 * sizeof(int));
+ fShift = shift;
+ }
+
private:
int fKernel[3][3];
int fShift;
« no previous file with comments | « include/effects/SkEmbossMaskFilter.h ('k') | include/effects/SkStippleMaskFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698