Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 2100483003: cc: Change directly composited image raster source scale occasionally. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 56fcfecbfe559b8a5827426e681d925be025c026..b2373fcae8326558b47b9760dd256e075fc1ad3f 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -874,9 +874,14 @@ void PictureLayerImpl::AddTilingsForRasterScale() {
}
bool PictureLayerImpl::ShouldAdjustRasterScale() const {
- // TODO(vmpstr): We might want to adjust the raster scale once in a while.
- if (is_directly_composited_image_)
+ if (is_directly_composited_image_) {
+ float max_scale = std::max(1.f, MinimumContentsScale());
+ if (raster_source_scale_ < std::min(ideal_source_scale_, max_scale))
+ return true;
+ if (raster_source_scale_ > 4 * ideal_source_scale_)
+ return true;
return false;
+ }
if (was_screen_space_transform_animating_ !=
draw_properties().screen_space_transform_is_animating)
@@ -956,11 +961,25 @@ void PictureLayerImpl::AddLowResolutionTilingIfNeeded() {
}
void PictureLayerImpl::RecalculateRasterScales() {
- // TODO(vmpstr): We might want to adjust these once in a while.
if (is_directly_composited_image_) {
+ if (!raster_source_scale_)
+ raster_source_scale_ = 1.f;
+
+ float min_scale = MinimumContentsScale();
+ float max_scale = std::max(1.f, MinimumContentsScale());
+ float clamped_ideal_source_scale_ =
+ std::max(min_scale, std::min(ideal_source_scale_, max_scale));
+
+ while (raster_source_scale_ < clamped_ideal_source_scale_)
+ raster_source_scale_ *= 2.f;
+ while (raster_source_scale_ > 4 * clamped_ideal_source_scale_)
+ raster_source_scale_ /= 2.f;
+
+ raster_source_scale_ =
+ std::max(min_scale, std::min(raster_source_scale_, max_scale));
+
raster_page_scale_ = 1.f;
raster_device_scale_ = 1.f;
- raster_source_scale_ = std::max(1.f, MinimumContentsScale());
raster_contents_scale_ = raster_source_scale_;
low_res_raster_contents_scale_ = raster_contents_scale_;
return;
@@ -1195,15 +1214,6 @@ PictureLayerImpl::CreatePictureLayerTilingSet() {
}
void PictureLayerImpl::UpdateIdealScales() {
- // TODO(vmpstr): We might want to adjust these once in a while.
- if (is_directly_composited_image_) {
- ideal_contents_scale_ = 1.f;
- ideal_page_scale_ = 1.f;
- ideal_device_scale_ = 1.f;
- ideal_source_scale_ = 1.f;
- return;
- }
-
DCHECK(CanHaveTilings());
float min_contents_scale = MinimumContentsScale();
« no previous file with comments | « no previous file | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698