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

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: added constant instead of -1 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, geometry_rect, iter->solid_color());
165 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
160 166
167 if (!seen_tilings.size() || seen_tilings.back() != iter.CurrentTiling())
168 seen_tilings.push_back(iter.CurrentTiling());
169 continue;
170 } else if (iter->is_transparent()) {
171 continue;
172 }
173 resource = iter->GetResourceId();
174 }
161 if (!resource) { 175 if (!resource) {
162 if (drawCheckerboardForMissingTiles()) { 176 if (drawCheckerboardForMissingTiles()) {
163 // TODO(enne): Figure out how to show debug "invalidated checker" color 177 // TODO(enne): Figure out how to show debug "invalidated checker" color
164 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); 178 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create();
165 SkColor color = DebugColors::DefaultCheckerboardColor(); 179 SkColor color = DebugColors::DefaultCheckerboardColor();
166 quad->SetNew(sharedQuadState, geometry_rect, color); 180 quad->SetNew(sharedQuadState, geometry_rect, color);
167 if (quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData)) 181 if (quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData))
168 appendQuadsData.numMissingTiles++; 182 appendQuadsData.numMissingTiles++;
169 } else { 183 } else {
170 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); 184 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) 519 if (tiling->contents_scale() < min_acceptable_scale)
506 continue; 520 continue;
507 521
508 for (PictureLayerTiling::Iterator iter(tiling, 522 for (PictureLayerTiling::Iterator iter(tiling,
509 contentsScaleX(), 523 contentsScaleX(),
510 rect, 524 rect,
511 PictureLayerTiling::LayerDeviceAlignm entUnknown); 525 PictureLayerTiling::LayerDeviceAlignm entUnknown);
512 iter; 526 iter;
513 ++iter) { 527 ++iter) {
514 // A null tile (i.e. no recording) is considered "ready". 528 // A null tile (i.e. no recording) is considered "ready".
515 if (!*iter || iter->GetResourceId()) 529 if (!*iter || iter->IsReadyToDraw())
516 missing_region.Subtract(iter.geometry_rect()); 530 missing_region.Subtract(iter.geometry_rect());
517 } 531 }
518 } 532 }
519 533
520 return missing_region.IsEmpty(); 534 return missing_region.IsEmpty();
521 } 535 }
522 536
523 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { 537 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) {
524 DCHECK(contents_scale >= MinimumContentsScale()); 538 DCHECK(contents_scale >= MinimumContentsScale());
525 539
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { 797 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const {
784 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 798 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
785 LayerImpl::AsValueInto(state.get()); 799 LayerImpl::AsValueInto(state.get());
786 800
787 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); 801 state->SetDouble("ideal_contents_scale", ideal_contents_scale_);
788 state->Set("tilings", tilings_->AsValue().release()); 802 state->Set("tilings", tilings_->AsValue().release());
789 return state.PassAs<base::Value>(); 803 return state.PassAs<base::Value>();
790 } 804 }
791 805
792 } // namespace cc 806 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698