| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/ui/ganesh_renderer.h" | 5 #include "mojo/ui/ganesh_renderer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "mojo/gpu/gl_texture.h" | 9 #include "mojo/gpu/gl_texture.h" |
| 10 #include "mojo/skia/ganesh_context.h" | 10 #include "mojo/skia/ganesh_context.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 { | 32 { |
| 33 mojo::skia::GaneshContext::Scope scope(ganesh_context_); | 33 mojo::skia::GaneshContext::Scope scope(ganesh_context_); |
| 34 mojo::skia::GaneshTextureSurface texture_surface(scope, std::move(texture)); | 34 mojo::skia::GaneshTextureSurface texture_surface(scope, std::move(texture)); |
| 35 | 35 |
| 36 callback.Run(texture_surface.surface()); | 36 callback.Run(texture_surface.surface()); |
| 37 | 37 |
| 38 texture = texture_surface.TakeTexture(); | 38 texture = texture_surface.TakeTexture(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 return gl_renderer_.BindTextureResource(std::move(texture)); | 41 return gl_renderer_.BindTextureResource( |
| 42 std::move(texture), |
| 43 mojo::gfx::composition::MailboxTextureResource::Origin::TOP_LEFT); |
| 42 } | 44 } |
| 43 | 45 |
| 44 static void RunCanvasCallback( | 46 static void RunCanvasCallback( |
| 45 const mojo::ui::GaneshRenderer::DrawCanvasCallback& callback, | 47 const mojo::ui::GaneshRenderer::DrawCanvasCallback& callback, |
| 46 SkSurface* surface) { | 48 SkSurface* surface) { |
| 47 callback.Run(surface->getCanvas()); | 49 callback.Run(surface->getCanvas()); |
| 48 } | 50 } |
| 49 | 51 |
| 50 mojo::gfx::composition::ResourcePtr GaneshRenderer::DrawCanvas( | 52 mojo::gfx::composition::ResourcePtr GaneshRenderer::DrawCanvas( |
| 51 const mojo::Size& size, | 53 const mojo::Size& size, |
| 52 const DrawCanvasCallback& callback) { | 54 const DrawCanvasCallback& callback) { |
| 53 return DrawSurface(size, base::Bind(&RunCanvasCallback, callback)); | 55 return DrawSurface(size, base::Bind(&RunCanvasCallback, callback)); |
| 54 } | 56 } |
| 55 | 57 |
| 56 } // namespace ui | 58 } // namespace ui |
| 57 } // namespace mojo | 59 } // namespace mojo |
| OLD | NEW |