| 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->IsReadyToDraw()) { |
| 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 16 matching lines...) Expand all Loading... |
| 146 // unused can be considered for removal. | 149 // unused can be considered for removal. |
| 147 std::vector<PictureLayerTiling*> seen_tilings; | 150 std::vector<PictureLayerTiling*> seen_tilings; |
| 148 | 151 |
| 149 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), | 152 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), |
| 150 contentsScaleX(), | 153 contentsScaleX(), |
| 151 rect, | 154 rect, |
| 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; | |
| 157 if (*iter) | |
| 158 resource = iter->GetResourceId(); | |
| 159 | 159 |
| 160 gfx::Rect geometry_rect = iter.geometry_rect(); | 160 gfx::Rect geometry_rect = iter.geometry_rect(); |
| 161 ResourceProvider::ResourceId resource = 0; |
| 162 if (*iter) { |
| 163 if (iter->is_solid_color()) { |
| 164 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); |
| 165 quad->SetNew(sharedQuadState, |
| 166 geometry_rect, |
| 167 iter->get_solid_color()); |
| 161 | 168 |
| 169 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData); |
| 170 |
| 171 if (!seen_tilings.size() || seen_tilings.back() != iter.CurrentTiling()) |
| 172 seen_tilings.push_back(iter.CurrentTiling()); |
| 173 continue; |
| 174 } else if (iter->is_transparent()) { |
| 175 continue; |
| 176 } |
| 177 resource = iter->GetResourceId(); |
| 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->IsReadyToDraw()) |
| 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 |