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 #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/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.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" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } else { | 38 } else { |
39 software_device()->Resize(size, device_scale_factor); | 39 software_device()->Resize(size, device_scale_factor); |
40 } | 40 } |
41 last_reshape_color_space_ = color_space; | 41 last_reshape_color_space_ = color_space; |
42 } | 42 } |
43 | 43 |
44 void FakeOutputSurface::SwapBuffers(OutputSurfaceFrame frame) { | 44 void FakeOutputSurface::SwapBuffers(OutputSurfaceFrame frame) { |
45 last_sent_frame_.reset(new OutputSurfaceFrame(std::move(frame))); | 45 last_sent_frame_.reset(new OutputSurfaceFrame(std::move(frame))); |
46 ++num_sent_frames_; | 46 ++num_sent_frames_; |
47 | 47 |
48 if (context_provider()) { | |
49 last_swap_rect_ = last_sent_frame_->sub_buffer_rect; | |
50 last_swap_rect_valid_ = true; | |
51 } else { | |
52 // Unknown for direct software frames. | |
53 last_swap_rect_ = gfx::Rect(); | |
54 last_swap_rect_valid_ = false; | |
55 } | |
56 | |
57 base::ThreadTaskRunnerHandle::Get()->PostTask( | 48 base::ThreadTaskRunnerHandle::Get()->PostTask( |
58 FROM_HERE, base::Bind(&FakeOutputSurface::SwapBuffersAck, | 49 FROM_HERE, base::Bind(&FakeOutputSurface::SwapBuffersAck, |
59 weak_ptr_factory_.GetWeakPtr())); | 50 weak_ptr_factory_.GetWeakPtr())); |
60 } | 51 } |
61 | 52 |
62 void FakeOutputSurface::SwapBuffersAck() { | 53 void FakeOutputSurface::SwapBuffersAck() { |
63 client_->DidReceiveSwapBuffersAck(); | 54 client_->DidReceiveSwapBuffersAck(); |
64 } | 55 } |
65 | 56 |
66 void FakeOutputSurface::BindFramebuffer() { | 57 void FakeOutputSurface::BindFramebuffer() { |
(...skipping 28 matching lines...) Expand all Loading... |
95 | 86 |
96 bool FakeOutputSurface::IsDisplayedAsOverlayPlane() const { | 87 bool FakeOutputSurface::IsDisplayedAsOverlayPlane() const { |
97 return false; | 88 return false; |
98 } | 89 } |
99 | 90 |
100 unsigned FakeOutputSurface::GetOverlayTextureId() const { | 91 unsigned FakeOutputSurface::GetOverlayTextureId() const { |
101 return 0; | 92 return 0; |
102 } | 93 } |
103 | 94 |
104 } // namespace cc | 95 } // namespace cc |
OLD | NEW |