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

Side by Side Diff: cc/picture_layer_impl.cc

Issue 12316084: cc: Consolidate the analysis_canvas operations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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/picture_layer_impl.h" 5 #include "cc/picture_layer_impl.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "cc/append_quads_data.h" 8 #include "cc/append_quads_data.h"
9 #include "cc/checkerboard_draw_quad.h" 9 #include "cc/checkerboard_draw_quad.h"
10 #include "cc/debug_border_draw_quad.h" 10 #include "cc/debug_border_draw_quad.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 if (showDebugBorders()) { 107 if (showDebugBorders()) {
108 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), 108 for (PictureLayerTilingSet::Iterator iter(tilings_.get(),
109 contentsScaleX(), 109 contentsScaleX(),
110 rect, 110 rect,
111 ideal_contents_scale_, 111 ideal_contents_scale_,
112 layerDeviceAlignment); 112 layerDeviceAlignment);
113 iter; 113 iter;
114 ++iter) { 114 ++iter) {
115 SkColor color; 115 SkColor color;
116 float width; 116 float width;
117 if (*iter && iter->GetResourceId()) { 117 if (*iter && iter->IsReadyToDraw()) {
118 if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { 118 if (iter->is_solid_color() || iter->is_transparent()) {
119 color = DebugColors::SolidColorTileBorderColor();
120 width = DebugColors::SolidColorTileBorderWidth(layerTreeImpl());
121 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) {
119 color = DebugColors::HighResTileBorderColor(); 122 color = DebugColors::HighResTileBorderColor();
120 width = DebugColors::HighResTileBorderWidth(layerTreeImpl()); 123 width = DebugColors::HighResTileBorderWidth(layerTreeImpl());
121 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { 124 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) {
122 color = DebugColors::LowResTileBorderColor(); 125 color = DebugColors::LowResTileBorderColor();
123 width = DebugColors::LowResTileBorderWidth(layerTreeImpl()); 126 width = DebugColors::LowResTileBorderWidth(layerTreeImpl());
124 } else if (iter->contents_scale() > contentsScaleX()) { 127 } else if (iter->contents_scale() > contentsScaleX()) {
125 color = DebugColors::ExtraHighResTileBorderColor(); 128 color = DebugColors::ExtraHighResTileBorderColor();
126 width = DebugColors::ExtraHighResTileBorderWidth(layerTreeImpl()); 129 width = DebugColors::ExtraHighResTileBorderWidth(layerTreeImpl());
127 } else { 130 } else {
128 color = DebugColors::ExtraLowResTileBorderColor(); 131 color = DebugColors::ExtraLowResTileBorderColor();
(...skipping 16 matching lines...) Expand all
145 // unused can be considered for removal. 148 // unused can be considered for removal.
146 std::vector<PictureLayerTiling*> seen_tilings; 149 std::vector<PictureLayerTiling*> seen_tilings;
147 150
148 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), 151 for (PictureLayerTilingSet::Iterator iter(tilings_.get(),
149 contentsScaleX(), 152 contentsScaleX(),
150 rect, 153 rect,
151 ideal_contents_scale_, 154 ideal_contents_scale_,
152 layerDeviceAlignment); 155 layerDeviceAlignment);
153 iter; 156 iter;
154 ++iter) { 157 ++iter) {
155 ResourceProvider::ResourceId resource = 0;
156 if (*iter)
157 resource = iter->GetResourceId();
158 158
159 gfx::Rect geometry_rect = iter.geometry_rect(); 159 gfx::Rect geometry_rect = iter.geometry_rect();
160 ResourceProvider::ResourceId resource = 0;
161 if (*iter) {
162 if (iter->is_solid_color()) {
163 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
164 quad->SetNew(sharedQuadState,
165 geometry_rect,
166 iter->get_solid_color());
160 167
168 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
169
170 if (!seen_tilings.size() || seen_tilings.back() != iter.CurrentTiling())
171 seen_tilings.push_back(iter.CurrentTiling());
172 continue;
173 } else if (iter->is_transparent()) {
174 continue;
175 }
176 resource = iter->GetResourceId();
177 }
161 if (!resource) { 178 if (!resource) {
162 if (drawCheckerboardForMissingTiles()) { 179 if (drawCheckerboardForMissingTiles()) {
163 // TODO(enne): Figure out how to show debug "invalidated checker" color 180 // TODO(enne): Figure out how to show debug "invalidated checker" color
164 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); 181 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create();
165 SkColor color = DebugColors::DefaultCheckerboardColor(); 182 SkColor color = DebugColors::DefaultCheckerboardColor();
166 quad->SetNew(sharedQuadState, geometry_rect, color); 183 quad->SetNew(sharedQuadState, geometry_rect, color);
167 if (quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData)) 184 if (quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData))
168 appendQuadsData.numMissingTiles++; 185 appendQuadsData.numMissingTiles++;
169 } else { 186 } else {
170 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); 187 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 if (tiling->contents_scale() < min_acceptable_scale) 522 if (tiling->contents_scale() < min_acceptable_scale)
506 continue; 523 continue;
507 524
508 for (PictureLayerTiling::Iterator iter(tiling, 525 for (PictureLayerTiling::Iterator iter(tiling,
509 contentsScaleX(), 526 contentsScaleX(),
510 rect, 527 rect,
511 PictureLayerTiling::LayerDeviceAlignm entUnknown); 528 PictureLayerTiling::LayerDeviceAlignm entUnknown);
512 iter; 529 iter;
513 ++iter) { 530 ++iter) {
514 // A null tile (i.e. no recording) is considered "ready". 531 // A null tile (i.e. no recording) is considered "ready".
515 if (!*iter || iter->GetResourceId()) 532 if (!*iter || iter->IsReadyToDraw())
516 missing_region.Subtract(iter.geometry_rect()); 533 missing_region.Subtract(iter.geometry_rect());
517 } 534 }
518 } 535 }
519 536
520 return missing_region.IsEmpty(); 537 return missing_region.IsEmpty();
521 } 538 }
522 539
523 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { 540 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) {
524 DCHECK(contents_scale >= MinimumContentsScale()); 541 DCHECK(contents_scale >= MinimumContentsScale());
525 542
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { 800 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const {
784 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 801 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
785 LayerImpl::AsValueInto(state.get()); 802 LayerImpl::AsValueInto(state.get());
786 803
787 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); 804 state->SetDouble("ideal_contents_scale", ideal_contents_scale_);
788 state->Set("tilings", tilings_->AsValue().release()); 805 state->Set("tilings", tilings_->AsValue().release());
789 return state.PassAs<base::Value>(); 806 return state.PassAs<base::Value>();
790 } 807 }
791 808
792 } // namespace cc 809 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698