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

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: win warning fix 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 | « cc/picture.cc ('k') | cc/picture_layer_tiling_set.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/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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 if (tiling->contents_scale() < min_acceptable_scale) 516 if (tiling->contents_scale() < min_acceptable_scale)
503 continue; 517 continue;
504 518
505 for (PictureLayerTiling::Iterator iter(tiling, 519 for (PictureLayerTiling::Iterator iter(tiling,
506 contentsScaleX(), 520 contentsScaleX(),
507 rect, 521 rect,
508 PictureLayerTiling::LayerDeviceAlignm entUnknown); 522 PictureLayerTiling::LayerDeviceAlignm entUnknown);
509 iter; 523 iter;
510 ++iter) { 524 ++iter) {
511 // A null tile (i.e. no recording) is considered "ready". 525 // A null tile (i.e. no recording) is considered "ready".
512 if (!*iter || iter->GetResourceId()) 526 if (!*iter || iter->IsReadyToDraw())
513 missing_region.Subtract(iter.geometry_rect()); 527 missing_region.Subtract(iter.geometry_rect());
514 } 528 }
515 } 529 }
516 530
517 return missing_region.IsEmpty(); 531 return missing_region.IsEmpty();
518 } 532 }
519 533
520 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { 534 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) {
521 DCHECK(contents_scale >= MinimumContentsScale()); 535 DCHECK(contents_scale >= MinimumContentsScale());
522 536
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { 794 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const {
781 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 795 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
782 LayerImpl::AsValueInto(state.get()); 796 LayerImpl::AsValueInto(state.get());
783 797
784 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); 798 state->SetDouble("ideal_contents_scale", ideal_contents_scale_);
785 state->Set("tilings", tilings_->AsValue().release()); 799 state->Set("tilings", tilings_->AsValue().release());
786 return state.PassAs<base::Value>(); 800 return state.PassAs<base::Value>();
787 } 801 }
788 802
789 } // namespace cc 803 } // namespace cc
OLDNEW
« no previous file with comments | « cc/picture.cc ('k') | cc/picture_layer_tiling_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698