OLD | NEW |
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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 OutputSurfaceFrame* last_sent_frame() { return last_sent_frame_.get(); } | 56 OutputSurfaceFrame* last_sent_frame() { return last_sent_frame_.get(); } |
57 size_t num_sent_frames() { return num_sent_frames_; } | 57 size_t num_sent_frames() { return num_sent_frames_; } |
58 | 58 |
59 OutputSurfaceClient* client() { return client_; } | 59 OutputSurfaceClient* client() { return client_; } |
60 | 60 |
61 void BindToClient(OutputSurfaceClient* client) override; | 61 void BindToClient(OutputSurfaceClient* client) override; |
62 void EnsureBackbuffer() override {} | 62 void EnsureBackbuffer() override {} |
63 void DiscardBackbuffer() override {} | 63 void DiscardBackbuffer() override {} |
64 void BindFramebuffer() override; | 64 void BindFramebuffer() override; |
| 65 void SetDrawRectangle(const gfx::Rect& rect) override; |
65 void Reshape(const gfx::Size& size, | 66 void Reshape(const gfx::Size& size, |
66 float device_scale_factor, | 67 float device_scale_factor, |
67 const gfx::ColorSpace& color_space, | 68 const gfx::ColorSpace& color_space, |
68 bool has_alpha, | 69 bool has_alpha, |
69 bool use_stencil) override; | 70 bool use_stencil) override; |
70 void SwapBuffers(OutputSurfaceFrame frame) override; | 71 void SwapBuffers(OutputSurfaceFrame frame) override; |
71 uint32_t GetFramebufferCopyTextureFormat() override; | 72 uint32_t GetFramebufferCopyTextureFormat() override; |
72 bool HasExternalStencilTest() const override; | 73 bool HasExternalStencilTest() const override; |
73 void ApplyExternalStencil() override {} | 74 void ApplyExternalStencil() override {} |
74 bool SurfaceIsSuspendForRecycle() const override; | 75 bool SurfaceIsSuspendForRecycle() const override; |
(...skipping 15 matching lines...) Expand all Loading... |
90 } | 91 } |
91 | 92 |
92 void set_suspended_for_recycle(bool suspended) { | 93 void set_suspended_for_recycle(bool suspended) { |
93 suspended_for_recycle_ = suspended; | 94 suspended_for_recycle_ = suspended; |
94 } | 95 } |
95 | 96 |
96 const gfx::ColorSpace& last_reshape_color_space() { | 97 const gfx::ColorSpace& last_reshape_color_space() { |
97 return last_reshape_color_space_; | 98 return last_reshape_color_space_; |
98 } | 99 } |
99 | 100 |
| 101 const gfx::Rect& last_set_draw_rectangle() { |
| 102 return last_set_draw_rectangle_; |
| 103 } |
| 104 |
100 protected: | 105 protected: |
101 explicit FakeOutputSurface(scoped_refptr<ContextProvider> context_provider); | 106 explicit FakeOutputSurface(scoped_refptr<ContextProvider> context_provider); |
102 explicit FakeOutputSurface( | 107 explicit FakeOutputSurface( |
103 std::unique_ptr<SoftwareOutputDevice> software_device); | 108 std::unique_ptr<SoftwareOutputDevice> software_device); |
104 | 109 |
105 OutputSurfaceClient* client_ = nullptr; | 110 OutputSurfaceClient* client_ = nullptr; |
106 std::unique_ptr<OutputSurfaceFrame> last_sent_frame_; | 111 std::unique_ptr<OutputSurfaceFrame> last_sent_frame_; |
107 size_t num_sent_frames_ = 0; | 112 size_t num_sent_frames_ = 0; |
108 bool has_external_stencil_test_ = false; | 113 bool has_external_stencil_test_ = false; |
109 bool suspended_for_recycle_ = false; | 114 bool suspended_for_recycle_ = false; |
110 GLint framebuffer_ = 0; | 115 GLint framebuffer_ = 0; |
111 GLenum framebuffer_format_ = 0; | 116 GLenum framebuffer_format_ = 0; |
112 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr; | 117 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr; |
113 gfx::ColorSpace last_reshape_color_space_; | 118 gfx::ColorSpace last_reshape_color_space_; |
| 119 gfx::Rect last_set_draw_rectangle_; |
114 | 120 |
115 private: | 121 private: |
116 void SwapBuffersAck(); | 122 void SwapBuffersAck(); |
117 | 123 |
118 base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_; | 124 base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_; |
119 }; | 125 }; |
120 | 126 |
121 } // namespace cc | 127 } // namespace cc |
122 | 128 |
123 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 129 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
OLD | NEW |