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

Unified Diff: sky/engine/public/sky/sky_view.cc

Issue 1134913003: Teach SkyView path to draw a circle (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
« no previous file with comments | « sky/engine/public/sky/sky_view.h ('k') | sky/engine/public/sky/sky_view_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/public/sky/sky_view.cc
diff --git a/sky/engine/public/sky/sky_view.cc b/sky/engine/public/sky/sky_view.cc
index aa9776647d3b4f6dd59d3fa8ef2b4c820b413799..e9a6bdbd0d49ed0611b39a0f35c3200e9242a219 100644
--- a/sky/engine/public/sky/sky_view.cc
+++ b/sky/engine/public/sky/sky_view.cc
@@ -5,17 +5,27 @@
#include "config.h"
#include "sky/engine/public/sky/sky_view.h"
+#include "base/bind.h"
#include "sky/engine/core/script/dart_controller.h"
#include "sky/engine/core/script/dom_dart_state.h"
+#include "sky/engine/core/view/View.h"
#include "sky/engine/platform/weborigin/KURL.h"
+#include "sky/engine/public/sky/sky_view_client.h"
namespace blink {
-std::unique_ptr<SkyView> SkyView::Create() {
- return std::unique_ptr<SkyView>(new SkyView);
+struct SkyView::Data {
+ RefPtr<View> view_;
+};
+
+std::unique_ptr<SkyView> SkyView::Create(SkyViewClient* client) {
+ return std::unique_ptr<SkyView>(new SkyView(client));
}
-SkyView::SkyView() {
+SkyView::SkyView(SkyViewClient* client)
+ : client_(client),
+ data_(new Data),
+ weak_factory_(this) {
}
SkyView::~SkyView() {
@@ -29,12 +39,18 @@ void SkyView::SetDisplayMetrics(const SkyDisplayMetrics& metrics) {
}
void SkyView::Load(const WebURL& url) {
+ data_->view_ = View::create(base::Bind(
+ &SkyView::SchedulePaint, weak_factory_.GetWeakPtr()));
+
dart_controller_.reset(new DartController);
dart_controller_->CreateIsolateFor(adoptPtr(new DOMDartState(nullptr)), url);
+ dart_controller_->InstallView(data_->view_.get());
dart_controller_->LoadMainLibrary(url);
}
skia::RefPtr<SkPicture> SkyView::Paint() {
+ if (Picture* picture = data_->view_->picture())
+ return skia::SharePtr(picture->toSkia());
return skia::RefPtr<SkPicture>();
}
@@ -42,4 +58,8 @@ bool SkyView::HandleInputEvent(const WebInputEvent& event) {
return false;
}
+void SkyView::SchedulePaint() {
+ client_->SchedulePaint();
+}
+
} // namespace blink
« no previous file with comments | « sky/engine/public/sky/sky_view.h ('k') | sky/engine/public/sky/sky_view_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698