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

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 2109603005: cc: Anchor quad offsets to a visible quad. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | no next file » | 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // normally the same as draw viewport but can be independently overridden by 273 // normally the same as draw viewport but can be independently overridden by
274 // embedders like Android WebView with SetExternalTilePriorityConstraints. 274 // embedders like Android WebView with SetExternalTilePriorityConstraints.
275 gfx::Rect scaled_viewport_for_tile_priority = gfx::ScaleToEnclosingRect( 275 gfx::Rect scaled_viewport_for_tile_priority = gfx::ScaleToEnclosingRect(
276 viewport_rect_for_tile_priority_in_content_space_, max_contents_scale); 276 viewport_rect_for_tile_priority_in_content_space_, max_contents_scale);
277 277
278 size_t missing_tile_count = 0u; 278 size_t missing_tile_count = 0u;
279 size_t on_demand_missing_tile_count = 0u; 279 size_t on_demand_missing_tile_count = 0u;
280 only_used_low_res_last_append_quads_ = true; 280 only_used_low_res_last_append_quads_ = true;
281 gfx::Rect scaled_recorded_viewport = gfx::ScaleToEnclosingRect( 281 gfx::Rect scaled_recorded_viewport = gfx::ScaleToEnclosingRect(
282 raster_source_->RecordedViewport(), max_contents_scale); 282 raster_source_->RecordedViewport(), max_contents_scale);
283
284 bool have_origin = false;
285 gfx::Point quad_origin;
286 gfx::Rect visible_quad_layer_rect =
287 shared_quad_state->visible_quad_layer_rect;
288
283 for (PictureLayerTilingSet::CoverageIterator iter( 289 for (PictureLayerTilingSet::CoverageIterator iter(
284 tilings_.get(), max_contents_scale, 290 tilings_.get(), max_contents_scale, visible_quad_layer_rect,
285 shared_quad_state->visible_quad_layer_rect, ideal_contents_scale_); 291 ideal_contents_scale_);
286 iter; ++iter) { 292 iter; ++iter) {
287 gfx::Rect geometry_rect = iter.geometry_rect(); 293 gfx::Rect geometry_rect = iter.geometry_rect();
288 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); 294 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect();
289 gfx::Rect visible_geometry_rect = 295 gfx::Rect visible_geometry_rect =
290 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); 296 scaled_occlusion.GetUnoccludedContentRect(geometry_rect);
291 if (visible_geometry_rect.IsEmpty()) 297 if (visible_geometry_rect.IsEmpty())
292 continue; 298 continue;
293 299
294 append_quads_data->visible_layer_area += 300 append_quads_data->visible_layer_area +=
295 visible_geometry_rect.width() * visible_geometry_rect.height(); 301 visible_geometry_rect.width() * visible_geometry_rect.height();
296 302
297 bool has_draw_quad = false; 303 bool has_draw_quad = false;
298 if (*iter && iter->draw_info().IsReadyToDraw()) { 304 if (*iter && iter->draw_info().IsReadyToDraw()) {
299 const TileDrawInfo& draw_info = iter->draw_info(); 305 const TileDrawInfo& draw_info = iter->draw_info();
306
307 if (!have_origin) {
308 have_origin = true;
309 quad_origin.SetPoint(geometry_rect.x(), geometry_rect.y());
310 shared_quad_state->quad_to_target_transform.Translate(quad_origin.x(),
311 quad_origin.y());
312 shared_quad_state->visible_quad_layer_rect.Offset(-quad_origin.x(),
313 -quad_origin.y());
314 }
315
316 geometry_rect.Offset(-quad_origin.x(), -quad_origin.y());
317 opaque_rect.Offset(-quad_origin.x(), -quad_origin.y());
318 visible_geometry_rect.Offset(-quad_origin.x(), -quad_origin.y());
319
300 switch (draw_info.mode()) { 320 switch (draw_info.mode()) {
301 case TileDrawInfo::RESOURCE_MODE: { 321 case TileDrawInfo::RESOURCE_MODE: {
302 gfx::RectF texture_rect = iter.texture_rect(); 322 gfx::RectF texture_rect = iter.texture_rect();
303 323
304 // The raster_contents_scale_ is the best scale that the layer is 324 // The raster_contents_scale_ is the best scale that the layer is
305 // trying to produce, even though it may not be ideal. Since that's 325 // trying to produce, even though it may not be ideal. Since that's
306 // the best the layer can promise in the future, consider those as 326 // the best the layer can promise in the future, consider those as
307 // complete. But if a tile is ideal scale, we don't want to consider 327 // complete. But if a tile is ideal scale, we don't want to consider
308 // it incomplete and trying to replace it with a tile at a worse 328 // it incomplete and trying to replace it with a tile at a worse
309 // scale. 329 // scale.
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { 1321 bool PictureLayerImpl::IsOnActiveOrPendingTree() const {
1302 return !layer_tree_impl()->IsRecycleTree(); 1322 return !layer_tree_impl()->IsRecycleTree();
1303 } 1323 }
1304 1324
1305 bool PictureLayerImpl::HasValidTilePriorities() const { 1325 bool PictureLayerImpl::HasValidTilePriorities() const {
1306 return IsOnActiveOrPendingTree() && 1326 return IsOnActiveOrPendingTree() &&
1307 is_drawn_render_surface_layer_list_member(); 1327 is_drawn_render_surface_layer_list_member();
1308 } 1328 }
1309 1329
1310 } // namespace cc 1330 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698