Chromium Code Reviews| 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..426dff76e0bac9e6c2045aaed9eb88c97575c513 100644 |
| --- a/chrome/browser/android/vr_shell/textures/ui_texture.cc |
| +++ b/chrome/browser/android/vr_shell/textures/ui_texture.cc |
| @@ -25,35 +25,15 @@ 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; |
| -void UITexture::DrawAndLayout() { |
| - cc::SkiaPaintCanvas paint_canvas(surface_->getCanvas()); |
| - gfx::Canvas canvas(&paint_canvas, 1.0f); |
| - canvas.DrawColor(0x00000000); |
| - Draw(&canvas); |
| - SetSize(); |
| -} |
| - |
| -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); |
| +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(0x00000000); |
|
cjgrant
2017/04/21 14:30:13
SK_ColorTRANSPARENT
mthiesse
2017/04/21 15:05:12
Done.
|
| + Draw(&gfx_canvas, texture_size); |
| } |
| bool UITexture::IsRTL() { |