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

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: fixed unittest Created 7 years, 10 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (showDebugBorders()) { 108 if (showDebugBorders()) {
109 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), 109 for (PictureLayerTilingSet::Iterator iter(tilings_.get(),
110 contentsScaleX(), 110 contentsScaleX(),
111 rect, 111 rect,
112 ideal_contents_scale_, 112 ideal_contents_scale_,
113 layerDeviceAlignment); 113 layerDeviceAlignment);
114 iter; 114 iter;
115 ++iter) { 115 ++iter) {
116 SkColor color; 116 SkColor color;
117 float width; 117 float width;
118 if (*iter && iter->GetResourceId()) { 118 if (*iter && iter->is_ready_to_draw()) {
Tom Hudson 2013/02/27 14:49:36 You've changed the condition here; is it just for
119 if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { 119 if (iter->is_solid_color() || iter->is_transparent()) {
120 color = DebugColors::SolidColorTileBorderColor();
121 width = DebugColors::SolidColorTileBorderWidth(layerTreeImpl());
122 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) {
120 color = DebugColors::HighResTileBorderColor(); 123 color = DebugColors::HighResTileBorderColor();
121 width = DebugColors::HighResTileBorderWidth(layerTreeImpl()); 124 width = DebugColors::HighResTileBorderWidth(layerTreeImpl());
122 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { 125 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) {
123 color = DebugColors::LowResTileBorderColor(); 126 color = DebugColors::LowResTileBorderColor();
124 width = DebugColors::LowResTileBorderWidth(layerTreeImpl()); 127 width = DebugColors::LowResTileBorderWidth(layerTreeImpl());
125 } else if (iter->contents_scale() > contentsScaleX()) { 128 } else if (iter->contents_scale() > contentsScaleX()) {
126 color = DebugColors::ExtraHighResTileBorderColor(); 129 color = DebugColors::ExtraHighResTileBorderColor();
127 width = DebugColors::ExtraHighResTileBorderWidth(layerTreeImpl()); 130 width = DebugColors::ExtraHighResTileBorderWidth(layerTreeImpl());
128 } else { 131 } else {
129 color = DebugColors::ExtraLowResTileBorderColor(); 132 color = DebugColors::ExtraLowResTileBorderColor();
(...skipping 22 matching lines...) Expand all
152 ideal_contents_scale_, 155 ideal_contents_scale_,
153 layerDeviceAlignment); 156 layerDeviceAlignment);
154 iter; 157 iter;
155 ++iter) { 158 ++iter) {
156 ResourceProvider::ResourceId resource = 0; 159 ResourceProvider::ResourceId resource = 0;
157 if (*iter) 160 if (*iter)
158 resource = iter->GetResourceId(); 161 resource = iter->GetResourceId();
159 162
160 gfx::Rect geometry_rect = iter.geometry_rect(); 163 gfx::Rect geometry_rect = iter.geometry_rect();
161 164
165 if (*iter && iter->is_solid_color()) {
166 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
167 quad->SetNew(sharedQuadState,
168 geometry_rect,
169 iter->get_solid_color());
170
171 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
172
173 if (!seen_tilings.size() || seen_tilings.back() != iter.CurrentTiling())
174 seen_tilings.push_back(iter.CurrentTiling());
175 continue;
176 }
177 else if (*iter && iter->is_transparent()) {
Tom Hudson 2013/02/27 14:49:36 nit: else on same line as } ?
178 continue;
179 }
162 if (!resource) { 180 if (!resource) {
163 if (drawCheckerboardForMissingTiles()) { 181 if (drawCheckerboardForMissingTiles()) {
164 // TODO(enne): Figure out how to show debug "invalidated checker" color 182 // TODO(enne): Figure out how to show debug "invalidated checker" color
165 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); 183 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create();
166 SkColor color = DebugColors::DefaultCheckerboardColor(); 184 SkColor color = DebugColors::DefaultCheckerboardColor();
167 quad->SetNew(sharedQuadState, geometry_rect, color); 185 quad->SetNew(sharedQuadState, geometry_rect, color);
168 if (quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData)) 186 if (quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData))
169 appendQuadsData.numMissingTiles++; 187 appendQuadsData.numMissingTiles++;
170 } else { 188 } else {
171 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); 189 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 if (tiling->contents_scale() < min_acceptable_scale) 536 if (tiling->contents_scale() < min_acceptable_scale)
519 continue; 537 continue;
520 538
521 for (PictureLayerTiling::Iterator iter(tiling, 539 for (PictureLayerTiling::Iterator iter(tiling,
522 contentsScaleX(), 540 contentsScaleX(),
523 rect, 541 rect,
524 PictureLayerTiling::LayerDeviceAlignm entUnknown); 542 PictureLayerTiling::LayerDeviceAlignm entUnknown);
525 iter; 543 iter;
526 ++iter) { 544 ++iter) {
527 // A null tile (i.e. no recording) is considered "ready". 545 // A null tile (i.e. no recording) is considered "ready".
528 if (!*iter || iter->GetResourceId()) 546 if (!*iter || iter->is_ready_to_draw())
529 missing_region.Subtract(iter.geometry_rect()); 547 missing_region.Subtract(iter.geometry_rect());
530 } 548 }
531 } 549 }
532 550
533 return missing_region.IsEmpty(); 551 return missing_region.IsEmpty();
534 } 552 }
535 553
536 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { 554 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) {
537 DCHECK(contents_scale >= MinimumContentsScale()); 555 DCHECK(contents_scale >= MinimumContentsScale());
538 556
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { 814 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const {
797 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 815 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
798 LayerImpl::AsValueInto(state.get()); 816 LayerImpl::AsValueInto(state.get());
799 817
800 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); 818 state->SetDouble("ideal_contents_scale", ideal_contents_scale_);
801 state->Set("tilings", tilings_->AsValue().release()); 819 state->Set("tilings", tilings_->AsValue().release());
802 return state.PassAs<base::Value>(); 820 return state.PassAs<base::Value>();
803 } 821 }
804 822
805 } // namespace cc 823 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698