| 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 "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
| 11 | 11 |
| 12 class SkSurface; | 12 class SkSurface; |
| 13 | 13 |
| 14 namespace vr_shell { | 14 namespace vr_shell { |
| 15 | 15 |
| 16 class UiTexture; | 16 class UiTexture; |
| 17 | 17 |
| 18 class TexturedElement : public UiElement { | 18 class TexturedElement : public UiElement { |
| 19 public: | 19 public: |
| 20 // |preferred_width| is the element's desired width in meters. Constraints | 20 // |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 | 21 // implied by the texture being rendered may or may not allow it to be |
| 22 // rendered exactly at the preferred width. | 22 // rendered exactly at the preferred width. |
| 23 explicit TexturedElement(int maximum_width); | 23 explicit TexturedElement(int maximum_width); |
| 24 ~TexturedElement() override; | 24 ~TexturedElement() override; |
| 25 | 25 |
| 26 void Initialize() final; | 26 void Initialize() final; |
| 27 | 27 |
| 28 // UiElement interface. | 28 // UiElement interface. |
| 29 void Render(VrShellRenderer* renderer, | 29 void Render(UiElementRenderer* renderer, |
| 30 vr::Mat4f view_proj_matrix) const final; | 30 vr::Mat4f view_proj_matrix) const final; |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 virtual UiTexture* GetTexture() const = 0; | 33 virtual UiTexture* GetTexture() const = 0; |
| 34 virtual void UpdateTexture(); | 34 virtual void UpdateTexture(); |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 void Flush(SkSurface* surface); | 37 void Flush(SkSurface* surface); |
| 38 void OnSetMode() override; | 38 void OnSetMode() override; |
| 39 | 39 |
| 40 gfx::Size texture_size_; | 40 gfx::Size texture_size_; |
| 41 GLuint texture_handle_; | 41 GLuint texture_handle_; |
| 42 int maximum_width_; | 42 int maximum_width_; |
| 43 bool initialized_ = false; | 43 bool initialized_ = false; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(TexturedElement); | 45 DISALLOW_COPY_AND_ASSIGN(TexturedElement); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace vr_shell | 48 } // namespace vr_shell |
| 49 | 49 |
| 50 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_TEXTURED_ELEMENT_H_ | 50 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_TEXTURED_ELEMENT_H_ |
| OLD | NEW |