| 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/resources/picture_pile.h" | 5 #include "cc/resources/picture_pile.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 | 686 |
| 687 // Don't bother doing more work if the first image is too complicated. | 687 // Don't bother doing more work if the first image is too complicated. |
| 688 if (picture->ApproximateOpCount() > kOpCountThatIsOkToAnalyze) | 688 if (picture->ApproximateOpCount() > kOpCountThatIsOkToAnalyze) |
| 689 return; | 689 return; |
| 690 | 690 |
| 691 // Make sure all of the mapped images point to the same picture. | 691 // Make sure all of the mapped images point to the same picture. |
| 692 for (++it; it != picture_map_.end(); ++it) { | 692 for (++it; it != picture_map_.end(); ++it) { |
| 693 if (it->second.GetPicture() != picture) | 693 if (it->second.GetPicture() != picture) |
| 694 return; | 694 return; |
| 695 } | 695 } |
| 696 skia::AnalysisCanvas canvas(recorded_viewport_.width(), | 696 |
| 697 recorded_viewport_.height()); | 697 gfx::Size layer_size = GetSize(); |
| 698 canvas.translate(-recorded_viewport_.x(), -recorded_viewport_.y()); | 698 skia::AnalysisCanvas canvas(layer_size.width(), layer_size.height()); |
| 699 |
| 699 picture->Raster(&canvas, nullptr, Region(), 1.0f); | 700 picture->Raster(&canvas, nullptr, Region(), 1.0f); |
| 700 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); | 701 is_solid_color_ = canvas.GetColorIfSolid(&solid_color_); |
| 701 } | 702 } |
| 702 | 703 |
| 703 gfx::Rect PicturePile::PaddedRect(const PictureMapKey& key) const { | 704 gfx::Rect PicturePile::PaddedRect(const PictureMapKey& key) const { |
| 704 gfx::Rect tile = tiling_.TileBounds(key.first, key.second); | 705 gfx::Rect tile = tiling_.TileBounds(key.first, key.second); |
| 705 return PadRect(tile); | 706 return PadRect(tile); |
| 706 } | 707 } |
| 707 | 708 |
| 708 gfx::Rect PicturePile::PadRect(const gfx::Rect& rect) const { | 709 gfx::Rect PicturePile::PadRect(const gfx::Rect& rect) const { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 const Picture* PicturePile::PictureInfo::GetPicture() const { | 772 const Picture* PicturePile::PictureInfo::GetPicture() const { |
| 772 return picture_.get(); | 773 return picture_.get(); |
| 773 } | 774 } |
| 774 | 775 |
| 775 float PicturePile::PictureInfo::GetInvalidationFrequency() const { | 776 float PicturePile::PictureInfo::GetInvalidationFrequency() const { |
| 776 return invalidation_history_.count() / | 777 return invalidation_history_.count() / |
| 777 static_cast<float>(INVALIDATION_FRAMES_TRACKED); | 778 static_cast<float>(INVALIDATION_FRAMES_TRACKED); |
| 778 } | 779 } |
| 779 | 780 |
| 780 } // namespace cc | 781 } // namespace cc |
| OLD | NEW |