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

Unified Diff: cc/layers/layer.cc

Issue 23455060: mix-blend-mode implementation for accelerated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 86887a6ad2c72264f8447612c97e8d7804034649..11bc4646f68a539b0103562e8df93c07d6888655 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -45,6 +45,8 @@ Layer::Layer()
background_color_(0),
compositing_reasons_(kCompositingReasonUnknown),
opacity_(1.f),
+ blend_mode_(SkXfermode::kSrcOver_Mode),
+ is_root_for_isolated_group_(false),
anchor_point_z_(0.f),
is_container_for_fixed_position_layers_(false),
is_drawable_(false),
@@ -124,7 +126,8 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) {
if (host && layer_animation_controller_->has_any_animation())
host->SetNeedsCommit();
if (host &&
- (!filters_.IsEmpty() || !background_filters_.IsEmpty() || filter_))
+ (!filters_.IsEmpty() || !background_filters_.IsEmpty() || filter_ ||
+ has_blend_mode()))
layer_tree_host_->set_needs_filter_context();
}
@@ -516,6 +519,22 @@ bool Layer::OpacityCanAnimateOnImplThread() const {
return false;
}
+void Layer::SetBlendMode(SkXfermode::Mode blendMode) {
+ if (blend_mode_ == blendMode)
+ return;
+ blend_mode_ = blendMode;
+ SetNeedsCommit();
+ if (has_blend_mode() && layer_tree_host_)
+ layer_tree_host_->set_needs_filter_context();
+}
+
+void Layer::SetIsRootForIsolatedGroup(bool root) {
+ if (is_root_for_isolated_group_ == root)
+ return;
+ is_root_for_isolated_group_ = root;
+ SetNeedsCommit();
+}
+
void Layer::SetContentsOpaque(bool opaque) {
DCHECK(IsPropertyChangeAllowed());
if (contents_opaque_ == opaque)
@@ -832,6 +851,8 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating())
layer->SetOpacity(opacity_);
DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly()));
+ layer->SetBlendMode(blend_mode_);
+ layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_);
layer->SetPosition(position_);
layer->SetIsContainerForFixedPositionLayers(
IsContainerForFixedPositionLayers());
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | cc/output/gl_renderer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698