Add helpers for creating UI components.
These helpers make it easier to use Mozart in C++ and greatly
reduce the amount of boilerplate involved in writing simple
applications.
View implementations:
- BaseView: A base implementation of the View interface.
- GLView: A View with an associated GLRenderer which takes care
of allocating, binding, and recycling textures.
- GaneshView: A View with an associated GaneshRenderer which takes
care of setting up a GaneshContext and drawing to canvas.
View providers:
- ViewProviderApp: Skeleton of a simple app which offers the
ViewProvider interface and vends Views on demand.
- ContextViewerApp: Skeleton of a simple app which offers the
ContentHandler interface and vends ViewProviders on demand.
Helpers:
- Choreographer: Coordinates the scheduling of drawing operations
on behalf of a View and compensates for lag.
- InputHandler: Binds an InputListener on behalf of a View.
BUG=
R=abarth@google.com, viettrungluu@chromium.org
Review URL: https://codereview.chromium.org/1556803002 .
diff --git a/mojo/ui/ganesh_view.cc b/mojo/ui/ganesh_view.cc
new file mode 100644
index 0000000..c700380
--- /dev/null
+++ b/mojo/ui/ganesh_view.cc
@@ -0,0 +1,27 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/ui/ganesh_view.h"
+
+#include "base/logging.h"
+#include "mojo/skia/ganesh_texture_surface.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+
+namespace mojo {
+namespace ui {
+
+GaneshView::GaneshView(
+ mojo::ApplicationImpl* app_impl,
+ const std::string& label,
+ const mojo::ui::ViewProvider::CreateViewCallback& create_view_callback)
+ : BaseView(app_impl, label, create_view_callback),
+ gl_context_owner_(mojo::MakeProxy(app_impl->CreateApplicationConnector())
+ .get()),
+ ganesh_context_(gl_context()),
+ ganesh_renderer_(&ganesh_context_) {}
+
+GaneshView::~GaneshView() {}
+
+} // namespace ui
+} // namespace mojo