| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_TEXTURED_ELEMENT_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_TEXTURED_ELEMENT_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_TEXTURED_ELEMENT_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_TEXTURED_ELEMENT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" | 9 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" |
| 10 #include "third_party/skia/include/core/SkSurface.h" |
| 10 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
| 11 | 12 |
| 12 class SkSurface; | |
| 13 | |
| 14 namespace vr_shell { | 13 namespace vr_shell { |
| 15 | 14 |
| 16 class UiTexture; | 15 class UiTexture; |
| 17 | 16 |
| 18 class TexturedElement : public UiElement { | 17 class TexturedElement : public UiElement { |
| 19 public: | 18 public: |
| 20 // |preferred_width| is the element's desired width in meters. Constraints | 19 // |preferred_width| is the element's desired width in meters. Constraints |
| 21 // implied by the texture being rendered may or may not allow it to be | 20 // implied by the texture being rendered may or may not allow it to be |
| 22 // rendered exactly at the preferred width. | 21 // rendered exactly at the preferred width. |
| 23 explicit TexturedElement(int maximum_width); | 22 explicit TexturedElement(int maximum_width); |
| 24 ~TexturedElement() override; | 23 ~TexturedElement() override; |
| 25 | 24 |
| 26 void Initialize() override; | |
| 27 | |
| 28 // UiElement interface. | 25 // UiElement interface. |
| 29 void Render(VrShellRenderer* renderer, | 26 void Render(VrShellRenderer* renderer, |
| 30 vr::Mat4f view_proj_matrix) const override; | 27 vr::Mat4f view_proj_matrix) const override; |
| 31 | 28 |
| 32 protected: | 29 protected: |
| 30 void Initialize() override; |
| 33 virtual UiTexture* GetTexture() const = 0; | 31 virtual UiTexture* GetTexture() const = 0; |
| 34 | 32 |
| 35 private: | 33 private: |
| 36 void Flush(SkSurface* surface); | |
| 37 | |
| 38 gfx::Size texture_size_; | 34 gfx::Size texture_size_; |
| 39 GLuint texture_handle_; | 35 GLuint texture_handle_; |
| 40 int maximum_width_; | 36 int maximum_width_; |
| 37 sk_sp<SkSurface> surface_; |
| 41 | 38 |
| 42 DISALLOW_COPY_AND_ASSIGN(TexturedElement); | 39 DISALLOW_COPY_AND_ASSIGN(TexturedElement); |
| 43 }; | 40 }; |
| 44 | 41 |
| 45 } // namespace vr_shell | 42 } // namespace vr_shell |
| 46 | 43 |
| 47 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_TEXTURED_ELEMENT_H_ | 44 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_TEXTURED_ELEMENT_H_ |
| OLD | NEW |