OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_base.h" | 5 #include "cc/resources/picture_pile_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 bool PicturePileBase::HasRecordingAt(int x, int y) { | 137 bool PicturePileBase::HasRecordingAt(int x, int y) { |
138 PictureMap::const_iterator found = picture_map_.find(PictureMapKey(x, y)); | 138 PictureMap::const_iterator found = picture_map_.find(PictureMapKey(x, y)); |
139 if (found == picture_map_.end()) | 139 if (found == picture_map_.end()) |
140 return false; | 140 return false; |
141 return !!found->second.GetPicture(); | 141 return !!found->second.GetPicture(); |
142 } | 142 } |
143 | 143 |
144 bool PicturePileBase::CanRaster(float contents_scale, | 144 bool PicturePileBase::CanRaster(float contents_scale, |
145 const gfx::Rect& content_rect) { | 145 const gfx::Rect& content_rect) const { |
146 if (tiling_.tiling_size().IsEmpty()) | 146 if (tiling_.tiling_size().IsEmpty()) |
147 return false; | 147 return false; |
148 gfx::Rect layer_rect = gfx::ScaleToEnclosingRect( | 148 gfx::Rect layer_rect = gfx::ScaleToEnclosingRect( |
149 content_rect, 1.f / contents_scale); | 149 content_rect, 1.f / contents_scale); |
150 layer_rect.Intersect(gfx::Rect(tiling_.tiling_size())); | 150 layer_rect.Intersect(gfx::Rect(tiling_.tiling_size())); |
151 | 151 |
152 // Common case inside of viewport to avoid the slower map lookups. | 152 // Common case inside of viewport to avoid the slower map lookups. |
153 if (recorded_viewport_.Contains(layer_rect)) { | 153 if (recorded_viewport_.Contains(layer_rect)) { |
154 // Sanity check that there are no false positives in recorded_viewport_. | 154 // Sanity check that there are no false positives in recorded_viewport_. |
155 DCHECK(CanRasterSlowTileCheck(layer_rect)); | 155 DCHECK(CanRasterSlowTileCheck(layer_rect)); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 const Picture* PicturePileBase::PictureInfo::GetPicture() const { | 248 const Picture* PicturePileBase::PictureInfo::GetPicture() const { |
249 return picture_.get(); | 249 return picture_.get(); |
250 } | 250 } |
251 | 251 |
252 float PicturePileBase::PictureInfo::GetInvalidationFrequency() const { | 252 float PicturePileBase::PictureInfo::GetInvalidationFrequency() const { |
253 return invalidation_history_.count() / | 253 return invalidation_history_.count() / |
254 static_cast<float>(INVALIDATION_FRAMES_TRACKED); | 254 static_cast<float>(INVALIDATION_FRAMES_TRACKED); |
255 } | 255 } |
256 | 256 |
257 } // namespace cc | 257 } // namespace cc |
OLD | NEW |