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

Side by Side Diff: cc/output/overlay_unittest.cc

Issue 2352963002: cc: Make most of cc::OutputSurface abstract. (Closed)
Patch Set: outputsurface-cleanup: rebase Created 4 years, 2 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
« no previous file with comments | « cc/output/output_surface_unittest.cc ('k') | cc/test/fake_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 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "cc/base/region.h" 10 #include "cc/base/region.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 class OverlayOutputSurface : public OutputSurface { 149 class OverlayOutputSurface : public OutputSurface {
150 public: 150 public:
151 explicit OverlayOutputSurface( 151 explicit OverlayOutputSurface(
152 scoped_refptr<TestContextProvider> context_provider) 152 scoped_refptr<TestContextProvider> context_provider)
153 : OutputSurface(std::move(context_provider)) { 153 : OutputSurface(std::move(context_provider)) {
154 surface_size_ = kDisplaySize; 154 surface_size_ = kDisplaySize;
155 device_scale_factor_ = 1; 155 device_scale_factor_ = 1;
156 is_displayed_as_overlay_plane_ = true; 156 is_displayed_as_overlay_plane_ = true;
157 } 157 }
158 158
159 void SetScaleFactor(float scale_factor) { 159 // OutputSurface implementation.
160 device_scale_factor_ = scale_factor; 160 void EnsureBackbuffer() override {}
161 } 161 void DiscardBackbuffer() override {}
162
163 // OutputSurface implementation
164 void BindFramebuffer() override { 162 void BindFramebuffer() override {
165 OutputSurface::BindFramebuffer();
166 bind_framebuffer_count_ += 1; 163 bind_framebuffer_count_ += 1;
167 } 164 }
168 uint32_t GetFramebufferCopyTextureFormat() override { 165 uint32_t GetFramebufferCopyTextureFormat() override {
169 // TestContextProvider has no real framebuffer, just use RGB. 166 // TestContextProvider has no real framebuffer, just use RGB.
170 return GL_RGB; 167 return GL_RGB;
171 } 168 }
172 void SwapBuffers(CompositorFrame frame) override { 169 void SwapBuffers(CompositorFrame frame) override {
173 } 170 }
174 void OnSwapBuffersComplete() override { client_->DidSwapBuffersComplete(); } 171 bool HasExternalStencilTest() const override { return false; }
175 172 void ApplyExternalStencil() override {}
176 void SetOverlayCandidateValidator(OverlayCandidateValidator* validator) {
177 overlay_candidate_validator_.reset(validator);
178 }
179
180 OverlayCandidateValidator* GetOverlayCandidateValidator() const override { 173 OverlayCandidateValidator* GetOverlayCandidateValidator() const override {
181 return overlay_candidate_validator_.get(); 174 return overlay_candidate_validator_.get();
182 } 175 }
183
184 bool IsDisplayedAsOverlayPlane() const override { 176 bool IsDisplayedAsOverlayPlane() const override {
185 return is_displayed_as_overlay_plane_; 177 return is_displayed_as_overlay_plane_;
186 } 178 }
187 unsigned GetOverlayTextureId() const override { return 10000; } 179 unsigned GetOverlayTextureId() const override { return 10000; }
188 void set_is_displayed_as_overlay_plane(bool value) { 180 void set_is_displayed_as_overlay_plane(bool value) {
189 is_displayed_as_overlay_plane_ = value; 181 is_displayed_as_overlay_plane_ = value;
190 } 182 }
183 bool SurfaceIsSuspendForRecycle() const override { return false; }
184
185 void OnSwapBuffersComplete() { client_->DidSwapBuffersComplete(); }
186
187 void SetScaleFactor(float scale_factor) {
188 device_scale_factor_ = scale_factor;
189 }
190
191 void SetOverlayCandidateValidator(OverlayCandidateValidator* validator) {
192 overlay_candidate_validator_.reset(validator);
193 }
194
191 unsigned bind_framebuffer_count() const { return bind_framebuffer_count_; } 195 unsigned bind_framebuffer_count() const { return bind_framebuffer_count_; }
192 196
193 private: 197 private:
194 std::unique_ptr<OverlayCandidateValidator> overlay_candidate_validator_; 198 std::unique_ptr<OverlayCandidateValidator> overlay_candidate_validator_;
195 bool is_displayed_as_overlay_plane_; 199 bool is_displayed_as_overlay_plane_;
196 unsigned bind_framebuffer_count_ = 0; 200 unsigned bind_framebuffer_count_ = 0;
197 }; 201 };
198 202
199 std::unique_ptr<RenderPass> CreateRenderPass() { 203 std::unique_ptr<RenderPass> CreateRenderPass() {
200 RenderPassId id(1, 0); 204 RenderPassId id(1, 0);
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 gfx::Size(), filters_, gfx::Vector2dF(1, 1), gfx::PointF(), 1899 gfx::Size(), filters_, gfx::Vector2dF(1, 1), gfx::PointF(),
1896 background_filters_); 1900 background_filters_);
1897 } 1901 }
1898 1902
1899 ProcessForOverlays(); 1903 ProcessForOverlays();
1900 EXPECT_EQ(0U, ca_layer_list_.size()); 1904 EXPECT_EQ(0U, ca_layer_list_.size());
1901 } 1905 }
1902 1906
1903 } // namespace 1907 } // namespace
1904 } // namespace cc 1908 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/output_surface_unittest.cc ('k') | cc/test/fake_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698