OLD | NEW |
---|---|
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 Loading... | |
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()) { |
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 Loading... | |
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()) { | |
reveman
2013/02/28 18:54:55
I think it might be cleaner to move all this into
| |
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 } else if (*iter && iter->is_transparent()) { | |
reveman
2013/02/28 18:54:55
is the "else if" needed? I think it'd be cleaner w
| |
177 continue; | |
178 } | |
162 if (!resource) { | 179 if (!resource) { |
163 if (drawCheckerboardForMissingTiles()) { | 180 if (drawCheckerboardForMissingTiles()) { |
164 // TODO(enne): Figure out how to show debug "invalidated checker" color | 181 // TODO(enne): Figure out how to show debug "invalidated checker" color |
165 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); | 182 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); |
166 SkColor color = DebugColors::DefaultCheckerboardColor(); | 183 SkColor color = DebugColors::DefaultCheckerboardColor(); |
167 quad->SetNew(sharedQuadState, geometry_rect, color); | 184 quad->SetNew(sharedQuadState, geometry_rect, color); |
168 if (quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData)) | 185 if (quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData)) |
169 appendQuadsData.numMissingTiles++; | 186 appendQuadsData.numMissingTiles++; |
170 } else { | 187 } else { |
171 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); | 188 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
515 if (tiling->contents_scale() < min_acceptable_scale) | 532 if (tiling->contents_scale() < min_acceptable_scale) |
516 continue; | 533 continue; |
517 | 534 |
518 for (PictureLayerTiling::Iterator iter(tiling, | 535 for (PictureLayerTiling::Iterator iter(tiling, |
519 contentsScaleX(), | 536 contentsScaleX(), |
520 rect, | 537 rect, |
521 PictureLayerTiling::LayerDeviceAlignm entUnknown); | 538 PictureLayerTiling::LayerDeviceAlignm entUnknown); |
522 iter; | 539 iter; |
523 ++iter) { | 540 ++iter) { |
524 // A null tile (i.e. no recording) is considered "ready". | 541 // A null tile (i.e. no recording) is considered "ready". |
525 if (!*iter || iter->GetResourceId()) | 542 if (!*iter || iter->is_ready_to_draw()) |
526 missing_region.Subtract(iter.geometry_rect()); | 543 missing_region.Subtract(iter.geometry_rect()); |
527 } | 544 } |
528 } | 545 } |
529 | 546 |
530 return missing_region.IsEmpty(); | 547 return missing_region.IsEmpty(); |
531 } | 548 } |
532 | 549 |
533 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { | 550 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { |
534 DCHECK(contents_scale >= MinimumContentsScale()); | 551 DCHECK(contents_scale >= MinimumContentsScale()); |
535 | 552 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
793 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { | 810 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { |
794 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 811 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
795 LayerImpl::AsValueInto(state.get()); | 812 LayerImpl::AsValueInto(state.get()); |
796 | 813 |
797 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); | 814 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
798 state->Set("tilings", tilings_->AsValue().release()); | 815 state->Set("tilings", tilings_->AsValue().release()); |
799 return state.PassAs<base::Value>(); | 816 return state.PassAs<base::Value>(); |
800 } | 817 } |
801 | 818 |
802 } // namespace cc | 819 } // namespace cc |
OLD | NEW |