Index: sky/engine/core/painting/Canvas.cpp |
diff --git a/sky/engine/core/painting/PaintingContext.cpp b/sky/engine/core/painting/Canvas.cpp |
similarity index 55% |
copy from sky/engine/core/painting/PaintingContext.cpp |
copy to sky/engine/core/painting/Canvas.cpp |
index 0bac4898e52ba248bbd421c8bbed01ef0073a218..5e25baf4893daf35302066caabb6bb74ca24b369 100644 |
--- a/sky/engine/core/painting/PaintingContext.cpp |
+++ b/sky/engine/core/painting/Canvas.cpp |
@@ -3,7 +3,7 @@ |
// found in the LICENSE file. |
#include "sky/engine/config.h" |
-#include "sky/engine/core/painting/PaintingContext.h" |
+#include "sky/engine/core/painting/PictureRecorder.h" |
#include "sky/engine/core/dom/Document.h" |
#include "sky/engine/core/dom/Element.h" |
@@ -13,24 +13,18 @@ |
namespace blink { |
-PassRefPtr<PaintingContext> PaintingContext::create(PassRefPtr<Element> element, const FloatSize& size) |
-{ |
- return adoptRef(new PaintingContext(element, size)); |
-} |
- |
-PaintingContext::PaintingContext(PassRefPtr<Element> element, const FloatSize& size) |
- : m_element(element) |
- , m_size(size) |
+Canvas::Canvas(const FloatSize& size) |
+ : m_size(size) |
{ |
m_displayList = adoptRef(new DisplayList); |
m_canvas = m_displayList->beginRecording(expandedIntSize(m_size)); |
} |
-PaintingContext::~PaintingContext() |
+Canvas::~Canvas() |
{ |
} |
-void PaintingContext::drawCircle(double x, double y, double radius, Paint* paint) |
+void Canvas::drawCircle(double x, double y, double radius, Paint* paint) |
{ |
if (!m_canvas) |
return; |
@@ -39,14 +33,13 @@ void PaintingContext::drawCircle(double x, double y, double radius, Paint* paint |
m_canvas->drawCircle(x, y, radius, paint->paint()); |
} |
-void PaintingContext::commit() |
+PassRefPtr<DisplayList> Canvas::finishRecording() |
{ |
- if (!m_canvas) |
- return; |
- m_displayList->endRecording(); |
+ if (!isRecording()) |
+ return nullptr; |
m_canvas = nullptr; |
- PaintingTasks::enqueueCommit(m_element, m_displayList.release()); |
- m_element->document().scheduleVisualUpdate(); |
+ m_displayList->endRecording(); |
+ return m_displayList.release(); |
} |
} // namespace blink |