OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MOJO_UI_GL_VIEW_H_ |
| 6 #define MOJO_UI_GL_VIEW_H_ |
| 7 |
| 8 #include "mojo/gpu/gl_context.h" |
| 9 #include "mojo/gpu/gl_context_owner.h" |
| 10 #include "mojo/ui/base_view.h" |
| 11 #include "mojo/ui/gl_renderer.h" |
| 12 |
| 13 namespace mojo { |
| 14 namespace ui { |
| 15 |
| 16 // Abstract base implementation of the View interface for simple applications |
| 17 // which use GL for rendering. Subclasses must handle layout and provide |
| 18 // content for the scene. |
| 19 class GLView : public BaseView { |
| 20 public: |
| 21 GLView( |
| 22 mojo::ApplicationImpl* app_impl, |
| 23 const std::string& label, |
| 24 const mojo::ui::ViewProvider::CreateViewCallback& create_view_callback); |
| 25 |
| 26 ~GLView() override; |
| 27 |
| 28 // Gets the GL context, or null if none. |
| 29 const base::WeakPtr<mojo::GLContext>& gl_context() const { |
| 30 return gl_context_owner_.context(); |
| 31 } |
| 32 |
| 33 // Gets the GL renderer. |
| 34 mojo::ui::GLRenderer* gl_renderer() { return &gl_renderer_; } |
| 35 |
| 36 private: |
| 37 mojo::GLContextOwner gl_context_owner_; |
| 38 mojo::ui::GLRenderer gl_renderer_; |
| 39 |
| 40 MOJO_DISALLOW_COPY_AND_ASSIGN(GLView); |
| 41 }; |
| 42 |
| 43 } // namespace ui |
| 44 } // namespace mojo |
| 45 |
| 46 #endif // MOJO_UI_GL_VIEW_H_ |
OLD | NEW |