OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/layers/background_filter_layer.h" |
| 6 #include "cc/layers/background_filter_layer_impl.h" |
| 7 |
| 8 namespace cc { |
| 9 |
| 10 scoped_ptr<LayerImpl> BackgroundFilterLayer::CreateLayerImpl( |
| 11 LayerTreeImpl* tree_impl) { |
| 12 return BackgroundFilterLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); |
| 13 } |
| 14 |
| 15 scoped_refptr<BackgroundFilterLayer> BackgroundFilterLayer::Create() { |
| 16 return make_scoped_refptr(new BackgroundFilterLayer()); |
| 17 } |
| 18 |
| 19 BackgroundFilterLayer::BackgroundFilterLayer() : Layer() { |
| 20 } |
| 21 |
| 22 BackgroundFilterLayer::~BackgroundFilterLayer() { |
| 23 } |
| 24 |
| 25 void BackgroundFilterLayer::SetBackgroundFilters( |
| 26 const FilterOperations& filters) { |
| 27 filter_operations_ = filters; |
| 28 SetNeedsCommit(); |
| 29 } |
| 30 |
| 31 void BackgroundFilterLayer::ApplyFilterAtRect(gfx::Rect src_filter_rect) { |
| 32 if (src_filter_rect_ == src_filter_rect) |
| 33 return; |
| 34 |
| 35 src_filter_rect_ = src_filter_rect; |
| 36 SetNeedsCommit(); |
| 37 } |
| 38 |
| 39 void BackgroundFilterLayer::DrawFilteredBackgroundAtRect( |
| 40 gfx::Rect draw_filter_rect) { |
| 41 if (draw_filter_rect_ == draw_filter_rect) |
| 42 return; |
| 43 |
| 44 draw_filter_rect_ = draw_filter_rect; |
| 45 SetNeedsCommit(); |
| 46 } |
| 47 |
| 48 void BackgroundFilterLayer::PushPropertiesTo(LayerImpl* layer) { |
| 49 Layer::PushPropertiesTo(layer); |
| 50 BackgroundFilterLayerImpl* layer_impl = |
| 51 static_cast<BackgroundFilterLayerImpl*>(layer); |
| 52 |
| 53 layer_impl->ApplyFilterAtRect(src_filter_rect_); |
| 54 layer_impl->DrawFilteredBackgroundAtRect(draw_filter_rect_); |
| 55 layer_impl->SetBackgroundFilters(filter_operations_); |
| 56 } |
| 57 |
| 58 } // namespace cc |
OLD | NEW |