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

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

Issue 603683006: cc: Remove low quality mode and cleanup tile versions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove paint_simplifier include Created 6 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
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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 for (PictureLayerTilingSet::CoverageIterator iter( 240 for (PictureLayerTilingSet::CoverageIterator iter(
241 tilings_.get(), 241 tilings_.get(),
242 max_contents_scale, 242 max_contents_scale,
243 scaled_visible_content_rect, 243 scaled_visible_content_rect,
244 ideal_contents_scale_); 244 ideal_contents_scale_);
245 iter; 245 iter;
246 ++iter) { 246 ++iter) {
247 SkColor color; 247 SkColor color;
248 float width; 248 float width;
249 if (*iter && iter->IsReadyToDraw()) { 249 if (*iter && iter->IsReadyToDraw()) {
250 ManagedTileState::TileVersion::Mode mode = 250 ManagedTileState::TileDrawInfo::Mode mode =
251 iter->GetTileVersionForDrawing().mode(); 251 iter->GetTileDrawInfo().mode();
252 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { 252 if (mode == ManagedTileState::TileDrawInfo::SOLID_COLOR_MODE) {
253 color = DebugColors::SolidColorTileBorderColor(); 253 color = DebugColors::SolidColorTileBorderColor();
254 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); 254 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl());
255 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { 255 } else if (mode == ManagedTileState::TileDrawInfo::PICTURE_PILE_MODE) {
256 color = DebugColors::PictureTileBorderColor(); 256 color = DebugColors::PictureTileBorderColor();
257 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); 257 width = DebugColors::PictureTileBorderWidth(layer_tree_impl());
258 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { 258 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) {
259 color = DebugColors::HighResTileBorderColor(); 259 color = DebugColors::HighResTileBorderColor();
260 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); 260 width = DebugColors::HighResTileBorderWidth(layer_tree_impl());
261 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { 261 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) {
262 color = DebugColors::LowResTileBorderColor(); 262 color = DebugColors::LowResTileBorderColor();
263 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); 263 width = DebugColors::LowResTileBorderWidth(layer_tree_impl());
264 } else if (iter->contents_scale() > max_contents_scale) { 264 } else if (iter->contents_scale() > max_contents_scale) {
265 color = DebugColors::ExtraHighResTileBorderColor(); 265 color = DebugColors::ExtraHighResTileBorderColor();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 gfx::Rect visible_geometry_rect = 308 gfx::Rect visible_geometry_rect =
309 occlusion.GetUnoccludedContentRect(geometry_rect); 309 occlusion.GetUnoccludedContentRect(geometry_rect);
310 if (visible_geometry_rect.IsEmpty()) 310 if (visible_geometry_rect.IsEmpty())
311 continue; 311 continue;
312 312
313 append_quads_data->visible_content_area += 313 append_quads_data->visible_content_area +=
314 visible_geometry_rect.width() * visible_geometry_rect.height(); 314 visible_geometry_rect.width() * visible_geometry_rect.height();
315 315
316 bool has_draw_quad = false; 316 bool has_draw_quad = false;
317 if (*iter && iter->IsReadyToDraw()) { 317 if (*iter && iter->IsReadyToDraw()) {
318 const ManagedTileState::TileVersion& tile_version = 318 const ManagedTileState::TileDrawInfo& draw_info = iter->GetTileDrawInfo();
319 iter->GetTileVersionForDrawing(); 319 switch (draw_info.mode()) {
320 switch (tile_version.mode()) { 320 case ManagedTileState::TileDrawInfo::RESOURCE_MODE: {
321 case ManagedTileState::TileVersion::RESOURCE_MODE: {
322 gfx::RectF texture_rect = iter.texture_rect(); 321 gfx::RectF texture_rect = iter.texture_rect();
323 322
324 // The raster_contents_scale_ is the best scale that the layer is 323 // The raster_contents_scale_ is the best scale that the layer is
325 // trying to produce, even though it may not be ideal. Since that's 324 // trying to produce, even though it may not be ideal. Since that's
326 // the best the layer can promise in the future, consider those as 325 // the best the layer can promise in the future, consider those as
327 // complete. But if a tile is ideal scale, we don't want to consider 326 // complete. But if a tile is ideal scale, we don't want to consider
328 // it incomplete and trying to replace it with a tile at a worse 327 // it incomplete and trying to replace it with a tile at a worse
329 // scale. 328 // scale.
330 if (iter->contents_scale() != raster_contents_scale_ && 329 if (iter->contents_scale() != raster_contents_scale_ &&
331 iter->contents_scale() != ideal_contents_scale_ && 330 iter->contents_scale() != ideal_contents_scale_ &&
332 geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { 331 geometry_rect.Intersects(scaled_viewport_for_tile_priority)) {
333 append_quads_data->num_incomplete_tiles++; 332 append_quads_data->num_incomplete_tiles++;
334 } 333 }
335 334
336 TileDrawQuad* quad = 335 TileDrawQuad* quad =
337 render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); 336 render_pass->CreateAndAppendDrawQuad<TileDrawQuad>();
338 quad->SetNew(shared_quad_state, 337 quad->SetNew(shared_quad_state,
339 geometry_rect, 338 geometry_rect,
340 opaque_rect, 339 opaque_rect,
341 visible_geometry_rect, 340 visible_geometry_rect,
342 tile_version.get_resource_id(), 341 draw_info.get_resource_id(),
343 texture_rect, 342 texture_rect,
344 iter.texture_size(), 343 iter.texture_size(),
345 tile_version.contents_swizzled()); 344 draw_info.contents_swizzled());
346 has_draw_quad = true; 345 has_draw_quad = true;
347 break; 346 break;
348 } 347 }
349 case ManagedTileState::TileVersion::PICTURE_PILE_MODE: { 348 case ManagedTileState::TileDrawInfo::PICTURE_PILE_MODE: {
350 if (!layer_tree_impl() 349 if (!layer_tree_impl()
351 ->GetRendererCapabilities() 350 ->GetRendererCapabilities()
352 .allow_rasterize_on_demand) { 351 .allow_rasterize_on_demand) {
353 ++on_demand_missing_tile_count; 352 ++on_demand_missing_tile_count;
354 break; 353 break;
355 } 354 }
356 355
357 gfx::RectF texture_rect = iter.texture_rect(); 356 gfx::RectF texture_rect = iter.texture_rect();
358 357
359 ResourceProvider* resource_provider = 358 ResourceProvider* resource_provider =
360 layer_tree_impl()->resource_provider(); 359 layer_tree_impl()->resource_provider();
361 ResourceFormat format = 360 ResourceFormat format =
362 resource_provider->memory_efficient_texture_format(); 361 resource_provider->memory_efficient_texture_format();
363 PictureDrawQuad* quad = 362 PictureDrawQuad* quad =
364 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); 363 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>();
365 quad->SetNew(shared_quad_state, 364 quad->SetNew(shared_quad_state,
366 geometry_rect, 365 geometry_rect,
367 opaque_rect, 366 opaque_rect,
368 visible_geometry_rect, 367 visible_geometry_rect,
369 texture_rect, 368 texture_rect,
370 iter.texture_size(), 369 iter.texture_size(),
371 format, 370 format,
372 iter->content_rect(), 371 iter->content_rect(),
373 iter->contents_scale(), 372 iter->contents_scale(),
374 pile_); 373 pile_);
375 has_draw_quad = true; 374 has_draw_quad = true;
376 break; 375 break;
377 } 376 }
378 case ManagedTileState::TileVersion::SOLID_COLOR_MODE: { 377 case ManagedTileState::TileDrawInfo::SOLID_COLOR_MODE: {
379 SolidColorDrawQuad* quad = 378 SolidColorDrawQuad* quad =
380 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); 379 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
381 quad->SetNew(shared_quad_state, 380 quad->SetNew(shared_quad_state,
382 geometry_rect, 381 geometry_rect,
383 visible_geometry_rect, 382 visible_geometry_rect,
384 tile_version.get_solid_color(), 383 draw_info.get_solid_color(),
385 false); 384 false);
386 has_draw_quad = true; 385 has_draw_quad = true;
387 break; 386 break;
388 } 387 }
389 } 388 }
390 } 389 }
391 390
392 if (!has_draw_quad) { 391 if (!has_draw_quad) {
393 if (draw_checkerboard_for_missing_tiles()) { 392 if (draw_checkerboard_for_missing_tiles()) {
394 CheckerboardDrawQuad* quad = 393 CheckerboardDrawQuad* quad =
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 781
783 // Mask resource not ready yet. 782 // Mask resource not ready yet.
784 if (!iter || !*iter) 783 if (!iter || !*iter)
785 return 0; 784 return 0;
786 785
787 // Masks only supported if they fit on exactly one tile. 786 // Masks only supported if they fit on exactly one tile.
788 DCHECK(iter.geometry_rect() == content_rect) 787 DCHECK(iter.geometry_rect() == content_rect)
789 << "iter rect " << iter.geometry_rect().ToString() << " content rect " 788 << "iter rect " << iter.geometry_rect().ToString() << " content rect "
790 << content_rect.ToString(); 789 << content_rect.ToString();
791 790
792 const ManagedTileState::TileVersion& tile_version = 791 const ManagedTileState::TileDrawInfo& draw_info = iter->GetTileDrawInfo();
793 iter->GetTileVersionForDrawing(); 792 if (!draw_info.IsReadyToDraw() ||
794 if (!tile_version.IsReadyToDraw() || 793 draw_info.mode() != ManagedTileState::TileDrawInfo::RESOURCE_MODE)
795 tile_version.mode() != ManagedTileState::TileVersion::RESOURCE_MODE)
796 return 0; 794 return 0;
797 795
798 return tile_version.get_resource_id(); 796 return draw_info.get_resource_id();
799 } 797 }
800 798
801 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const { 799 void PictureLayerImpl::MarkVisibleResourcesAsRequired() const {
802 DCHECK(layer_tree_impl()->IsPendingTree()); 800 DCHECK(layer_tree_impl()->IsPendingTree());
803 DCHECK(ideal_contents_scale_); 801 DCHECK(ideal_contents_scale_);
804 DCHECK_GT(tilings_->num_tilings(), 0u); 802 DCHECK_GT(tilings_->num_tilings(), 0u);
805 803
806 // The goal of this function is to find the minimum set of tiles that need to 804 // The goal of this function is to find the minimum set of tiles that need to
807 // be ready to draw in order to activate without flashing content from a 805 // be ready to draw in order to activate without flashing content from a
808 // higher res on the active tree to a lower res on the pending tree. 806 // higher res on the active tree to a lower res on the pending tree.
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); 1785 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange();
1788 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; 1786 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start;
1789 return tiling_range.end - 1 - current_tiling_range_offset; 1787 return tiling_range.end - 1 - current_tiling_range_offset;
1790 } 1788 }
1791 } 1789 }
1792 NOTREACHED(); 1790 NOTREACHED();
1793 return 0; 1791 return 0;
1794 } 1792 }
1795 1793
1796 } // namespace cc 1794 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698