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

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

Issue 1122423009: Make it possible to custom-paint without an Element. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Comment tweak 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/PaintingContext.cpp
diff --git a/sky/engine/core/painting/PaintingContext.cpp b/sky/engine/core/painting/PaintingContext.cpp
index 0bac4898e52ba248bbd421c8bbed01ef0073a218..1ab9198e5dca7eb9f0cd9a176c947ea8c9ea0132 100644
--- a/sky/engine/core/painting/PaintingContext.cpp
+++ b/sky/engine/core/painting/PaintingContext.cpp
@@ -9,7 +9,6 @@
#include "sky/engine/core/dom/Element.h"
#include "sky/engine/core/painting/PaintingTasks.h"
#include "sky/engine/platform/geometry/IntRect.h"
-#include "third_party/skia/include/core/SkCanvas.h"
namespace blink {
@@ -19,33 +18,20 @@ PassRefPtr<PaintingContext> PaintingContext::create(PassRefPtr<Element> element,
}
PaintingContext::PaintingContext(PassRefPtr<Element> element, const FloatSize& size)
- : m_element(element)
- , m_size(size)
+ : Canvas(size)
+ , m_element(element)
{
- m_displayList = adoptRef(new DisplayList);
- m_canvas = m_displayList->beginRecording(expandedIntSize(m_size));
}
PaintingContext::~PaintingContext()
{
}
-void PaintingContext::drawCircle(double x, double y, double radius, Paint* paint)
-{
- if (!m_canvas)
- return;
- ASSERT(paint);
- ASSERT(m_displayList->isRecording());
- m_canvas->drawCircle(x, y, radius, paint->paint());
-}
-
void PaintingContext::commit()
{
- if (!m_canvas)
+ if (!isRecording())
return;
- m_displayList->endRecording();
- m_canvas = nullptr;
- PaintingTasks::enqueueCommit(m_element, m_displayList.release());
+ PaintingTasks::enqueueCommit(m_element, finishRecording());
m_element->document().scheduleVisualUpdate();
}

Powered by Google App Engine
This is Rietveld 408576698