OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "sky/compositor/rasterizer_ganesh.h" | |
6 | |
7 #include "base/debug/trace_event.h" | |
8 #include "mojo/skia/ganesh_surface.h" | |
9 #include "sky/compositor/layer_host.h" | |
10 #include "third_party/skia/include/core/SkCanvas.h" | |
11 #include "third_party/skia/include/core/SkPicture.h" | |
12 | |
13 namespace sky { | |
14 | |
15 RasterizerGanesh::RasterizerGanesh(LayerHost* host) : host_(host) { | |
16 DCHECK(host_); | |
17 } | |
18 | |
19 RasterizerGanesh::~RasterizerGanesh() { | |
20 } | |
21 | |
22 scoped_ptr<mojo::GLTexture> RasterizerGanesh::Rasterize(SkPicture* picture) { | |
23 TRACE_EVENT0("sky", "RasterizerGanesh::Rasterize"); | |
24 | |
25 auto cull_rect = picture->cullRect(); | |
26 gfx::Size size(cull_rect.width(), cull_rect.height()); | |
eseidel1
2015/01/20 02:04:03
gfx::rect doesn't have a .size()?
abarth-chromium
2015/01/20 02:47:38
It's an SkRect. I've added in the type.
| |
27 | |
28 mojo::GaneshSurface surface(host_->ganesh_context(), | |
29 host_->resource_manager()->CreateTexture(size)); | |
30 | |
31 SkCanvas* canvas = surface.canvas(); | |
32 canvas->drawPicture(picture); | |
33 canvas->flush(); | |
34 | |
35 return surface.TakeTexture(); | |
36 } | |
37 | |
38 } // namespace sky | |
OLD | NEW |