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

Unified Diff: include/core/SkPaint.h

Issue 2396953002: Revert[8] "replace SkXfermode obj with SkBlendMode enum in paints" (Closed)
Patch Set: add tmp virtual to unroll legacy arithmodes Created 4 years, 2 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/core/SkColorFilter.h ('k') | include/core/SkPicture.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPaint.h
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index e28d2fc92d59db56603f43860cf9e23fb82f95d4..ddc90ae19c7877fae6ce25bfae23eb3e45a4b7de 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
« no previous file with comments | « include/core/SkColorFilter.h ('k') | include/core/SkPicture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698