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

Unified Diff: cc/layers/background_filter_layer.cc

Issue 462983003: [WIP] Implement BackGroundFilter as seperate layer in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/background_filter_layer.h ('k') | cc/layers/background_filter_layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/background_filter_layer.cc
diff --git a/cc/layers/background_filter_layer.cc b/cc/layers/background_filter_layer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ec95769eb37061a1fb96665357e2dd212c32ecfd
--- /dev/null
+++ b/cc/layers/background_filter_layer.cc
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/layers/background_filter_layer.h"
+#include "cc/layers/background_filter_layer_impl.h"
+
+namespace cc {
+
+scoped_ptr<LayerImpl> BackgroundFilterLayer::CreateLayerImpl(
+ LayerTreeImpl* tree_impl) {
+ return BackgroundFilterLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
+}
+
+scoped_refptr<BackgroundFilterLayer> BackgroundFilterLayer::Create() {
+ return make_scoped_refptr(new BackgroundFilterLayer());
+}
+
+BackgroundFilterLayer::BackgroundFilterLayer() : Layer() {
+}
+
+BackgroundFilterLayer::~BackgroundFilterLayer() {
+}
+
+void BackgroundFilterLayer::SetBackgroundFilters(
+ const FilterOperations& filters) {
+ filter_operations_ = filters;
+ SetNeedsCommit();
+}
+
+void BackgroundFilterLayer::ApplyFilterAtRect(gfx::Rect src_filter_rect) {
+ if (src_filter_rect_ == src_filter_rect)
+ return;
+
+ src_filter_rect_ = src_filter_rect;
+ SetNeedsCommit();
+}
+
+void BackgroundFilterLayer::DrawFilteredBackgroundAtRect(
+ gfx::Rect draw_filter_rect) {
+ if (draw_filter_rect_ == draw_filter_rect)
+ return;
+
+ draw_filter_rect_ = draw_filter_rect;
+ SetNeedsCommit();
+}
+
+void BackgroundFilterLayer::PushPropertiesTo(LayerImpl* layer) {
+ Layer::PushPropertiesTo(layer);
+ BackgroundFilterLayerImpl* layer_impl =
+ static_cast<BackgroundFilterLayerImpl*>(layer);
+
+ layer_impl->ApplyFilterAtRect(src_filter_rect_);
+ layer_impl->DrawFilteredBackgroundAtRect(draw_filter_rect_);
+ layer_impl->SetBackgroundFilters(filter_operations_);
+}
+
+} // namespace cc
« no previous file with comments | « cc/layers/background_filter_layer.h ('k') | cc/layers/background_filter_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698