| 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 <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 case TileDrawInfo::OOM_MODE: | 324 case TileDrawInfo::OOM_MODE: |
| 325 break; // Checkerboard. | 325 break; // Checkerboard. |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 | 328 |
| 329 if (!has_draw_quad) { | 329 if (!has_draw_quad) { |
| 330 if (draw_checkerboard_for_missing_tiles()) { | 330 if (draw_checkerboard_for_missing_tiles()) { |
| 331 CheckerboardDrawQuad* quad = | 331 CheckerboardDrawQuad* quad = |
| 332 render_pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>(); | 332 render_pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>(); |
| 333 SkColor color = DebugColors::DefaultCheckerboardColor(); | 333 SkColor color = DebugColors::DefaultCheckerboardColor(); |
| 334 quad->SetNew( | 334 quad->SetNew(shared_quad_state, geometry_rect, visible_geometry_rect, |
| 335 shared_quad_state, geometry_rect, visible_geometry_rect, color); | 335 color, draw_properties().device_scale_factor); |
| 336 } else { | 336 } else { |
| 337 SkColor color = SafeOpaqueBackgroundColor(); | 337 SkColor color = SafeOpaqueBackgroundColor(); |
| 338 SolidColorDrawQuad* quad = | 338 SolidColorDrawQuad* quad = |
| 339 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 339 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 340 quad->SetNew(shared_quad_state, | 340 quad->SetNew(shared_quad_state, |
| 341 geometry_rect, | 341 geometry_rect, |
| 342 visible_geometry_rect, | 342 visible_geometry_rect, |
| 343 color, | 343 color, |
| 344 false); | 344 false); |
| 345 } | 345 } |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 // To avoid an edge case after lost context where the tree is up to date but | 598 // To avoid an edge case after lost context where the tree is up to date but |
| 599 // the tilings have not been managed, request an update draw properties | 599 // the tilings have not been managed, request an update draw properties |
| 600 // to force tilings to get managed. | 600 // to force tilings to get managed. |
| 601 layer_tree_impl()->set_needs_update_draw_properties(); | 601 layer_tree_impl()->set_needs_update_draw_properties(); |
| 602 } | 602 } |
| 603 | 603 |
| 604 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { | 604 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { |
| 605 return raster_source_->GetFlattenedPicture(); | 605 return raster_source_->GetFlattenedPicture(); |
| 606 } | 606 } |
| 607 | 607 |
| 608 Region PictureLayerImpl::GetInvalidationRegion() { |
| 609 // |invalidation_| gives the invalidation contained in the source frame, but |
| 610 // is not cleared after drawing from the layer. However, update_rect() is |
| 611 // cleared once the invalidation is drawn, which is useful for debugging |
| 612 // visualizations. This method intersects the two to give a more exact |
| 613 // representation of what was invalidated that is cleared after drawing. |
| 614 return IntersectRegions(invalidation_, update_rect()); |
| 615 } |
| 616 |
| 608 scoped_refptr<Tile> PictureLayerImpl::CreateTile( | 617 scoped_refptr<Tile> PictureLayerImpl::CreateTile( |
| 609 float contents_scale, | 618 float contents_scale, |
| 610 const gfx::Rect& content_rect) { | 619 const gfx::Rect& content_rect) { |
| 611 int flags = 0; | 620 int flags = 0; |
| 612 | 621 |
| 613 // We don't handle solid color masks, so we shouldn't bother analyzing those. | 622 // We don't handle solid color masks, so we shouldn't bother analyzing those. |
| 614 // Otherwise, always analyze to maximize memory savings. | 623 // Otherwise, always analyze to maximize memory savings. |
| 615 if (!is_mask_) | 624 if (!is_mask_) |
| 616 flags = Tile::USE_PICTURE_ANALYSIS; | 625 flags = Tile::USE_PICTURE_ANALYSIS; |
| 617 | 626 |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 | 1228 |
| 1220 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1229 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1221 return !layer_tree_impl()->IsRecycleTree(); | 1230 return !layer_tree_impl()->IsRecycleTree(); |
| 1222 } | 1231 } |
| 1223 | 1232 |
| 1224 bool PictureLayerImpl::HasValidTilePriorities() const { | 1233 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1225 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1234 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
| 1226 } | 1235 } |
| 1227 | 1236 |
| 1228 } // namespace cc | 1237 } // namespace cc |
| OLD | NEW |