Chromium Code Reviews| 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 | 150 |
| 151 // Keep track of the tilings that were used so that tilings that are | 151 // Keep track of the tilings that were used so that tilings that are |
| 152 // unused can be considered for removal. | 152 // unused can be considered for removal. |
| 153 std::vector<PictureLayerTiling*> seen_tilings; | 153 std::vector<PictureLayerTiling*> seen_tilings; |
| 154 | 154 |
| 155 for (PictureLayerTilingSet::CoverageIterator iter( | 155 for (PictureLayerTilingSet::CoverageIterator iter( |
| 156 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_); | 156 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_); |
| 157 iter; | 157 iter; |
| 158 ++iter) { | 158 ++iter) { |
| 159 gfx::Rect geometry_rect = iter.geometry_rect(); | 159 gfx::Rect geometry_rect = iter.geometry_rect(); |
| 160 if (!*iter || !iter->drawing_info().IsReadyToDraw()) { | 160 if (!*iter || (!iter->drawing_info().IsReadyToDraw() && |
| 161 !append_quads_data->cannot_append_tile_draw_quads)) { | |
| 161 if (DrawCheckerboardForMissingTiles()) { | 162 if (DrawCheckerboardForMissingTiles()) { |
| 162 // TODO(enne): Figure out how to show debug "invalidated checker" color | 163 // TODO(enne): Figure out how to show debug "invalidated checker" color |
| 163 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); | 164 scoped_ptr<CheckerboardDrawQuad> quad = CheckerboardDrawQuad::Create(); |
| 164 SkColor color = DebugColors::DefaultCheckerboardColor(); | 165 SkColor color = DebugColors::DefaultCheckerboardColor(); |
| 165 quad->SetNew(shared_quad_state, geometry_rect, color); | 166 quad->SetNew(shared_quad_state, geometry_rect, color); |
| 166 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) | 167 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) |
| 167 append_quads_data->num_missing_tiles++; | 168 append_quads_data->num_missing_tiles++; |
| 168 } else { | 169 } else { |
| 169 SkColor color = background_color(); | 170 SkColor color = background_color(); |
| 170 // TODO(wangxianzhu): Change the next |if| condition once we support | 171 // TODO(wangxianzhu): Change the next |if| condition once we support |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 187 quad->SetNew(shared_quad_state, geometry_rect, color); | 188 quad->SetNew(shared_quad_state, geometry_rect, color); |
| 188 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) | 189 if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) |
| 189 append_quads_data->num_missing_tiles++; | 190 append_quads_data->num_missing_tiles++; |
| 190 } | 191 } |
| 191 | 192 |
| 192 append_quads_data->had_incomplete_tile = true; | 193 append_quads_data->had_incomplete_tile = true; |
| 193 continue; | 194 continue; |
| 194 } | 195 } |
| 195 | 196 |
| 196 const ManagedTileState::DrawingInfo& drawing_info = iter->drawing_info(); | 197 const ManagedTileState::DrawingInfo& drawing_info = iter->drawing_info(); |
| 197 switch (drawing_info.mode()) { | 198 ManagedTileState::DrawingInfo::Mode mode = iter->drawing_info().mode(); |
| 199 if (append_quads_data->cannot_append_tile_draw_quads && | |
|
enne (OOO)
2013/04/28 22:42:27
I think you should not append one picture quad per
aelias_OOO_until_Jul13
2013/04/30 07:28:20
Agreed, although cut-and-pasting that snippet resu
| |
| 200 mode == ManagedTileState::DrawingInfo::RESOURCE_MODE) | |
| 201 mode = ManagedTileState::DrawingInfo::PICTURE_PILE_MODE; | |
| 202 switch (mode) { | |
| 198 case ManagedTileState::DrawingInfo::RESOURCE_MODE: { | 203 case ManagedTileState::DrawingInfo::RESOURCE_MODE: { |
| 199 gfx::RectF texture_rect = iter.texture_rect(); | 204 gfx::RectF texture_rect = iter.texture_rect(); |
| 200 gfx::Rect opaque_rect = iter->opaque_rect(); | 205 gfx::Rect opaque_rect = iter->opaque_rect(); |
| 201 opaque_rect.Intersect(content_rect); | 206 opaque_rect.Intersect(content_rect); |
| 202 | 207 |
| 203 if (iter->contents_scale() != ideal_contents_scale_) | 208 if (iter->contents_scale() != ideal_contents_scale_) |
| 204 append_quads_data->had_incomplete_tile = true; | 209 append_quads_data->had_incomplete_tile = true; |
| 205 | 210 |
| 206 scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create(); | 211 scoped_ptr<TileDrawQuad> quad = TileDrawQuad::Create(); |
| 207 quad->SetNew(shared_quad_state, | 212 quad->SetNew(shared_quad_state, |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 return 0; | 545 return 0; |
| 541 return iter->drawing_info().get_resource_id(); | 546 return iter->drawing_info().get_resource_id(); |
| 542 } | 547 } |
| 543 return 0; | 548 return 0; |
| 544 } | 549 } |
| 545 | 550 |
| 546 bool PictureLayerImpl::AreVisibleResourcesReady() const { | 551 bool PictureLayerImpl::AreVisibleResourcesReady() const { |
| 547 DCHECK(layer_tree_impl()->IsPendingTree()); | 552 DCHECK(layer_tree_impl()->IsPendingTree()); |
| 548 DCHECK(ideal_contents_scale_); | 553 DCHECK(ideal_contents_scale_); |
| 549 | 554 |
| 555 if (layer_tree_impl()->settings().tile_free_software_compositing) | |
|
enne (OOO)
2013/04/28 22:42:27
Settings are considered to be immutable. I'm not
aelias_OOO_until_Jul13
2013/04/30 07:28:20
I deleted this, it was a workaround for the issue
| |
| 556 return true; | |
| 557 | |
| 550 if (!tilings_->num_tilings()) | 558 if (!tilings_->num_tilings()) |
| 551 return true; | 559 return true; |
| 552 | 560 |
| 553 gfx::Rect rect(visible_content_rect()); | 561 gfx::Rect rect(visible_content_rect()); |
| 554 | 562 |
| 555 float min_acceptable_scale = | 563 float min_acceptable_scale = |
| 556 std::min(raster_contents_scale_, ideal_contents_scale_); | 564 std::min(raster_contents_scale_, ideal_contents_scale_); |
| 557 | 565 |
| 558 TreePriority tree_priority = | 566 TreePriority tree_priority = |
| 559 layer_tree_impl()->tile_manager()->GlobalState().tree_priority; | 567 layer_tree_impl()->tile_manager()->GlobalState().tree_priority; |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 916 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { | 924 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { |
| 917 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 925 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 918 LayerImpl::AsValueInto(state.get()); | 926 LayerImpl::AsValueInto(state.get()); |
| 919 | 927 |
| 920 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); | 928 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
| 921 state->Set("tilings", tilings_->AsValue().release()); | 929 state->Set("tilings", tilings_->AsValue().release()); |
| 922 return state.PassAs<base::Value>(); | 930 return state.PassAs<base::Value>(); |
| 923 } | 931 } |
| 924 | 932 |
| 925 } // namespace cc | 933 } // namespace cc |
| OLD | NEW |