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

Unified Diff: chrome/browser/android/vr_shell/textures/ui_texture.cc

Issue 2834543006: Hook up insecure content warnings for http webVR presentation. (Closed)
Patch Set: rebase Created 3 years, 8 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
« no previous file with comments | « chrome/browser/android/vr_shell/textures/ui_texture.h ('k') | chrome/browser/android/vr_shell/ui_element.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/textures/ui_texture.cc
diff --git a/chrome/browser/android/vr_shell/textures/ui_texture.cc b/chrome/browser/android/vr_shell/textures/ui_texture.cc
index 7cac42d2d92dc001543e0081e4afe4aa18733ab4..36cab83305e983ae31bb12f71fad40df5287a19d 100644
--- a/chrome/browser/android/vr_shell/textures/ui_texture.cc
+++ b/chrome/browser/android/vr_shell/textures/ui_texture.cc
@@ -25,42 +25,22 @@ namespace {
constexpr char kDefaultFontFamily[] = "sans-serif";
} // namespace
-// TODO(acondor): Create non-square textures to reduce memory usage.
-UITexture::UITexture(int texture_handle, int texture_size)
- : texture_handle_(texture_handle),
- texture_size_(texture_size),
- surface_(SkSurface::MakeRasterN32Premul(texture_size_, texture_size_)) {}
+UiTexture::UiTexture() = default;
-UITexture::~UITexture() = default;
+UiTexture::~UiTexture() = default;
-void UITexture::DrawAndLayout() {
- cc::SkiaPaintCanvas paint_canvas(surface_->getCanvas());
- gfx::Canvas canvas(&paint_canvas, 1.0f);
- canvas.DrawColor(0x00000000);
- Draw(&canvas);
- SetSize();
+void UiTexture::DrawAndLayout(SkCanvas* canvas, const gfx::Size& texture_size) {
+ cc::SkiaPaintCanvas paint_canvas(canvas);
+ gfx::Canvas gfx_canvas(&paint_canvas, 1.0f);
+ gfx_canvas.DrawColor(SK_ColorTRANSPARENT);
+ Draw(&gfx_canvas, texture_size);
}
-void UITexture::Flush() {
- cc::SkiaPaintCanvas paint_canvas(surface_->getCanvas());
- paint_canvas.flush();
- SkPixmap pixmap;
- CHECK(surface_->peekPixels(&pixmap));
-
- glBindTexture(GL_TEXTURE_2D, texture_handle_);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pixmap.width(), pixmap.height(), 0,
- GL_RGBA, GL_UNSIGNED_BYTE, pixmap.addr());
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-}
-
-bool UITexture::IsRTL() {
+bool UiTexture::IsRTL() {
return base::i18n::IsRTL();
}
-gfx::FontList UITexture::GetFontList(int size, base::string16 text) {
+gfx::FontList UiTexture::GetFontList(int size, base::string16 text) {
gfx::Font default_font(kDefaultFontFamily, size);
std::vector<gfx::Font> fonts{default_font};
« no previous file with comments | « chrome/browser/android/vr_shell/textures/ui_texture.h ('k') | chrome/browser/android/vr_shell/ui_element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698