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

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

Issue 2862283002: VR: Add initial URL bar element and texture. (Closed)
Patch Set: Drop anti-aliasing. 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 3623c1e4529105dbc6381f1d1d13b609bc2b1fbb..3dc5b8b39d4e55bd402c695f2a0bb09de54d805a 100644
--- a/chrome/browser/android/vr_shell/ui_elements/textured_element.cc
+++ b/chrome/browser/android/vr_shell/ui_elements/textured_element.cc
@@ -20,16 +20,20 @@ void TexturedElement::Initialize() {
glGenTextures(1, &texture_handle_);
DCHECK(GetTexture() != nullptr);
texture_size_ = GetTexture()->GetPreferredTextureSize(maximum_width_);
- sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(
- texture_size_.width(), texture_size_.height());
- GetTexture()->DrawAndLayout(surface->getCanvas(), texture_size_);
- Flush(surface.get());
+ Update();
set_fill(Fill::SELF);
gfx::SizeF drawn_size = GetTexture()->GetDrawnSize();
float y = drawn_size.height() / drawn_size.width() * size().x();
set_size({size().x(), y, 1});
}
+void TexturedElement::Update() {
+ sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(
+ texture_size_.width(), texture_size_.height());
+ GetTexture()->DrawAndLayout(surface->getCanvas(), texture_size_);
+ Flush(surface.get());
+}
+
void TexturedElement::Render(VrShellRenderer* renderer,
vr::Mat4f view_proj_matrix) const {
gfx::SizeF drawn_size = GetTexture()->GetDrawnSize();
« no previous file with comments | « chrome/browser/android/vr_shell/ui_elements/textured_element.h ('k') | chrome/browser/android/vr_shell/ui_elements/url_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698