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

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

Issue 2646243002: Use IDCompositionSurface to implement DirectCompositionSurfaceWin. (Closed)
Patch Set: add unittest and move implementation around Created 3 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
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 <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
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 19 matching lines...) Expand all
94 } 95 }
95 96
96 gfx::Rect last_swap_rect() const { 97 gfx::Rect last_swap_rect() const {
97 DCHECK(last_swap_rect_valid_); 98 DCHECK(last_swap_rect_valid_);
98 return last_swap_rect_; 99 return last_swap_rect_;
99 } 100 }
100 101
101 const gfx::ColorSpace& last_reshape_color_space() { 102 const gfx::ColorSpace& last_reshape_color_space() {
102 return last_reshape_color_space_; 103 return last_reshape_color_space_;
103 } 104 }
105 const gfx::Rect& last_set_draw_rectangle() {
danakj 2017/02/23 23:38:51 nit: white space after function body
106 return last_set_draw_rectangle_;
107 }
104 108
105 protected: 109 protected:
106 explicit FakeOutputSurface(scoped_refptr<ContextProvider> context_provider); 110 explicit FakeOutputSurface(scoped_refptr<ContextProvider> context_provider);
107 explicit FakeOutputSurface( 111 explicit FakeOutputSurface(
108 std::unique_ptr<SoftwareOutputDevice> software_device); 112 std::unique_ptr<SoftwareOutputDevice> software_device);
109 113
110 OutputSurfaceClient* client_ = nullptr; 114 OutputSurfaceClient* client_ = nullptr;
111 std::unique_ptr<OutputSurfaceFrame> last_sent_frame_; 115 std::unique_ptr<OutputSurfaceFrame> last_sent_frame_;
112 size_t num_sent_frames_ = 0; 116 size_t num_sent_frames_ = 0;
113 bool has_external_stencil_test_ = false; 117 bool has_external_stencil_test_ = false;
114 bool suspended_for_recycle_ = false; 118 bool suspended_for_recycle_ = false;
115 GLint framebuffer_ = 0; 119 GLint framebuffer_ = 0;
116 GLenum framebuffer_format_ = 0; 120 GLenum framebuffer_format_ = 0;
117 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr; 121 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr;
118 bool last_swap_rect_valid_ = false; 122 bool last_swap_rect_valid_ = false;
119 gfx::Rect last_swap_rect_; 123 gfx::Rect last_swap_rect_;
120 gfx::ColorSpace last_reshape_color_space_; 124 gfx::ColorSpace last_reshape_color_space_;
125 gfx::Rect last_set_draw_rectangle_;
121 126
122 private: 127 private:
123 void SwapBuffersAck(); 128 void SwapBuffersAck();
124 129
125 base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_; 130 base::WeakPtrFactory<FakeOutputSurface> weak_ptr_factory_;
126 }; 131 };
127 132
128 } // namespace cc 133 } // namespace cc
129 134
130 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ 135 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698