diff options
author | 2016-10-03 12:57:32 -0400 | |
---|---|---|
committer | 2016-10-03 17:17:10 +0000 | |
commit | 0591897548c8fcb7d53cc94053e01702e58f1ac5 (patch) | |
tree | 099bf31c7bf4bd3062d2e7a8b4268a89f1fd61a2 /include/core/SkPaint.h | |
parent | a224bb7027f022cf78376cb7afa2fff83d59153e (diff) |
replace SkXfermode obj with SkBlendMode enum in paints
BUG=skia:5814
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2714
Change-Id: I4fb489ba6b3f77b458f7e4a99f79c7ad10859135
Reviewed-on: https://skia-review.googlesource.com/2714
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include/core/SkPaint.h')
-rw-r--r-- | include/core/SkPaint.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index e28d2fc92d..ddc90ae19c 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -8,11 +8,14 @@ #ifndef SkPaint_DEFINED #define SkPaint_DEFINED +#include "SkBlendMode.h" #include "SkColor.h" #include "SkFilterQuality.h" #include "SkMatrix.h" #include "SkXfermode.h" +//#define SK_SUPPORT_LEGACY_XFERMODE_OBJECT + class SkAutoDescriptor; class SkAutoGlyphCache; class SkColorFilter; @@ -525,12 +528,13 @@ public: #endif void setColorFilter(sk_sp<SkColorFilter>); +#ifdef SK_SUPPORT_LEGACY_XFERMODE_OBJECT /** Get the paint's xfermode object. <p /> The xfermode's reference count is not affected. @return the paint's xfermode (or NULL) */ - SkXfermode* getXfermode() const { return fXfermode.get(); } + SkXfermode* getXfermode() const; /** Set or clear the xfermode object. <p /> @@ -552,6 +556,11 @@ public: the paint's xfermode is set to null. */ SkXfermode* setXfermodeMode(SkXfermode::Mode); +#endif + + SkBlendMode getBlendMode() const { return (SkBlendMode)fBlendMode; } + bool isSrcOver() const { return (SkBlendMode)fBlendMode == SkBlendMode::kSrcOver; } + void setBlendMode(SkBlendMode mode) { fBlendMode = (unsigned)mode; } /** Get the paint's patheffect object. <p /> @@ -1090,7 +1099,6 @@ private: sk_sp<SkTypeface> fTypeface; sk_sp<SkPathEffect> fPathEffect; sk_sp<SkShader> fShader; - sk_sp<SkXfermode> fXfermode; sk_sp<SkMaskFilter> fMaskFilter; sk_sp<SkColorFilter> fColorFilter; sk_sp<SkRasterizer> fRasterizer; @@ -1103,6 +1111,7 @@ private: SkColor fColor; SkScalar fWidth; SkScalar fMiterLimit; + uint32_t fBlendMode; // just need 5-6 bits for SkXfermode::Mode union { struct { // all of these bitfields should add up to 32 |