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 "sky/shell/gpu/rasterizer.h" | 5 #include "sky/shell/gpu/rasterizer.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "sky/shell/gpu/ganesh_context.h" | 8 #include "sky/shell/gpu/ganesh_context.h" |
9 #include "sky/shell/gpu/ganesh_surface.h" | 9 #include "sky/shell/gpu/ganesh_surface.h" |
10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 Rasterizer::~Rasterizer() { | 32 Rasterizer::~Rasterizer() { |
33 } | 33 } |
34 | 34 |
35 base::WeakPtr<Rasterizer> Rasterizer::GetWeakPtr() { | 35 base::WeakPtr<Rasterizer> Rasterizer::GetWeakPtr() { |
36 return weak_factory_.GetWeakPtr(); | 36 return weak_factory_.GetWeakPtr(); |
37 } | 37 } |
38 | 38 |
39 void Rasterizer::OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) { | 39 void Rasterizer::OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) { |
40 surface_ = gfx::GLSurface::CreateViewGLSurface(widget); | 40 surface_ = gfx::GLSurface::CreateViewGLSurface(widget, |
| 41 gfx::SurfaceConfiguration()); |
41 CHECK(surface_) << "GLSurface required."; | 42 CHECK(surface_) << "GLSurface required."; |
42 } | 43 } |
43 | 44 |
44 void Rasterizer::Draw(skia::RefPtr<SkPicture> picture) { | 45 void Rasterizer::Draw(skia::RefPtr<SkPicture> picture) { |
45 TRACE_EVENT0("sky", "Rasterizer::Draw"); | 46 TRACE_EVENT0("sky", "Rasterizer::Draw"); |
46 | 47 |
47 if (!surface_) | 48 if (!surface_) |
48 return; | 49 return; |
49 | 50 |
50 gfx::Size size = GetSize(picture.get()); | 51 gfx::Size size = GetSize(picture.get()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 ganesh_context_.reset(new GaneshContext(context_.get())); | 84 ganesh_context_.reset(new GaneshContext(context_.get())); |
84 } | 85 } |
85 | 86 |
86 void Rasterizer::EnsureGaneshSurface(const gfx::Size& size) { | 87 void Rasterizer::EnsureGaneshSurface(const gfx::Size& size) { |
87 if (!ganesh_surface_ || ganesh_surface_->size() != size) | 88 if (!ganesh_surface_ || ganesh_surface_->size() != size) |
88 ganesh_surface_.reset(new GaneshSurface(ganesh_context_.get(), size)); | 89 ganesh_surface_.reset(new GaneshSurface(ganesh_context_.get(), size)); |
89 } | 90 } |
90 | 91 |
91 } // namespace shell | 92 } // namespace shell |
92 } // namespace sky | 93 } // namespace sky |
OLD | NEW |