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

Side by Side Diff: cc/test/fake_output_surface.cc

Issue 12041062: Have a common implementation of cc::OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/test/fake_output_surface.h ('k') | cc/test/pixel_test_output_surface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/test/fake_output_surface.h" 5 #include "cc/test/fake_output_surface.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 FakeOutputSurface::FakeOutputSurface( 9 FakeOutputSurface::FakeOutputSurface(
10 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent) 10 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent)
11 : num_sent_frames_(0) { 11 : OutputSurface(context3d.Pass()),
12 context3d_ = context3d.Pass(); 12 num_sent_frames_(0) {
13 capabilities_.has_parent_compositor = has_parent; 13 capabilities_.has_parent_compositor = has_parent;
14 } 14 }
15 15
16 FakeOutputSurface::FakeOutputSurface( 16 FakeOutputSurface::FakeOutputSurface(
17 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent) 17 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent)
18 : num_sent_frames_(0) { 18 : OutputSurface(software_device.Pass()),
19 software_device_ = software_device.Pass(); 19 num_sent_frames_(0) {
20 capabilities_.has_parent_compositor = has_parent; 20 capabilities_.has_parent_compositor = has_parent;
21 } 21 }
22 22
23 FakeOutputSurface::~FakeOutputSurface() {} 23 FakeOutputSurface::~FakeOutputSurface() {}
24 24
25 bool FakeOutputSurface::BindToClient(OutputSurfaceClient* client) { 25 bool FakeOutputSurface::BindToClient(
26 cc::OutputSurfaceClient* client) {
27 DCHECK(client);
28 client_ = client;
26 if (!context3d_) 29 if (!context3d_)
27 return true; 30 return true;
28 DCHECK(client); 31 return context3d_->makeContextCurrent();
29 if (!context3d_->makeContextCurrent())
30 return false;
31 client_ = client;
32 return true;
33 }
34
35 const struct OutputSurface::Capabilities& FakeOutputSurface::Capabilities()
36 const {
37 return capabilities_;
38 }
39
40 WebKit::WebGraphicsContext3D* FakeOutputSurface::Context3D() const {
41 return context3d_.get();
42 }
43
44 SoftwareOutputDevice* FakeOutputSurface::SoftwareDevice() const {
45 return software_device_.get();
46 } 32 }
47 33
48 void FakeOutputSurface::SendFrameToParentCompositor( 34 void FakeOutputSurface::SendFrameToParentCompositor(
49 CompositorFrame* frame) { 35 CompositorFrame* frame) {
50 frame->AssignTo(&last_sent_frame_); 36 frame->AssignTo(&last_sent_frame_);
51 ++num_sent_frames_; 37 ++num_sent_frames_;
52 } 38 }
53 39
54 } // namespace cc 40 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_output_surface.h ('k') | cc/test/pixel_test_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698