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 |