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

Unified Diff: chrome/browser/android/vr_shell/ui_elements/textured_element.cc

Issue 2877133002: VR: Add a loading indicator to the scene. (Closed)
Patch Set: Rebase onto render text change. Created 3 years, 7 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
Index: chrome/browser/android/vr_shell/ui_elements/textured_element.cc
diff --git a/chrome/browser/android/vr_shell/ui_elements/textured_element.cc b/chrome/browser/android/vr_shell/ui_elements/textured_element.cc
index 82e56fcdb374b592f8661ec7e903990434a50193..c0e9870cead72728c88adf65000db0f475b4caf5 100644
--- a/chrome/browser/android/vr_shell/ui_elements/textured_element.cc
+++ b/chrome/browser/android/vr_shell/ui_elements/textured_element.cc
@@ -22,6 +22,7 @@ void TexturedElement::Initialize() {
glGenTextures(1, &texture_handle_);
DCHECK(GetTexture() != nullptr);
texture_size_ = GetTexture()->GetPreferredTextureSize(maximum_width_);
+ initialized_ = true;
UpdateTexture();
set_fill(Fill::SELF);
gfx::SizeF drawn_size = GetTexture()->GetDrawnSize();
@@ -30,6 +31,8 @@ void TexturedElement::Initialize() {
}
void TexturedElement::UpdateTexture() {
+ if (!initialized_)
+ return;
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(
texture_size_.width(), texture_size_.height());
GetTexture()->DrawAndLayout(surface->getCanvas(), texture_size_);
@@ -38,6 +41,8 @@ void TexturedElement::UpdateTexture() {
void TexturedElement::Render(VrShellRenderer* renderer,
vr::Mat4f view_proj_matrix) const {
+ if (!initialized_)
+ return;
gfx::SizeF drawn_size = GetTexture()->GetDrawnSize();
gfx::RectF copy_rect(0, 0, drawn_size.width() / texture_size_.width(),
drawn_size.height() / texture_size_.height());

Powered by Google App Engine
This is Rietveld 408576698