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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 width = DebugColors::OOMTileBorderWidth(layer_tree_impl()); | 266 width = DebugColors::OOMTileBorderWidth(layer_tree_impl()); |
267 } else if (iter->draw_info().has_compressed_resource()) { | 267 } else if (iter->draw_info().has_compressed_resource()) { |
268 color = DebugColors::CompressedTileBorderColor(); | 268 color = DebugColors::CompressedTileBorderColor(); |
269 width = DebugColors::CompressedTileBorderWidth(layer_tree_impl()); | 269 width = DebugColors::CompressedTileBorderWidth(layer_tree_impl()); |
270 } else if (iter.resolution() == HIGH_RESOLUTION) { | 270 } else if (iter.resolution() == HIGH_RESOLUTION) { |
271 color = DebugColors::HighResTileBorderColor(); | 271 color = DebugColors::HighResTileBorderColor(); |
272 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); | 272 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); |
273 } else if (iter.resolution() == LOW_RESOLUTION) { | 273 } else if (iter.resolution() == LOW_RESOLUTION) { |
274 color = DebugColors::LowResTileBorderColor(); | 274 color = DebugColors::LowResTileBorderColor(); |
275 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); | 275 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); |
276 } else if (iter->contents_scale_key() > max_contents_scale) { | 276 } else if (iter->contents_scale() > max_contents_scale) { |
277 color = DebugColors::ExtraHighResTileBorderColor(); | 277 color = DebugColors::ExtraHighResTileBorderColor(); |
278 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); | 278 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); |
279 } else { | 279 } else { |
280 color = DebugColors::ExtraLowResTileBorderColor(); | 280 color = DebugColors::ExtraLowResTileBorderColor(); |
281 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); | 281 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); |
282 } | 282 } |
283 } else { | 283 } else { |
284 color = DebugColors::MissingTileBorderColor(); | 284 color = DebugColors::MissingTileBorderColor(); |
285 width = DebugColors::MissingTileBorderWidth(layer_tree_impl()); | 285 width = DebugColors::MissingTileBorderWidth(layer_tree_impl()); |
286 } | 286 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 switch (draw_info.mode()) { | 334 switch (draw_info.mode()) { |
335 case TileDrawInfo::RESOURCE_MODE: { | 335 case TileDrawInfo::RESOURCE_MODE: { |
336 gfx::RectF texture_rect = iter.texture_rect(); | 336 gfx::RectF texture_rect = iter.texture_rect(); |
337 | 337 |
338 // The raster_contents_scale_ is the best scale that the layer is | 338 // The raster_contents_scale_ is the best scale that the layer is |
339 // trying to produce, even though it may not be ideal. Since that's | 339 // trying to produce, even though it may not be ideal. Since that's |
340 // the best the layer can promise in the future, consider those as | 340 // the best the layer can promise in the future, consider those as |
341 // complete. But if a tile is ideal scale, we don't want to consider | 341 // complete. But if a tile is ideal scale, we don't want to consider |
342 // it incomplete and trying to replace it with a tile at a worse | 342 // it incomplete and trying to replace it with a tile at a worse |
343 // scale. | 343 // scale. |
344 if (iter->contents_scale_key() != raster_contents_scale_ && | 344 if (iter->contents_scale() != raster_contents_scale_ && |
345 iter->contents_scale_key() != ideal_contents_scale_ && | 345 iter->contents_scale() != ideal_contents_scale_ && |
346 geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { | 346 geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { |
347 append_quads_data->num_incomplete_tiles++; | 347 append_quads_data->num_incomplete_tiles++; |
348 } | 348 } |
349 | 349 |
350 TileDrawQuad* quad = | 350 TileDrawQuad* quad = |
351 render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); | 351 render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); |
352 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, | 352 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, |
353 visible_geometry_rect, draw_info.resource_id(), | 353 visible_geometry_rect, draw_info.resource_id(), |
354 texture_rect, draw_info.resource_size(), | 354 texture_rect, draw_info.resource_size(), |
355 draw_info.contents_swizzled(), nearest_neighbor_); | 355 draw_info.contents_swizzled(), nearest_neighbor_); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 } | 639 } |
640 | 640 |
641 bool PictureLayerImpl::RasterSourceUsesLCDText() const { | 641 bool PictureLayerImpl::RasterSourceUsesLCDText() const { |
642 return raster_source_ ? raster_source_->CanUseLCDText() | 642 return raster_source_ ? raster_source_->CanUseLCDText() |
643 : layer_tree_impl()->settings().can_use_lcd_text; | 643 : layer_tree_impl()->settings().can_use_lcd_text; |
644 } | 644 } |
645 | 645 |
646 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { | 646 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { |
647 if (layer_tree_impl()->IsActiveTree()) { | 647 if (layer_tree_impl()->IsActiveTree()) { |
648 gfx::Rect layer_damage_rect = gfx::ScaleToEnclosingRect( | 648 gfx::Rect layer_damage_rect = gfx::ScaleToEnclosingRect( |
649 tile->content_rect(), 1.f / tile->raster_scales().width(), | 649 tile->content_rect(), 1.f / tile->contents_scale()); |
650 1.f / tile->raster_scales().height()); | |
651 AddDamageRect(layer_damage_rect); | 650 AddDamageRect(layer_damage_rect); |
652 } | 651 } |
653 if (tile->draw_info().NeedsRaster()) { | 652 if (tile->draw_info().NeedsRaster()) { |
654 PictureLayerTiling* tiling = | 653 PictureLayerTiling* tiling = |
655 tilings_->FindTilingWithScaleKey(tile->contents_scale_key()); | 654 tilings_->FindTilingWithScaleKey(tile->contents_scale()); |
656 if (tiling) | 655 if (tiling) |
657 tiling->set_all_tiles_done(false); | 656 tiling->set_all_tiles_done(false); |
658 } | 657 } |
659 } | 658 } |
660 | 659 |
661 void PictureLayerImpl::DidBeginTracing() { | 660 void PictureLayerImpl::DidBeginTracing() { |
662 raster_source_->DidBeginTracing(); | 661 raster_source_->DidBeginTracing(); |
663 } | 662 } |
664 | 663 |
665 void PictureLayerImpl::ReleaseResources() { | 664 void PictureLayerImpl::ReleaseResources() { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 if (PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer()) | 715 if (PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer()) |
717 return &twin_layer->invalidation_; | 716 return &twin_layer->invalidation_; |
718 return nullptr; | 717 return nullptr; |
719 } | 718 } |
720 | 719 |
721 const PictureLayerTiling* PictureLayerImpl::GetPendingOrActiveTwinTiling( | 720 const PictureLayerTiling* PictureLayerImpl::GetPendingOrActiveTwinTiling( |
722 const PictureLayerTiling* tiling) const { | 721 const PictureLayerTiling* tiling) const { |
723 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer(); | 722 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer(); |
724 if (!twin_layer) | 723 if (!twin_layer) |
725 return nullptr; | 724 return nullptr; |
726 return twin_layer->tilings_->FindTilingWithScaleKey( | 725 return twin_layer->tilings_->FindTilingWithScaleKey(tiling->contents_scale()); |
727 tiling->contents_scale_key()); | |
728 } | 726 } |
729 | 727 |
730 bool PictureLayerImpl::RequiresHighResToDraw() const { | 728 bool PictureLayerImpl::RequiresHighResToDraw() const { |
731 return layer_tree_impl()->RequiresHighResToDraw(); | 729 return layer_tree_impl()->RequiresHighResToDraw(); |
732 } | 730 } |
733 | 731 |
734 gfx::Rect PictureLayerImpl::GetEnclosingRectInTargetSpace() const { | 732 gfx::Rect PictureLayerImpl::GetEnclosingRectInTargetSpace() const { |
735 return GetScaledEnclosingRectInTargetSpace(MaximumTilingContentsScale()); | 733 return GetScaledEnclosingRectInTargetSpace(MaximumTilingContentsScale()); |
736 } | 734 } |
737 | 735 |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1365 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1368 return !layer_tree_impl()->IsRecycleTree(); | 1366 return !layer_tree_impl()->IsRecycleTree(); |
1369 } | 1367 } |
1370 | 1368 |
1371 bool PictureLayerImpl::HasValidTilePriorities() const { | 1369 bool PictureLayerImpl::HasValidTilePriorities() const { |
1372 return IsOnActiveOrPendingTree() && | 1370 return IsOnActiveOrPendingTree() && |
1373 is_drawn_render_surface_layer_list_member(); | 1371 is_drawn_render_surface_layer_list_member(); |
1374 } | 1372 } |
1375 | 1373 |
1376 } // namespace cc | 1374 } // namespace cc |
OLD | NEW |