| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layer_impl.h" | 5 #include "cc/layer_impl.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "cc/debug_border_draw_quad.h" | 9 #include "cc/debug_border_draw_quad.h" |
| 10 #include "cc/debug_colors.h" | 10 #include "cc/debug_colors.h" |
| 11 #include "cc/layer_sorter.h" | 11 #include "cc/layer_sorter.h" |
| 12 #include "cc/layer_tree_host_impl.h" | 12 #include "cc/layer_tree_host_impl.h" |
| 13 #include "cc/math_util.h" | 13 #include "cc/math_util.h" |
| 14 #include "cc/proxy.h" | 14 #include "cc/proxy.h" |
| 15 #include "cc/quad_sink.h" | 15 #include "cc/quad_sink.h" |
| 16 #include "cc/scrollbar_animation_controller.h" | 16 #include "cc/scrollbar_animation_controller.h" |
| 17 #include "third_party/skia/include/core/SkImageFilter.h" | |
| 18 #include "ui/gfx/point_conversions.h" | 17 #include "ui/gfx/point_conversions.h" |
| 19 #include "ui/gfx/rect_conversions.h" | 18 #include "ui/gfx/rect_conversions.h" |
| 20 | 19 |
| 21 using WebKit::WebTransformationMatrix; | 20 using WebKit::WebTransformationMatrix; |
| 22 | 21 |
| 23 namespace cc { | 22 namespace cc { |
| 24 | 23 |
| 25 LayerImpl::LayerImpl(int id) | 24 LayerImpl::LayerImpl(int id) |
| 26 : m_parent(0) | 25 : m_parent(0) |
| 27 , m_maskLayerId(-1) | 26 , m_maskLayerId(-1) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 , m_layerAnimationController(LayerAnimationController::create(this)) | 62 , m_layerAnimationController(LayerAnimationController::create(this)) |
| 64 { | 63 { |
| 65 DCHECK(m_layerId > 0); | 64 DCHECK(m_layerId > 0); |
| 66 } | 65 } |
| 67 | 66 |
| 68 LayerImpl::~LayerImpl() | 67 LayerImpl::~LayerImpl() |
| 69 { | 68 { |
| 70 #ifndef NDEBUG | 69 #ifndef NDEBUG |
| 71 DCHECK(!m_betweenWillDrawAndDidDraw); | 70 DCHECK(!m_betweenWillDrawAndDidDraw); |
| 72 #endif | 71 #endif |
| 73 SkSafeUnref(m_filter); | |
| 74 } | 72 } |
| 75 | 73 |
| 76 void LayerImpl::addChild(scoped_ptr<LayerImpl> child) | 74 void LayerImpl::addChild(scoped_ptr<LayerImpl> child) |
| 77 { | 75 { |
| 78 child->setParent(this); | 76 child->setParent(this); |
| 79 m_children.append(child.Pass()); | 77 m_children.append(child.Pass()); |
| 80 } | 78 } |
| 81 | 79 |
| 82 void LayerImpl::removeFromParent() | 80 void LayerImpl::removeFromParent() |
| 83 { | 81 { |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 525 |
| 528 void LayerImpl::setBackgroundFilters(const WebKit::WebFilterOperations& backgrou
ndFilters) | 526 void LayerImpl::setBackgroundFilters(const WebKit::WebFilterOperations& backgrou
ndFilters) |
| 529 { | 527 { |
| 530 if (m_backgroundFilters == backgroundFilters) | 528 if (m_backgroundFilters == backgroundFilters) |
| 531 return; | 529 return; |
| 532 | 530 |
| 533 m_backgroundFilters = backgroundFilters; | 531 m_backgroundFilters = backgroundFilters; |
| 534 m_layerPropertyChanged = true; | 532 m_layerPropertyChanged = true; |
| 535 } | 533 } |
| 536 | 534 |
| 537 void LayerImpl::setFilter(SkImageFilter* filter) | 535 void LayerImpl::setFilter(const SkRefPtr<SkImageFilter>& filter) |
| 538 { | 536 { |
| 539 if (m_filter == filter) | 537 if (m_filter.get() == filter.get()) |
| 540 return; | 538 return; |
| 541 | 539 |
| 542 DCHECK(m_filters.isEmpty()); | 540 DCHECK(m_filters.isEmpty()); |
| 543 SkRefCnt_SafeAssign(m_filter, filter); | 541 m_filter = filter; |
| 544 noteLayerPropertyChangedForSubtree(); | 542 noteLayerPropertyChangedForSubtree(); |
| 545 } | 543 } |
| 546 | 544 |
| 547 void LayerImpl::setMasksToBounds(bool masksToBounds) | 545 void LayerImpl::setMasksToBounds(bool masksToBounds) |
| 548 { | 546 { |
| 549 if (m_masksToBounds == masksToBounds) | 547 if (m_masksToBounds == masksToBounds) |
| 550 return; | 548 return; |
| 551 | 549 |
| 552 m_masksToBounds = masksToBounds; | 550 m_masksToBounds = masksToBounds; |
| 553 noteLayerPropertyChangedForSubtree(); | 551 noteLayerPropertyChangedForSubtree(); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 | 721 |
| 724 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) | 722 void LayerImpl::setVerticalScrollbarLayer(ScrollbarLayerImpl* scrollbarLayer) |
| 725 { | 723 { |
| 726 if (!m_scrollbarAnimationController) | 724 if (!m_scrollbarAnimationController) |
| 727 m_scrollbarAnimationController = ScrollbarAnimationController::create(th
is); | 725 m_scrollbarAnimationController = ScrollbarAnimationController::create(th
is); |
| 728 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); | 726 m_scrollbarAnimationController->setVerticalScrollbarLayer(scrollbarLayer); |
| 729 m_scrollbarAnimationController->updateScrollOffset(this); | 727 m_scrollbarAnimationController->updateScrollOffset(this); |
| 730 } | 728 } |
| 731 | 729 |
| 732 } // namespace cc | 730 } // namespace cc |
| OLD | NEW |