Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: sky/compositor/layer.cc

Issue 752653002: Enable the Sky compositor (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sky/compositor/layer_host.cc » ('j') | sky/compositor/layer_host.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compositor/layer.h" 5 #include "sky/compositor/layer.h"
6 6
7 #include "mojo/skia/ganesh_surface.h" 7 #include "mojo/skia/ganesh_surface.h"
8 #include "sky/compositor/layer_host.h" 8 #include "sky/compositor/layer_host.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 10
11 namespace sky { 11 namespace sky {
12 12
13 Layer::Layer(LayerClient* client) : client_(client), host_(nullptr) { 13 Layer::Layer(LayerClient* client) : client_(client), host_(nullptr) {
14 } 14 }
15 15
16 Layer::~Layer() { 16 Layer::~Layer() {
17 } 17 }
18 18
19 void Layer::ClearClient() { 19 void Layer::ClearClient() {
20 client_ = nullptr; 20 client_ = nullptr;
21 } 21 }
22 22
23 void Layer::SetSize(const gfx::Size& size) { 23 void Layer::SetSize(const gfx::Size& size) {
24 size_ = size; 24 size_ = size;
25 } 25 }
26 26
27 void Layer::Display() { 27 void Layer::Display() {
28 DCHECK(host_); 28 DCHECK(host_);
29 29
30 mojo::GaneshContext::Scope scope(host_->ganesh_context());
31 mojo::GaneshSurface surface(host_->ganesh_context(), 30 mojo::GaneshSurface surface(host_->ganesh_context(),
32 host_->resource_manager()->CreateTexture(size_)); 31 host_->resource_manager()->CreateTexture(size_));
33 32
34 SkCanvas* canvas = surface.canvas(); 33 SkCanvas* canvas = surface.canvas();
35 34
36 gfx::Rect rect(size_); 35 gfx::Rect rect(size_);
37 client_->PaintContents(canvas, rect); 36 client_->PaintContents(canvas, rect);
38 canvas->flush(); 37 canvas->flush();
39 38
40 texture_ = surface.TakeTexture(); 39 texture_ = surface.TakeTexture();
41 } 40 }
42 41
43 scoped_ptr<mojo::GLTexture> Layer::GetTexture() { 42 scoped_ptr<mojo::GLTexture> Layer::GetTexture() {
44 return texture_.Pass(); 43 return texture_.Pass();
45 } 44 }
46 45
47 } // namespace sky 46 } // namespace sky
OLDNEW
« no previous file with comments | « no previous file | sky/compositor/layer_host.cc » ('j') | sky/compositor/layer_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698