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

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

Issue 11967033: [CLOSED] In-browser software compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the lack SkCanvas::clear scissoring. Created 7 years, 11 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_layer_tree_host_client.cc ('k') | cc/test/fake_output_surface.cc » ('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 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_ 5 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_
6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_ 6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_
7 7
8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/compositor_frame.h" 8 #include "cc/compositor_frame.h"
11 #include "cc/output_surface.h" 9 #include "cc/output_surface_impl.h"
12 #include "cc/test/fake_software_output_device.h"
13 #include "cc/test/fake_web_graphics_context_3d.h" 10 #include "cc/test/fake_web_graphics_context_3d.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
15 12
16 namespace cc { 13 namespace cc {
17 14
18 class FakeOutputSurface : public OutputSurface { 15 class FakeOutputSurface : public OutputSurfaceImpl {
19 public: 16 public:
20 virtual ~FakeOutputSurface(); 17 virtual ~FakeOutputSurface();
21 18
22 static inline scoped_ptr<FakeOutputSurface> Create3d( 19 static scoped_ptr<FakeOutputSurface> Create3d(
23 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { 20 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) {
24 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); 21 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false));
25 } 22 }
26 23
27 static inline scoped_ptr<FakeOutputSurface> Create3d() { 24 static scoped_ptr<FakeOutputSurface> Create3d() {
28 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = 25 scoped_ptr<WebKit::WebGraphicsContext3D> context3d =
29 FakeWebGraphicsContext3D::Create( 26 FakeWebGraphicsContext3D::Create(
30 WebKit::WebGraphicsContext3D::Attributes()) 27 WebKit::WebGraphicsContext3D::Attributes())
31 .PassAs<WebKit::WebGraphicsContext3D>(); 28 .PassAs<WebKit::WebGraphicsContext3D>();
32 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false)); 29 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), false));
33 } 30 }
34 31
35 static inline scoped_ptr<FakeOutputSurface> CreateSoftware( 32 static scoped_ptr<FakeOutputSurface> CreateSoftware(
36 scoped_ptr<SoftwareOutputDevice> software_device) { 33 scoped_ptr<SoftwareOutputDevice> software_device) {
37 return make_scoped_ptr( 34 return make_scoped_ptr(
38 new FakeOutputSurface(software_device.Pass(), false)); 35 new FakeOutputSurface(software_device.Pass(), false));
39 } 36 }
40 37
41 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d( 38 static scoped_ptr<FakeOutputSurface> CreateDelegating3d(
42 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) { 39 scoped_ptr<WebKit::WebGraphicsContext3D> context3d) {
43 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); 40 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true));
44 } 41 }
45 42
46 static inline scoped_ptr<FakeOutputSurface> CreateDelegating3d() { 43 static scoped_ptr<FakeOutputSurface> CreateDelegating3d() {
47 scoped_ptr<WebKit::WebGraphicsContext3D> context3d = 44 scoped_ptr<WebKit::WebGraphicsContext3D> context3d =
48 FakeWebGraphicsContext3D::Create( 45 FakeWebGraphicsContext3D::Create(
49 WebKit::WebGraphicsContext3D::Attributes()) 46 WebKit::WebGraphicsContext3D::Attributes())
50 .PassAs<WebKit::WebGraphicsContext3D>(); 47 .PassAs<WebKit::WebGraphicsContext3D>();
51 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true)); 48 return make_scoped_ptr(new FakeOutputSurface(context3d.Pass(), true));
52 } 49 }
53 50
54 static inline scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( 51 static scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware(
55 scoped_ptr<SoftwareOutputDevice> software_device) { 52 scoped_ptr<SoftwareOutputDevice> software_device) {
56 return make_scoped_ptr( 53 return make_scoped_ptr(
57 new FakeOutputSurface(software_device.Pass(), true)); 54 new FakeOutputSurface(software_device.Pass(), true));
58 } 55 }
59 56
60 virtual bool BindToClient(OutputSurfaceClient* client) OVERRIDE;
61
62 virtual const struct Capabilities& Capabilities() const OVERRIDE;
63
64 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE;
65 virtual SoftwareOutputDevice* SoftwareDevice() const OVERRIDE;
66
67 virtual void SendFrameToParentCompositor(CompositorFrame*) OVERRIDE; 57 virtual void SendFrameToParentCompositor(CompositorFrame*) OVERRIDE;
68 58
69 CompositorFrame& last_sent_frame() { return last_sent_frame_; } 59 CompositorFrame& last_sent_frame() { return last_sent_frame_; }
70 size_t num_sent_frames() { return num_sent_frames_; } 60 size_t num_sent_frames() { return num_sent_frames_; }
71 61
72 private: 62 private:
73 explicit FakeOutputSurface( 63 FakeOutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
74 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent); 64 bool has_parent);
75 explicit FakeOutputSurface(
76 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent);
77 65
78 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; 66 FakeOutputSurface(scoped_ptr<SoftwareOutputDevice> software_device,
79 scoped_ptr<SoftwareOutputDevice> software_device_; 67 bool has_parent);
80 struct Capabilities capabilities_; 68
81 OutputSurfaceClient* client_;
82 CompositorFrame last_sent_frame_; 69 CompositorFrame last_sent_frame_;
83 size_t num_sent_frames_; 70 size_t num_sent_frames_;
84 }; 71 };
85 72
86 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface() 73 static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface() {
87 { 74 return FakeOutputSurface::Create3d(
88 return FakeOutputSurface::Create3d( 75 FakeWebGraphicsContext3D::Create(
89 FakeWebGraphicsContext3D::Create( 76 WebKit::WebGraphicsContext3D::Attributes())
90 WebKit::WebGraphicsContext3D::Attributes()) 77 .PassAs<WebKit::WebGraphicsContext3D>())
91 .PassAs<WebKit::WebGraphicsContext3D>()) 78 .PassAs<cc::OutputSurface>();
92 .PassAs<cc::OutputSurface>();
93 } 79 }
94 80
95 } // namespace cc 81 } // namespace cc
96 82
97 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 83 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/test/fake_layer_tree_host_client.cc ('k') | cc/test/fake_output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698