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

Side by Side Diff: cc/surfaces/direct_compositor_frame_sink.cc

Issue 2905523003: Revert of Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: Created 3 years, 7 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 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 "cc/surfaces/direct_compositor_frame_sink.h" 5 #include "cc/surfaces/direct_compositor_frame_sink.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_sink_client.h" 9 #include "cc/output/compositor_frame_sink_client.h"
10 #include "cc/surfaces/display.h" 10 #include "cc/surfaces/display.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 CompositorFrameSink::DetachFromClient(); 93 CompositorFrameSink::DetachFromClient();
94 } 94 }
95 95
96 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { 96 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) {
97 DCHECK(frame.metadata.begin_frame_ack.has_damage); 97 DCHECK(frame.metadata.begin_frame_ack.has_damage);
98 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, 98 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber,
99 frame.metadata.begin_frame_ack.sequence_number); 99 frame.metadata.begin_frame_ack.sequence_number);
100 100
101 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); 101 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size();
102 if (!local_surface_id_.is_valid() || frame_size != last_swap_frame_size_ || 102 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) {
103 frame.metadata.device_scale_factor != device_scale_factor_) { 103 delegated_local_surface_id_ = local_surface_id_allocator_.GenerateId();
104 local_surface_id_ = local_surface_id_allocator_.GenerateId();
105 last_swap_frame_size_ = frame_size; 104 last_swap_frame_size_ = frame_size;
106 device_scale_factor_ = frame.metadata.device_scale_factor;
107 display_->SetLocalSurfaceId(local_surface_id_, device_scale_factor_);
108 } 105 }
106 display_->SetLocalSurfaceId(delegated_local_surface_id_,
107 frame.metadata.device_scale_factor);
109 108
110 bool result = 109 support_->SubmitCompositorFrame(delegated_local_surface_id_,
111 support_->SubmitCompositorFrame(local_surface_id_, std::move(frame)); 110 std::move(frame));
112 DCHECK(result);
113 } 111 }
114 112
115 void DirectCompositorFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) { 113 void DirectCompositorFrameSink::DidNotProduceFrame(const BeginFrameAck& ack) {
116 DCHECK(!ack.has_damage); 114 DCHECK(!ack.has_damage);
117 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, ack.sequence_number); 115 DCHECK_LE(BeginFrameArgs::kStartingFrameNumber, ack.sequence_number);
118 support_->DidNotProduceFrame(ack); 116 support_->DidNotProduceFrame(ack);
119 } 117 }
120 118
121 void DirectCompositorFrameSink::DisplayOutputSurfaceLost() { 119 void DirectCompositorFrameSink::DisplayOutputSurfaceLost() {
122 is_lost_ = true; 120 is_lost_ = true;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 const LocalSurfaceId& local_surface_id, 152 const LocalSurfaceId& local_surface_id,
155 const gfx::Rect& damage_rect) { 153 const gfx::Rect& damage_rect) {
156 // TODO(staraz): Implement this. 154 // TODO(staraz): Implement this.
157 } 155 }
158 156
159 void DirectCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) { 157 void DirectCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) {
160 support_->SetNeedsBeginFrame(needs_begin_frame); 158 support_->SetNeedsBeginFrame(needs_begin_frame);
161 } 159 }
162 160
163 } // namespace cc 161 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/direct_compositor_frame_sink.h ('k') | cc/surfaces/direct_compositor_frame_sink_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698