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 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 needs_post_commit_initialization_ = true; | 132 needs_post_commit_initialization_ = true; |
133 | 133 |
134 // We always need to push properties. | 134 // We always need to push properties. |
135 // See http://crbug.com/303943 | 135 // See http://crbug.com/303943 |
136 needs_push_properties_ = true; | 136 needs_push_properties_ = true; |
137 } | 137 } |
138 | 138 |
139 void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, | 139 void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, |
140 AppendQuadsData* append_quads_data) { | 140 AppendQuadsData* append_quads_data) { |
141 DCHECK(!needs_post_commit_initialization_); | 141 DCHECK(!needs_post_commit_initialization_); |
142 gfx::Rect rect(visible_content_rect()); | 142 |
| 143 float max_contents_scale = MaximumTilingContentScale(); |
| 144 gfx::Transform scaled_draw_transform = draw_transform(); |
| 145 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale, |
| 146 SK_MScalar1 / max_contents_scale); |
| 147 gfx::Size scaled_content_bounds = |
| 148 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), max_contents_scale)); |
| 149 |
| 150 gfx::Rect scaled_visible_content_rect = |
| 151 gfx::ScaleToEnclosingRect(visible_content_rect(), max_contents_scale); |
| 152 scaled_visible_content_rect.Intersect(gfx::Rect(scaled_content_bounds)); |
143 | 153 |
144 SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); | 154 SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); |
145 PopulateSharedQuadState(shared_quad_state); | 155 shared_quad_state->SetAll(scaled_draw_transform, |
| 156 scaled_content_bounds, |
| 157 scaled_visible_content_rect, |
| 158 draw_properties().clip_rect, |
| 159 draw_properties().is_clipped, |
| 160 draw_properties().opacity, |
| 161 blend_mode()); |
| 162 |
| 163 gfx::Rect rect = scaled_visible_content_rect; |
146 | 164 |
147 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) { | 165 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) { |
148 AppendDebugBorderQuad( | 166 AppendDebugBorderQuad( |
149 quad_sink, | 167 quad_sink, |
150 shared_quad_state, | 168 shared_quad_state, |
151 append_quads_data, | 169 append_quads_data, |
152 DebugColors::DirectPictureBorderColor(), | 170 DebugColors::DirectPictureBorderColor(), |
153 DebugColors::DirectPictureBorderWidth(layer_tree_impl())); | 171 DebugColors::DirectPictureBorderWidth(layer_tree_impl())); |
154 | 172 |
155 gfx::Rect geometry_rect = rect; | 173 gfx::Rect geometry_rect = rect; |
156 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); | 174 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); |
157 gfx::Rect visible_geometry_rect = | 175 gfx::Rect visible_geometry_rect = |
158 quad_sink->UnoccludedContentRect(geometry_rect, draw_transform()); | 176 quad_sink->UnoccludedContentRect(geometry_rect, draw_transform()); |
159 if (visible_geometry_rect.IsEmpty()) | 177 if (visible_geometry_rect.IsEmpty()) |
160 return; | 178 return; |
161 | 179 |
162 gfx::Size texture_size = rect.size(); | 180 gfx::Size texture_size = rect.size(); |
163 gfx::RectF texture_rect = gfx::RectF(texture_size); | 181 gfx::RectF texture_rect = gfx::RectF(texture_size); |
164 gfx::Rect quad_content_rect = rect; | 182 gfx::Rect quad_content_rect = rect; |
165 float contents_scale = contents_scale_x(); | 183 float contents_scale = max_contents_scale; |
166 | 184 |
167 scoped_ptr<PictureDrawQuad> quad = PictureDrawQuad::Create(); | 185 scoped_ptr<PictureDrawQuad> quad = PictureDrawQuad::Create(); |
168 quad->SetNew(shared_quad_state, | 186 quad->SetNew(shared_quad_state, |
169 geometry_rect, | 187 geometry_rect, |
170 opaque_rect, | 188 opaque_rect, |
171 visible_geometry_rect, | 189 visible_geometry_rect, |
172 texture_rect, | 190 texture_rect, |
173 texture_size, | 191 texture_size, |
174 RGBA_8888, | 192 RGBA_8888, |
175 quad_content_rect, | 193 quad_content_rect, |
176 contents_scale, | 194 contents_scale, |
177 pile_); | 195 pile_); |
178 quad_sink->Append(quad.PassAs<DrawQuad>()); | 196 quad_sink->Append(quad.PassAs<DrawQuad>()); |
179 append_quads_data->num_missing_tiles++; | 197 append_quads_data->num_missing_tiles++; |
180 return; | 198 return; |
181 } | 199 } |
182 | 200 |
183 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); | 201 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); |
184 | 202 |
185 if (ShowDebugBorders()) { | 203 if (ShowDebugBorders()) { |
186 for (PictureLayerTilingSet::CoverageIterator iter( | 204 for (PictureLayerTilingSet::CoverageIterator iter( |
187 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_); | 205 tilings_.get(), max_contents_scale, rect, ideal_contents_scale_); |
188 iter; | 206 iter; |
189 ++iter) { | 207 ++iter) { |
190 SkColor color; | 208 SkColor color; |
191 float width; | 209 float width; |
192 if (*iter && iter->IsReadyToDraw()) { | 210 if (*iter && iter->IsReadyToDraw()) { |
193 ManagedTileState::TileVersion::Mode mode = | 211 ManagedTileState::TileVersion::Mode mode = |
194 iter->GetTileVersionForDrawing().mode(); | 212 iter->GetTileVersionForDrawing().mode(); |
195 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { | 213 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { |
196 color = DebugColors::SolidColorTileBorderColor(); | 214 color = DebugColors::SolidColorTileBorderColor(); |
197 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); | 215 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); |
198 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { | 216 } else if (mode == ManagedTileState::TileVersion::PICTURE_PILE_MODE) { |
199 color = DebugColors::PictureTileBorderColor(); | 217 color = DebugColors::PictureTileBorderColor(); |
200 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); | 218 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); |
201 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { | 219 } else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { |
202 color = DebugColors::HighResTileBorderColor(); | 220 color = DebugColors::HighResTileBorderColor(); |
203 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); | 221 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); |
204 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { | 222 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { |
205 color = DebugColors::LowResTileBorderColor(); | 223 color = DebugColors::LowResTileBorderColor(); |
206 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); | 224 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); |
207 } else if (iter->contents_scale() > contents_scale_x()) { | 225 } else if (iter->contents_scale() > max_contents_scale) { |
208 color = DebugColors::ExtraHighResTileBorderColor(); | 226 color = DebugColors::ExtraHighResTileBorderColor(); |
209 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); | 227 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); |
210 } else { | 228 } else { |
211 color = DebugColors::ExtraLowResTileBorderColor(); | 229 color = DebugColors::ExtraLowResTileBorderColor(); |
212 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); | 230 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); |
213 } | 231 } |
214 } else { | 232 } else { |
215 color = DebugColors::MissingTileBorderColor(); | 233 color = DebugColors::MissingTileBorderColor(); |
216 width = DebugColors::MissingTileBorderWidth(layer_tree_impl()); | 234 width = DebugColors::MissingTileBorderWidth(layer_tree_impl()); |
217 } | 235 } |
(...skipping 11 matching lines...) Expand all Loading... |
229 } | 247 } |
230 } | 248 } |
231 | 249 |
232 // Keep track of the tilings that were used so that tilings that are | 250 // Keep track of the tilings that were used so that tilings that are |
233 // unused can be considered for removal. | 251 // unused can be considered for removal. |
234 std::vector<PictureLayerTiling*> seen_tilings; | 252 std::vector<PictureLayerTiling*> seen_tilings; |
235 | 253 |
236 size_t missing_tile_count = 0u; | 254 size_t missing_tile_count = 0u; |
237 size_t on_demand_missing_tile_count = 0u; | 255 size_t on_demand_missing_tile_count = 0u; |
238 for (PictureLayerTilingSet::CoverageIterator iter( | 256 for (PictureLayerTilingSet::CoverageIterator iter( |
239 tilings_.get(), contents_scale_x(), rect, ideal_contents_scale_); | 257 tilings_.get(), max_contents_scale, rect, ideal_contents_scale_); |
240 iter; | 258 iter; |
241 ++iter) { | 259 ++iter) { |
242 gfx::Rect geometry_rect = iter.geometry_rect(); | 260 gfx::Rect geometry_rect = iter.geometry_rect(); |
243 gfx::Rect visible_geometry_rect = | 261 gfx::Rect visible_geometry_rect = |
244 quad_sink->UnoccludedContentRect(geometry_rect, draw_transform()); | 262 quad_sink->UnoccludedContentRect(geometry_rect, draw_transform()); |
245 if (visible_geometry_rect.IsEmpty()) | 263 if (visible_geometry_rect.IsEmpty()) |
246 continue; | 264 continue; |
247 | 265 |
248 append_quads_data->visible_content_area += | 266 append_quads_data->visible_content_area += |
249 visible_geometry_rect.width() * visible_geometry_rect.height(); | 267 visible_geometry_rect.width() * visible_geometry_rect.height(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 390 |
373 void PictureLayerImpl::DidUnregisterLayer() { | 391 void PictureLayerImpl::DidUnregisterLayer() { |
374 TRACE_EVENT0("cc", "PictureLayerImpl::DidUnregisterLayer"); | 392 TRACE_EVENT0("cc", "PictureLayerImpl::DidUnregisterLayer"); |
375 | 393 |
376 layer_needs_to_register_itself_ = true; | 394 layer_needs_to_register_itself_ = true; |
377 } | 395 } |
378 | 396 |
379 void PictureLayerImpl::UpdateTilePriorities() { | 397 void PictureLayerImpl::UpdateTilePriorities() { |
380 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); | 398 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); |
381 | 399 |
382 DCHECK(!needs_post_commit_initialization_); | 400 DoPostCommitInitializationIfNeeded(); |
383 CHECK(should_update_tile_priorities_); | 401 UpdateIdealScales(); |
| 402 // TODO(sohanjg): Avoid needlessly update priorities when syncing to a |
| 403 // non-updated tree which will then be updated immediately afterwards. |
| 404 should_update_tile_priorities_ = true; |
| 405 if (CanHaveTilings()) { |
| 406 ManageTilings(draw_properties().screen_space_transform_is_animating, |
| 407 draw_properties().maximum_animation_contents_scale); |
| 408 } |
384 | 409 |
385 if (layer_needs_to_register_itself_) { | 410 if (layer_needs_to_register_itself_) { |
386 layer_tree_impl()->tile_manager()->RegisterPictureLayerImpl(this); | 411 layer_tree_impl()->tile_manager()->RegisterPictureLayerImpl(this); |
387 layer_needs_to_register_itself_ = false; | 412 layer_needs_to_register_itself_ = false; |
388 } | 413 } |
389 | 414 |
390 if (layer_tree_impl()->device_viewport_valid_for_tile_management()) { | 415 if (layer_tree_impl()->device_viewport_valid_for_tile_management()) { |
391 visible_rect_for_tile_priority_ = visible_content_rect(); | 416 visible_rect_for_tile_priority_ = visible_content_rect(); |
392 viewport_size_for_tile_priority_ = layer_tree_impl()->DrawViewportSize(); | 417 viewport_size_for_tile_priority_ = layer_tree_impl()->DrawViewportSize(); |
393 screen_space_transform_for_tile_priority_ = screen_space_transform(); | 418 screen_space_transform_for_tile_priority_ = screen_space_transform(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 RemoveAllTilings(); | 490 RemoveAllTilings(); |
466 | 491 |
467 ResetRasterScale(); | 492 ResetRasterScale(); |
468 | 493 |
469 // To avoid an edge case after lost context where the tree is up to date but | 494 // To avoid an edge case after lost context where the tree is up to date but |
470 // the tilings have not been managed, request an update draw properties | 495 // the tilings have not been managed, request an update draw properties |
471 // to force tilings to get managed. | 496 // to force tilings to get managed. |
472 layer_tree_impl()->set_needs_update_draw_properties(); | 497 layer_tree_impl()->set_needs_update_draw_properties(); |
473 } | 498 } |
474 | 499 |
475 void PictureLayerImpl::CalculateContentsScale( | |
476 float ideal_contents_scale, | |
477 float device_scale_factor, | |
478 float page_scale_factor, | |
479 float maximum_animation_contents_scale, | |
480 bool animating_transform_to_screen, | |
481 float* contents_scale_x, | |
482 float* contents_scale_y, | |
483 gfx::Size* content_bounds) { | |
484 DoPostCommitInitializationIfNeeded(); | |
485 | |
486 // This function sets valid raster scales and manages tilings, so tile | |
487 // priorities can now be updated. | |
488 should_update_tile_priorities_ = true; | |
489 | |
490 if (!CanHaveTilings()) { | |
491 ideal_page_scale_ = page_scale_factor; | |
492 ideal_device_scale_ = device_scale_factor; | |
493 ideal_contents_scale_ = ideal_contents_scale; | |
494 ideal_source_scale_ = | |
495 ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; | |
496 *contents_scale_x = ideal_contents_scale_; | |
497 *contents_scale_y = ideal_contents_scale_; | |
498 *content_bounds = gfx::ToCeiledSize(gfx::ScaleSize(bounds(), | |
499 ideal_contents_scale_, | |
500 ideal_contents_scale_)); | |
501 return; | |
502 } | |
503 | |
504 float min_contents_scale = MinimumContentsScale(); | |
505 DCHECK_GT(min_contents_scale, 0.f); | |
506 float min_page_scale = layer_tree_impl()->min_page_scale_factor(); | |
507 DCHECK_GT(min_page_scale, 0.f); | |
508 float min_device_scale = 1.f; | |
509 float min_source_scale = | |
510 min_contents_scale / min_page_scale / min_device_scale; | |
511 | |
512 float ideal_page_scale = page_scale_factor; | |
513 float ideal_device_scale = device_scale_factor; | |
514 float ideal_source_scale = | |
515 ideal_contents_scale / ideal_page_scale / ideal_device_scale; | |
516 | |
517 ideal_contents_scale_ = std::max(ideal_contents_scale, min_contents_scale); | |
518 ideal_page_scale_ = ideal_page_scale; | |
519 ideal_device_scale_ = ideal_device_scale; | |
520 ideal_source_scale_ = std::max(ideal_source_scale, min_source_scale); | |
521 | |
522 ManageTilings(animating_transform_to_screen, | |
523 maximum_animation_contents_scale); | |
524 | |
525 // The content scale and bounds for a PictureLayerImpl is somewhat fictitious. | |
526 // There are (usually) several tilings at different scales. However, the | |
527 // content bounds is the (integer!) space in which quads are generated. | |
528 // In order to guarantee that we can fill this integer space with any set of | |
529 // tilings (and then map back to floating point texture coordinates), the | |
530 // contents scale must be at least as large as the largest of the tilings. | |
531 float max_contents_scale = min_contents_scale; | |
532 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | |
533 const PictureLayerTiling* tiling = tilings_->tiling_at(i); | |
534 max_contents_scale = std::max(max_contents_scale, tiling->contents_scale()); | |
535 } | |
536 | |
537 *contents_scale_x = max_contents_scale; | |
538 *contents_scale_y = max_contents_scale; | |
539 *content_bounds = gfx::ToCeiledSize( | |
540 gfx::ScaleSize(bounds(), max_contents_scale, max_contents_scale)); | |
541 } | |
542 | |
543 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { | 500 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { |
544 return pile_->GetFlattenedPicture(); | 501 return pile_->GetFlattenedPicture(); |
545 } | 502 } |
546 | 503 |
547 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, | 504 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, |
548 const gfx::Rect& content_rect) { | 505 const gfx::Rect& content_rect) { |
549 if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) | 506 if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) |
550 return scoped_refptr<Tile>(); | 507 return scoped_refptr<Tile>(); |
551 | 508 |
552 int flags = 0; | 509 int flags = 0; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 void PictureLayerImpl::SetIsMask(bool is_mask) { | 701 void PictureLayerImpl::SetIsMask(bool is_mask) { |
745 if (is_mask_ == is_mask) | 702 if (is_mask_ == is_mask) |
746 return; | 703 return; |
747 is_mask_ = is_mask; | 704 is_mask_ = is_mask; |
748 if (tilings_) | 705 if (tilings_) |
749 tilings_->RemoveAllTiles(); | 706 tilings_->RemoveAllTiles(); |
750 } | 707 } |
751 | 708 |
752 ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const { | 709 ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const { |
753 gfx::Rect content_rect(content_bounds()); | 710 gfx::Rect content_rect(content_bounds()); |
754 float scale = contents_scale_x(); | 711 float scale = MaximumTilingContentScale(); |
755 PictureLayerTilingSet::CoverageIterator iter( | 712 PictureLayerTilingSet::CoverageIterator iter( |
756 tilings_.get(), scale, content_rect, ideal_contents_scale_); | 713 tilings_.get(), scale, content_rect, ideal_contents_scale_); |
757 | 714 |
758 // Mask resource not ready yet. | 715 // Mask resource not ready yet. |
759 if (!iter || !*iter) | 716 if (!iter || !*iter) |
760 return 0; | 717 return 0; |
761 | 718 |
762 // Masks only supported if they fit on exactly one tile. | 719 // Masks only supported if they fit on exactly one tile. |
763 if (iter.geometry_rect() != content_rect) | 720 if (iter.geometry_rect() != content_rect) |
764 return 0; | 721 return 0; |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 } | 1265 } |
1309 if (tilings_->num_tilings() == 0) | 1266 if (tilings_->num_tilings() == 0) |
1310 return; | 1267 return; |
1311 | 1268 |
1312 // MarkVisibleResourcesAsRequired depends on having exactly 1 high res | 1269 // MarkVisibleResourcesAsRequired depends on having exactly 1 high res |
1313 // tiling to mark its tiles as being required for activation. | 1270 // tiling to mark its tiles as being required for activation. |
1314 DCHECK_EQ(1, tilings_->NumHighResTilings()); | 1271 DCHECK_EQ(1, tilings_->NumHighResTilings()); |
1315 #endif | 1272 #endif |
1316 } | 1273 } |
1317 | 1274 |
| 1275 float PictureLayerImpl::MaximumTilingContentScale() const { |
| 1276 float max_contents_scale = MinimumContentsScale(); |
| 1277 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 1278 const PictureLayerTiling* tiling = tilings_->tiling_at(i); |
| 1279 max_contents_scale = std::max(max_contents_scale, tiling->contents_scale()); |
| 1280 } |
| 1281 return max_contents_scale; |
| 1282 } |
| 1283 |
| 1284 void PictureLayerImpl::UpdateIdealScales() { |
| 1285 if (!CanHaveTilings()) { |
| 1286 ideal_page_scale_ = draw_properties().page_scale_factor; |
| 1287 ideal_device_scale_ = draw_properties().device_scale_factor; |
| 1288 ideal_contents_scale_ = draw_properties().ideal_contents_scale; |
| 1289 ideal_source_scale_ = |
| 1290 ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; |
| 1291 return; |
| 1292 } |
| 1293 |
| 1294 float min_contents_scale = MinimumContentsScale(); |
| 1295 DCHECK_GT(min_contents_scale, 0.f); |
| 1296 float min_page_scale = layer_tree_impl()->min_page_scale_factor(); |
| 1297 DCHECK_GT(min_page_scale, 0.f); |
| 1298 float min_device_scale = 1.f; |
| 1299 float min_source_scale = |
| 1300 min_contents_scale / min_page_scale / min_device_scale; |
| 1301 |
| 1302 float ideal_page_scale = draw_properties().page_scale_factor; |
| 1303 float ideal_device_scale = draw_properties().device_scale_factor; |
| 1304 float ideal_source_scale = draw_properties().ideal_contents_scale / |
| 1305 ideal_page_scale / ideal_device_scale; |
| 1306 ideal_contents_scale_ = |
| 1307 std::max(draw_properties().ideal_contents_scale, min_contents_scale); |
| 1308 ideal_page_scale_ = draw_properties().page_scale_factor; |
| 1309 ideal_device_scale_ = draw_properties().device_scale_factor; |
| 1310 ideal_source_scale_ = std::max(ideal_source_scale, min_source_scale); |
| 1311 } |
| 1312 |
1318 void PictureLayerImpl::GetDebugBorderProperties( | 1313 void PictureLayerImpl::GetDebugBorderProperties( |
1319 SkColor* color, | 1314 SkColor* color, |
1320 float* width) const { | 1315 float* width) const { |
1321 *color = DebugColors::TiledContentLayerBorderColor(); | 1316 *color = DebugColors::TiledContentLayerBorderColor(); |
1322 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); | 1317 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); |
1323 } | 1318 } |
1324 | 1319 |
1325 void PictureLayerImpl::AsValueInto(base::DictionaryValue* state) const { | 1320 void PictureLayerImpl::AsValueInto(base::DictionaryValue* state) const { |
1326 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); | 1321 const_cast<PictureLayerImpl*>(this)->DoPostCommitInitializationIfNeeded(); |
1327 LayerImpl::AsValueInto(state); | 1322 LayerImpl::AsValueInto(state); |
1328 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); | 1323 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); |
1329 state->SetDouble("geometry_contents_scale", contents_scale_x()); | 1324 state->SetDouble("geometry_contents_scale", MaximumTilingContentScale()); |
1330 state->Set("tilings", tilings_->AsValue().release()); | 1325 state->Set("tilings", tilings_->AsValue().release()); |
1331 state->Set("pictures", pile_->AsValue().release()); | 1326 state->Set("pictures", pile_->AsValue().release()); |
1332 state->Set("invalidation", invalidation_.AsValue().release()); | 1327 state->Set("invalidation", invalidation_.AsValue().release()); |
1333 | 1328 |
1334 scoped_ptr<base::ListValue> coverage_tiles(new base::ListValue); | 1329 scoped_ptr<base::ListValue> coverage_tiles(new base::ListValue); |
1335 for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(), | 1330 for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(), |
1336 contents_scale_x(), | 1331 contents_scale_x(), |
1337 gfx::Rect(content_bounds()), | 1332 gfx::Rect(content_bounds()), |
1338 ideal_contents_scale_); | 1333 ideal_contents_scale_); |
1339 iter; | 1334 iter; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 return iterator_index_ < iterators_.size(); | 1609 return iterator_index_ < iterators_.size(); |
1615 } | 1610 } |
1616 | 1611 |
1617 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1612 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
1618 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1613 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
1619 return it->get_type() == iteration_stage_ && | 1614 return it->get_type() == iteration_stage_ && |
1620 (**it)->required_for_activation() == required_for_activation_; | 1615 (**it)->required_for_activation() == required_for_activation_; |
1621 } | 1616 } |
1622 | 1617 |
1623 } // namespace cc | 1618 } // namespace cc |
OLD | NEW |