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

Unified Diff: cc/layers/layer.cc

Issue 2410513002: Plumb preferred raster scale for background images from Blink to cc layers. (Closed)
Patch Set: none Created 4 years, 2 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 | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 43ad88a526794d27bb0563b93a9ea73d182b6970..5462c1f3b5c819ddeece94242348b5e4c5d18984 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -67,8 +67,10 @@ Layer::Inputs::Inputs(int layer_id)
scroll_parent(nullptr),
clip_parent(nullptr),
has_will_change_transform_hint(false),
+ has_preferred_raster_scale(false),
hide_layer_and_subtree(false),
- client(nullptr) {}
+ client(nullptr),
+ preferred_raster_scale(1.0) {}
Layer::Inputs::~Inputs() {}
@@ -1182,6 +1184,10 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->SetUpdateRect(inputs_.update_rect);
layer->SetHasWillChangeTransformHint(has_will_change_transform_hint());
+ if (has_preferred_raster_scale())
+ layer->SetPreferredRasterScale(preferred_raster_scale());
+ else
+ layer->ClearPreferredRasterScale();
layer->SetNeedsPushProperties();
// Reset any state that should be cleared for the next update.
@@ -1760,6 +1766,24 @@ void Layer::SetHasWillChangeTransformHint(bool has_will_change) {
SetNeedsCommit();
}
+void Layer::SetPreferredRasterScale(float preferred_raster_scale) {
+ if (inputs_.has_preferred_raster_scale &&
+ inputs_.preferred_raster_scale == preferred_raster_scale)
+ return;
+
+ inputs_.has_preferred_raster_scale = true;
+ inputs_.preferred_raster_scale = preferred_raster_scale;
+ SetNeedsCommit();
+}
+
+void Layer::ClearPreferredRasterScale() {
+ if (!inputs_.has_preferred_raster_scale)
+ return;
+ inputs_.has_preferred_raster_scale = false;
+ inputs_.preferred_raster_scale = 1.0f;
+ SetNeedsCommit();
+}
+
AnimationHost* Layer::GetAnimationHost() const {
return layer_tree_ ? layer_tree_->animation_host() : nullptr;
}
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698