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 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 575 |
576 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { | 576 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { |
577 return pile_->GetFlattenedPicture(); | 577 return pile_->GetFlattenedPicture(); |
578 } | 578 } |
579 | 579 |
580 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, | 580 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, |
581 const gfx::Rect& content_rect) { | 581 const gfx::Rect& content_rect) { |
582 if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) | 582 if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) |
583 return scoped_refptr<Tile>(); | 583 return scoped_refptr<Tile>(); |
584 | 584 |
| 585 int flags = 0; |
| 586 |
585 // TODO(vmpstr): Revisit this. For now, enabling analysis means that we get as | 587 // TODO(vmpstr): Revisit this. For now, enabling analysis means that we get as |
586 // much savings on memory as we can. However, for some cases like ganesh or | 588 // much savings on memory as we can. However, for some cases like ganesh or |
587 // small layers, the amount of time we spend analyzing might not justify | 589 // small layers, the amount of time we spend analyzing might not justify |
588 // memory savings that we can get. | 590 // memory savings that we can get. Note that we don't handle solid color |
| 591 // masks, so we shouldn't bother analyzing those. |
589 // Bugs: crbug.com/397198, crbug.com/396908 | 592 // Bugs: crbug.com/397198, crbug.com/396908 |
590 int flags = Tile::USE_PICTURE_ANALYSIS; | 593 if (!is_mask_) |
| 594 flags = Tile::USE_PICTURE_ANALYSIS; |
591 | 595 |
592 return layer_tree_impl()->tile_manager()->CreateTile( | 596 return layer_tree_impl()->tile_manager()->CreateTile( |
593 pile_.get(), | 597 pile_.get(), |
594 content_rect.size(), | 598 content_rect.size(), |
595 content_rect, | 599 content_rect, |
596 contents_opaque() ? content_rect : gfx::Rect(), | 600 contents_opaque() ? content_rect : gfx::Rect(), |
597 tiling->contents_scale(), | 601 tiling->contents_scale(), |
598 id(), | 602 id(), |
599 layer_tree_impl()->source_frame_number(), | 603 layer_tree_impl()->source_frame_number(), |
600 flags); | 604 flags); |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); | 1773 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); |
1770 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; | 1774 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; |
1771 return tiling_range.end - 1 - current_tiling_range_offset; | 1775 return tiling_range.end - 1 - current_tiling_range_offset; |
1772 } | 1776 } |
1773 } | 1777 } |
1774 NOTREACHED(); | 1778 NOTREACHED(); |
1775 return 0; | 1779 return 0; |
1776 } | 1780 } |
1777 | 1781 |
1778 } // namespace cc | 1782 } // namespace cc |
OLD | NEW |