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

Unified Diff: sky/engine/core/painting/PaintingContext.cpp

Issue 1017593005: Add a basic custom painting facility to Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add missing files Created 5 years, 9 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/PaintingContext.cpp
diff --git a/sky/engine/core/painting/PaintingContext.cpp b/sky/engine/core/painting/PaintingContext.cpp
index ccd785a8bc9ed45b713bd033a6c703f5bf35e5e6..f31484580de8feef857985bf9be93099af2553f5 100644
--- a/sky/engine/core/painting/PaintingContext.cpp
+++ b/sky/engine/core/painting/PaintingContext.cpp
@@ -5,15 +5,19 @@
#include "sky/engine/config.h"
#include "sky/engine/core/painting/PaintingContext.h"
+#include "base/bind.h"
+#include "sky/engine/core/dom/Microtask.h"
#include "sky/engine/platform/geometry/IntRect.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace blink {
-PaintingContext::PaintingContext(const FloatRect& bounds)
+PaintingContext::PaintingContext(const FloatSize& size, const CommitCallback& commitCallback)
+ : m_size(size)
+ , m_commitCallback(commitCallback)
{
- m_displayList = adoptRef(new DisplayList(bounds));
- m_canvas = m_displayList->beginRecording(enclosingIntRect(bounds).size());
+ m_displayList = adoptRef(new DisplayList);
+ m_canvas = m_displayList->beginRecording(expandedIntSize(size));
}
PaintingContext::~PaintingContext()
@@ -31,8 +35,11 @@ void PaintingContext::drawCircle(double x, double y, double radius, Paint* paint
void PaintingContext::commit()
{
+ if (!m_canvas)
+ return;
m_displayList->endRecording();
m_canvas = nullptr;
+ Microtask::enqueueMicrotask(base::Bind(m_commitCallback, this));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698