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

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

Issue 12583018: cc: Rename PictureLayerTiling(Set) Iterator to CoverageIterator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 SharedQuadState* shared_quad_state = 99 SharedQuadState* shared_quad_state =
100 quad_sink->UseSharedQuadState(CreateSharedQuadState()); 100 quad_sink->UseSharedQuadState(CreateSharedQuadState());
101 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); 101 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
102 102
103 bool clipped = false; 103 bool clipped = false;
104 gfx::QuadF target_quad = MathUtil::MapQuad( 104 gfx::QuadF target_quad = MathUtil::MapQuad(
105 draw_transform(), 105 draw_transform(),
106 gfx::QuadF(rect), 106 gfx::QuadF(rect),
107 &clipped); 107 &clipped);
108 if (ShowDebugBorders()) { 108 if (ShowDebugBorders()) {
109 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), 109 for (PictureLayerTilingSet::CoverageIterator iter(
110 contents_scale_x(), 110 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_);
111 rect,
112 ideal_contents_scale_);
113 iter; 111 iter;
114 ++iter) { 112 ++iter) {
115 SkColor color; 113 SkColor color;
116 float width; 114 float width;
117 if (*iter && iter->drawing_info().IsReadyToDraw()) { 115 if (*iter && iter->drawing_info().IsReadyToDraw()) {
118 ManagedTileState::DrawingInfo::Mode mode = iter->drawing_info().mode(); 116 ManagedTileState::DrawingInfo::Mode mode = iter->drawing_info().mode();
119 if (mode == ManagedTileState::DrawingInfo::SOLID_COLOR_MODE || 117 if (mode == ManagedTileState::DrawingInfo::SOLID_COLOR_MODE ||
120 mode == ManagedTileState::DrawingInfo::TRANSPARENT_MODE) { 118 mode == ManagedTileState::DrawingInfo::TRANSPARENT_MODE) {
121 color = DebugColors::SolidColorTileBorderColor(); 119 color = DebugColors::SolidColorTileBorderColor();
122 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); 120 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl());
(...skipping 24 matching lines...) Expand all
147 debug_border_quad->SetNew(shared_quad_state, geometry_rect, color, width); 145 debug_border_quad->SetNew(shared_quad_state, geometry_rect, color, width);
148 quad_sink->Append(debug_border_quad.PassAs<DrawQuad>(), 146 quad_sink->Append(debug_border_quad.PassAs<DrawQuad>(),
149 append_quads_data); 147 append_quads_data);
150 } 148 }
151 } 149 }
152 150
153 // Keep track of the tilings that were used so that tilings that are 151 // Keep track of the tilings that were used so that tilings that are
154 // unused can be considered for removal. 152 // unused can be considered for removal.
155 std::vector<PictureLayerTiling*> seen_tilings; 153 std::vector<PictureLayerTiling*> seen_tilings;
156 154
157 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), 155 for (PictureLayerTilingSet::CoverageIterator iter(
158 contents_scale_x(), 156 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_);
159 rect,
160 ideal_contents_scale_);
161 iter; 157 iter;
162 ++iter) { 158 ++iter) {
163 gfx::Rect geometry_rect = iter.geometry_rect(); 159 gfx::Rect geometry_rect = iter.geometry_rect();
164 if (!*iter || !iter->drawing_info().IsReadyToDraw()) { 160 if (!*iter || !iter->drawing_info().IsReadyToDraw()) {
165 if (DrawCheckerboardForMissingTiles()) { 161 if (DrawCheckerboardForMissingTiles()) {
166 // TODO(enne): Figure out how to show debug "invalidated checker" color 162 // TODO(enne): Figure out how to show debug "invalidated checker" color
167 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); 163 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create();
168 SkColor color = DebugColors::DefaultCheckerboardColor(); 164 SkColor color = DebugColors::DefaultCheckerboardColor();
169 quad->SetNew(shared_quad_state, geometry_rect, color); 165 quad->SetNew(shared_quad_state, geometry_rect, color);
170 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) 166 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data))
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 if (is_mask_ == is_mask) 491 if (is_mask_ == is_mask)
496 return; 492 return;
497 is_mask_ = is_mask; 493 is_mask_ = is_mask;
498 if (tilings_) 494 if (tilings_)
499 tilings_->RemoveAllTiles(); 495 tilings_->RemoveAllTiles();
500 } 496 }
501 497
502 ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const { 498 ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const {
503 gfx::Rect content_rect(content_bounds()); 499 gfx::Rect content_rect(content_bounds());
504 float scale = contents_scale_x(); 500 float scale = contents_scale_x();
505 for (PictureLayerTilingSet::Iterator 501 for (PictureLayerTilingSet::CoverageIterator
506 iter(tilings_.get(), scale, content_rect, ideal_contents_scale_); 502 iter(tilings_.get(), scale, content_rect, ideal_contents_scale_);
507 iter; 503 iter;
508 ++iter) { 504 ++iter) {
509 // Mask resource not ready yet. 505 // Mask resource not ready yet.
510 if (!*iter || 506 if (!*iter ||
511 iter->drawing_info().mode() != 507 iter->drawing_info().mode() !=
512 ManagedTileState::DrawingInfo::RESOURCE_MODE || 508 ManagedTileState::DrawingInfo::RESOURCE_MODE ||
513 !iter->drawing_info().IsReadyToDraw()) 509 !iter->drawing_info().IsReadyToDraw())
514 return 0; 510 return 0;
515 // Masks only supported if they fit on exactly one tile. 511 // Masks only supported if they fit on exactly one tile.
(...skipping 26 matching lines...) Expand all
542 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_)); 538 std::min(twin->ideal_contents_scale_, twin->raster_contents_scale_));
543 } 539 }
544 540
545 Region missing_region = rect; 541 Region missing_region = rect;
546 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 542 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
547 PictureLayerTiling* tiling = tilings_->tiling_at(i); 543 PictureLayerTiling* tiling = tilings_->tiling_at(i);
548 544
549 if (tiling->contents_scale() < min_acceptable_scale) 545 if (tiling->contents_scale() < min_acceptable_scale)
550 continue; 546 continue;
551 547
552 for (PictureLayerTiling::Iterator iter(tiling, contents_scale_x(), rect); 548 for (PictureLayerTiling::CoverageIterator iter(tiling,
549 contents_scale_x(),
550 rect);
553 iter; 551 iter;
554 ++iter) { 552 ++iter) {
555 if (should_force_uploads && *iter) 553 if (should_force_uploads && *iter)
556 layer_tree_impl()->tile_manager()->ForceTileUploadToComplete(*iter); 554 layer_tree_impl()->tile_manager()->ForceTileUploadToComplete(*iter);
557 // A null tile (i.e. no recording) is considered "ready". 555 // A null tile (i.e. no recording) is considered "ready".
558 if (!*iter || iter->drawing_info().IsReadyToDraw()) 556 if (!*iter || iter->drawing_info().IsReadyToDraw())
559 missing_region.Subtract(iter.geometry_rect()); 557 missing_region.Subtract(iter.geometry_rect());
560 } 558 }
561 } 559 }
562 560
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { 862 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const {
865 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 863 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
866 LayerImpl::AsValueInto(state.get()); 864 LayerImpl::AsValueInto(state.get());
867 865
868 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); 866 state->SetDouble("ideal_contents_scale", ideal_contents_scale_);
869 state->Set("tilings", tilings_->AsValue().release()); 867 state->Set("tilings", tilings_->AsValue().release());
870 return state.PassAs<base::Value>(); 868 return state.PassAs<base::Value>();
871 } 869 }
872 870
873 } // namespace cc 871 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698