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

Side by Side Diff: services/ui/ws/frame_generator.cc

Issue 2582823002: WIP: Surface Synchronization System
Patch Set: Only create ClientSurfaceEmbedder if window is visible. Trash it otherwise. 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/ui/ws/frame_generator.h" 5 #include "services/ui/ws/frame_generator.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/containers/adapters.h" 10 #include "base/containers/adapters.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 gfx::Size() /* mask_texture_size */, 136 gfx::Size() /* mask_texture_size */,
137 gfx::Vector2dF() /* filters_scale */, 137 gfx::Vector2dF() /* filters_scale */,
138 gfx::PointF() /* filters_origin */); 138 gfx::PointF() /* filters_origin */);
139 frame.render_pass_list.push_back(std::move(invert_pass)); 139 frame.render_pass_list.push_back(std::move(invert_pass));
140 } 140 }
141 frame.metadata.device_scale_factor = device_scale_factor_; 141 frame.metadata.device_scale_factor = device_scale_factor_;
142 142
143 if (window_manager_surface_info_.id().is_valid()) { 143 if (window_manager_surface_info_.id().is_valid()) {
144 frame.metadata.referenced_surfaces.push_back( 144 frame.metadata.referenced_surfaces.push_back(
145 window_manager_surface_info_.id()); 145 window_manager_surface_info_.id());
146 // We have nothing useful to do UNTIL the window manager has something to
147 // show.
148 frame.metadata.respect_deadline = false;
146 } 149 }
147 150
148 return frame; 151 return frame;
149 } 152 }
150 153
151 void FrameGenerator::DrawWindow(cc::RenderPass* pass) { 154 void FrameGenerator::DrawWindow(cc::RenderPass* pass) {
152 DCHECK(window_manager_surface_info_.id().is_valid()); 155 DCHECK(window_manager_surface_info_.id().is_valid());
153 156
154 const gfx::Rect bounds_at_origin( 157 const gfx::Rect bounds_at_origin(
155 window_manager_surface_info_.size_in_pixels()); 158 window_manager_surface_info_.size_in_pixels());
156 159
160 // fprintf(stderr, ">>>>DrawWindow %s\n",
161 // default_surface_id.ToString().c_str());
157 gfx::Transform quad_to_target_transform; 162 gfx::Transform quad_to_target_transform;
158 quad_to_target_transform.Translate(bounds_at_origin.x(), 163 quad_to_target_transform.Translate(bounds_at_origin.x(),
159 bounds_at_origin.y()); 164 bounds_at_origin.y());
160 165
161 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); 166 cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
162 167
163 gfx::Size scaled_bounds = gfx::ScaleToCeiledSize( 168 gfx::Size scaled_bounds = gfx::ScaleToCeiledSize(
164 bounds_at_origin.size(), 169 bounds_at_origin.size(),
165 window_manager_surface_info_.device_scale_factor(), 170 window_manager_surface_info_.device_scale_factor(),
166 window_manager_surface_info_.device_scale_factor()); 171 window_manager_surface_info_.device_scale_factor());
167 172
168 // TODO(fsamuel): These clipping and visible rects are incorrect. They need 173 // TODO(fsamuel): These clipping and visible rects are incorrect. They need
169 // to be populated from CompositorFrame structs. 174 // to be populated from CompositorFrame structs.
170 sqs->SetAll(quad_to_target_transform, scaled_bounds /* layer_bounds */, 175 sqs->SetAll(quad_to_target_transform, scaled_bounds /* layer_bounds */,
171 bounds_at_origin /* visible_layer_bounds */, 176 bounds_at_origin /* visible_layer_bounds */,
172 bounds_at_origin /* clip_rect */, false /* is_clipped */, 177 bounds_at_origin /* clip_rect */, false /* is_clipped */,
173 1.0f /* opacity */, SkBlendMode::kSrcOver, 178 1.0f /* opacity */, SkBlendMode::kSrcOver,
174 0 /* sorting-context_id */); 179 0 /* sorting-context_id */);
175 auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); 180 auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>();
176 quad->SetAll(sqs, bounds_at_origin /* rect */, gfx::Rect() /* opaque_rect */, 181 quad->SetAll(sqs, bounds_at_origin /* rect */, gfx::Rect() /* opaque_rect */,
177 bounds_at_origin /* visible_rect */, true /* needs_blending*/, 182 bounds_at_origin /* visible_rect */, true /* needs_blending*/,
178 window_manager_surface_info_.id()); 183 window_manager_surface_info_.id(),
184 cc::SurfaceDrawQuadType::PRIMARY, nullptr);
179 } 185 }
180 186
181 } // namespace ws 187 } // namespace ws
182 188
183 } // namespace ui 189 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698