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

Unified Diff: sky/engine/core/painting/Paint.h

Issue 1144193006: Sky: Add a DrawLooper interface to the painting API to be used for shadows. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: . Created 5 years, 7 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
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

Powered by Google App Engine
This is Rietveld 408576698