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

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: Add units to timeout constant. 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 ed30634d7bf5efa7937f089a39277135f681dab9..8f13fb765d3fb3d16956ffdb707a12072ac448bf 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;
Update();
set_fill(Fill::SELF);
gfx::SizeF drawn_size = GetTexture()->GetDrawnSize();
@@ -30,6 +31,8 @@ void TexturedElement::Initialize() {
}
void TexturedElement::Update() {
+ 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::Update() {
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