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

Unified Diff: mojo/ui/gl_view.h

Issue 1556803002: Add helpers for creating UI components. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-13
Patch Set: address feedback Created 4 years, 11 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 | « mojo/ui/gl_renderer_unittest.cc ('k') | mojo/ui/gl_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/ui/gl_view.h
diff --git a/mojo/ui/gl_view.h b/mojo/ui/gl_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..1f9796cdeac5f816f5bf39340a7b544b34e42607
--- /dev/null
+++ b/mojo/ui/gl_view.h
@@ -0,0 +1,46 @@
+// Copyright 2015 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.
+
+#ifndef MOJO_UI_GL_VIEW_H_
+#define MOJO_UI_GL_VIEW_H_
+
+#include "mojo/gpu/gl_context.h"
+#include "mojo/gpu/gl_context_owner.h"
+#include "mojo/ui/base_view.h"
+#include "mojo/ui/gl_renderer.h"
+
+namespace mojo {
+namespace ui {
+
+// Abstract base implementation of the View interface for simple applications
+// which use GL for rendering. Subclasses must handle layout and provide
+// content for the scene.
+class GLView : public BaseView {
+ public:
+ GLView(
+ mojo::ApplicationImpl* app_impl,
+ const std::string& label,
+ const mojo::ui::ViewProvider::CreateViewCallback& create_view_callback);
+
+ ~GLView() override;
+
+ // Gets the GL context, or null if none.
+ const base::WeakPtr<mojo::GLContext>& gl_context() const {
+ return gl_context_owner_.context();
+ }
+
+ // Gets the GL renderer.
+ mojo::ui::GLRenderer* gl_renderer() { return &gl_renderer_; }
+
+ private:
+ mojo::GLContextOwner gl_context_owner_;
+ mojo::ui::GLRenderer gl_renderer_;
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(GLView);
+};
+
+} // namespace ui
+} // namespace mojo
+
+#endif // MOJO_UI_GL_VIEW_H_
« no previous file with comments | « mojo/ui/gl_renderer_unittest.cc ('k') | mojo/ui/gl_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698