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

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

Issue 2399983003: cc: Make OutputSurface::Reshape abstract (Closed)
Patch Set: reshapeabstract: . 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/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 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "cc/output/output_surface_client.h" 9 #include "cc/output/output_surface_client.h"
10 #include "cc/resources/returned_resource.h" 10 #include "cc/resources/returned_resource.h"
11 #include "cc/test/begin_frame_args_test.h" 11 #include "cc/test/begin_frame_args_test.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 FakeOutputSurface::FakeOutputSurface( 16 FakeOutputSurface::FakeOutputSurface(
17 scoped_refptr<ContextProvider> context_provider) 17 scoped_refptr<ContextProvider> context_provider)
18 : OutputSurface(std::move(context_provider)) {} 18 : OutputSurface(std::move(context_provider)) {
19 DCHECK(OutputSurface::context_provider());
20 }
19 21
20 FakeOutputSurface::FakeOutputSurface( 22 FakeOutputSurface::FakeOutputSurface(
21 std::unique_ptr<SoftwareOutputDevice> software_device) 23 std::unique_ptr<SoftwareOutputDevice> software_device)
22 : OutputSurface(std::move(software_device)) {} 24 : OutputSurface(std::move(software_device)) {
25 DCHECK(OutputSurface::software_device());
26 }
23 27
24 FakeOutputSurface::~FakeOutputSurface() = default; 28 FakeOutputSurface::~FakeOutputSurface() = default;
25 29
30 void FakeOutputSurface::Reshape(const gfx::Size& size,
31 float device_scale_factor,
32 const gfx::ColorSpace& color_space,
33 bool has_alpha) {
34 if (context_provider()) {
35 context_provider()->ContextGL()->ResizeCHROMIUM(
36 size.width(), size.height(), device_scale_factor, has_alpha);
37 } else {
38 software_device()->Resize(size, device_scale_factor);
39 }
40 }
41
26 void FakeOutputSurface::SwapBuffers(OutputSurfaceFrame frame) { 42 void FakeOutputSurface::SwapBuffers(OutputSurfaceFrame frame) {
27 last_sent_frame_.reset(new OutputSurfaceFrame(std::move(frame))); 43 last_sent_frame_.reset(new OutputSurfaceFrame(std::move(frame)));
28 ++num_sent_frames_; 44 ++num_sent_frames_;
29 45
30 if (context_provider()) { 46 if (context_provider()) {
31 last_swap_rect_ = last_sent_frame_->sub_buffer_rect; 47 last_swap_rect_ = last_sent_frame_->sub_buffer_rect;
32 last_swap_rect_valid_ = true; 48 last_swap_rect_valid_ = true;
33 } else { 49 } else {
34 // Unknown for direct software frames. 50 // Unknown for direct software frames.
35 last_swap_rect_ = gfx::Rect(); 51 last_swap_rect_ = gfx::Rect();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 90
75 bool FakeOutputSurface::IsDisplayedAsOverlayPlane() const { 91 bool FakeOutputSurface::IsDisplayedAsOverlayPlane() const {
76 return false; 92 return false;
77 } 93 }
78 94
79 unsigned FakeOutputSurface::GetOverlayTextureId() const { 95 unsigned FakeOutputSurface::GetOverlayTextureId() const {
80 return 0; 96 return 0;
81 } 97 }
82 98
83 } // namespace cc 99 } // 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