| 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};
|
|
|
|
|