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 |