diff options
author | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-04-27 14:09:52 +0000 |
---|---|---|
committer | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-04-27 14:09:52 +0000 |
commit | 1447c6f7f4579942b32af6ffff1eadede40b42bc (patch) | |
tree | c5230b0da5dc8daf680ec21af0fc71de9e2c80d4 /include/core | |
parent | 938d60402617de4d1cef29cc1e991df77b4a4ecc (diff) |
Add missing flattenable registrations and CreateProc() functions;
fixes gm --serialize xfermode test case.
git-svn-id: http://skia.googlecode.com/svn/trunk@1199 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkColorFilter.h | 12 | ||||
-rw-r--r-- | include/core/SkXfermode.h | 25 |
2 files changed, 18 insertions, 19 deletions
diff --git a/include/core/SkColorFilter.h b/include/core/SkColorFilter.h index aee60196f6..3e9aee8573 100644 --- a/include/core/SkColorFilter.h +++ b/include/core/SkColorFilter.h @@ -72,8 +72,8 @@ public: * which is virtual. */ SkColor filterColor(SkColor); - - + + /** Create a colorfilter that uses the specified color and mode. If the Mode is DST, this function will return NULL (since that mode will have no effect on the result). @@ -103,7 +103,7 @@ public: protected: SkColorFilter() {} SkColorFilter(SkFlattenableReadBuffer& rb) : INHERITED(rb) {} - + private: typedef SkFlattenable INHERITED; }; @@ -123,17 +123,17 @@ public: virtual void shadeSpan16(int x, int y, uint16_t result[], int count); virtual void beginSession(); virtual void endSession(); - + protected: SkFilterShader(SkFlattenableReadBuffer& ); virtual void flatten(SkFlattenableWriteBuffer& ); virtual Factory getFactory() { return CreateProc; } private: - static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { + static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { return SkNEW_ARGS(SkFilterShader, (buffer)); } SkShader* fShader; SkColorFilter* fFilter; - + typedef SkShader INHERITED; }; diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h index 0f2efbdbcd..4d46bb919a 100644 --- a/include/core/SkXfermode.h +++ b/include/core/SkXfermode.h @@ -40,7 +40,7 @@ public: const SkAlpha aa[]); virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, const SkAlpha aa[]); - + /** Enum of possible coefficients to describe some xfermodes */ enum Coeff { @@ -54,18 +54,18 @@ public: kISA_Coeff, /** inverse src alpha (i.e. 1 - sa) */ kDA_Coeff, /** dst alpha */ kIDA_Coeff, /** inverse dst alpha (i.e. 1 - da) */ - + kCoeffCount }; - + /** If the xfermode can be expressed as an equation using the coefficients in Coeff, then asCoeff() returns true, and sets (if not null) src and dst accordingly. - + result = src_coeff * src_color + dst_coeff * dst_color; - + As examples, here are some of the porterduff coefficients - + MODE SRC_COEFF DST_COEFF clear zero zero src one zero @@ -80,7 +80,7 @@ public: * if the xfermode is NULL, and if so, treats its as kSrcOver_Mode. */ static bool AsCoeff(SkXfermode*, Coeff* src, Coeff* dst); - + /** List of predefined xfermodes. The algebra for the modes uses the following symbols: Sa, Sc - source alpha and color @@ -149,7 +149,7 @@ public: 16bit proc, and this will return NULL. */ static SkXfermodeProc16 GetProc16(Mode mode, SkColor srcColor); - + /** * If the specified mode can be represented by a pair of Coeff, then return * true and set (if not NULL) the corresponding coeffs. If the mode is @@ -162,15 +162,15 @@ public: static bool IsMode(SkXfermode* xfer, Mode* mode) { return AsMode(xfer, mode); } - + protected: SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {} - + /** The default implementation of xfer32/xfer16/xferA8 in turn call this method, 1 color at a time (upscaled to a SkPMColor). The default implmentation of this method just returns dst. If performance is important, your subclass should override xfer32/xfer16/xferA8 directly. - + This method will not be called directly by the client, so it need not be implemented if your subclass has overridden xfer32/xfer16/xferA8 */ @@ -213,7 +213,7 @@ protected: private: SkXfermodeProc fProc; - + static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { return SkNEW_ARGS(SkProcXfermode, (buffer)); } @@ -221,4 +221,3 @@ private: }; #endif - |