Index: sky/engine/core/painting/Paint.h |
diff --git a/sky/engine/core/painting/Paint.h b/sky/engine/core/painting/Paint.h |
index a592623c0a7434076e0d944182bbf6e47dde5a99..a0b9a71787895ed9b501ca9ad1bce92fcc668fde 100644 |
--- a/sky/engine/core/painting/Paint.h |
+++ b/sky/engine/core/painting/Paint.h |
@@ -12,6 +12,8 @@ |
namespace blink { |
+class DrawLooper; |
+ |
class Paint : public RefCounted<Paint>, public DartWrappable { |
DEFINE_WRAPPERTYPEINFO(); |
public: |
@@ -20,24 +22,34 @@ public: |
{ |
return adoptRef(new Paint); |
} |
+ static PassRefPtr<Paint> createWithWeakRef(SkPaint* paint) |
+ { |
+ return adoptRef(new Paint(paint)); |
+ } |
abarth-chromium
2015/05/27 02:12:51
How does this work? It seems like the Paint objec
Matt Perry
2015/05/27 14:46:32
Yeah, I'm using it with SkLayerDrawLooper::Builder
|
- bool isAntiAlias() const { return m_paint.isAntiAlias(); } |
- void setIsAntiAlias(bool value) { m_paint.setAntiAlias(value); } |
+ bool isAntiAlias() const { return m_paint->isAntiAlias(); } |
+ void setIsAntiAlias(bool value) { m_paint->setAntiAlias(value); } |
- unsigned color() const { return m_paint.getColor(); } |
- void setColor(unsigned color) { m_paint.setColor(color); } |
+ unsigned color() const { return m_paint->getColor(); } |
+ void setColor(unsigned color) { m_paint->setColor(color); } |
void setARGB(unsigned a, unsigned r, unsigned g, unsigned b) |
{ |
- m_paint.setARGB(a, r, g, b); |
+ m_paint->setARGB(a, r, g, b); |
} |
+ void setDrawLooper(DrawLooper* looper); |
- const SkPaint& paint() const { return m_paint; } |
+ const SkPaint& paint() const { return *m_paint; } |
private: |
Paint(); |
+ Paint(SkPaint* paint); |
+ |
+ SkPaint* m_paint; |
- SkPaint m_paint; |
+ // The backing for m_paint when we own the SkPaint. Not used when |
+ // constructed with createWithWeakRef. |
+ SkPaint m_inline_paint; |
}; |
} // namespace blink |