| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/output/filter_operations.h" | 5 #include "cc/output/filter_operations.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <numeric> | 10 #include <numeric> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 gfx::Rect FilterOperations::MapRect(const gfx::Rect& rect, | 66 gfx::Rect FilterOperations::MapRect(const gfx::Rect& rect, |
| 67 const SkMatrix& matrix) const { | 67 const SkMatrix& matrix) const { |
| 68 auto accumulate_rect = [matrix](const gfx::Rect& rect, | 68 auto accumulate_rect = [matrix](const gfx::Rect& rect, |
| 69 const FilterOperation& op) { | 69 const FilterOperation& op) { |
| 70 return op.MapRect(rect, matrix); | 70 return op.MapRect(rect, matrix); |
| 71 }; | 71 }; |
| 72 return std::accumulate(operations_.begin(), operations_.end(), rect, | 72 return std::accumulate(operations_.begin(), operations_.end(), rect, |
| 73 accumulate_rect); | 73 accumulate_rect); |
| 74 } | 74 } |
| 75 | 75 |
| 76 gfx::Rect FilterOperations::MapRectReverse(const gfx::Rect& rect, |
| 77 const SkMatrix& matrix) const { |
| 78 auto accumulate_rect = [&matrix](const gfx::Rect& rect, |
| 79 const FilterOperation& op) { |
| 80 return op.MapRectReverse(rect, matrix); |
| 81 }; |
| 82 return std::accumulate(operations_.rbegin(), operations_.rend(), rect, |
| 83 accumulate_rect); |
| 84 } |
| 85 |
| 76 void FilterOperations::GetOutsets(int* top, | 86 void FilterOperations::GetOutsets(int* top, |
| 77 int* right, | 87 int* right, |
| 78 int* bottom, | 88 int* bottom, |
| 79 int* left) const { | 89 int* left) const { |
| 80 *top = *right = *bottom = *left = 0; | 90 *top = *right = *bottom = *left = 0; |
| 81 for (size_t i = 0; i < operations_.size(); ++i) { | 91 for (size_t i = 0; i < operations_.size(); ++i) { |
| 82 const FilterOperation& op = operations_[i]; | 92 const FilterOperation& op = operations_[i]; |
| 83 // TODO(hendrikw): We should refactor some of this. See crbug.com/523534. | 93 // TODO(hendrikw): We should refactor some of this. See crbug.com/523534. |
| 84 if (op.type() == FilterOperation::REFERENCE) { | 94 if (op.type() == FilterOperation::REFERENCE) { |
| 85 if (!op.image_filter()) | 95 if (!op.image_filter()) |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 void FilterOperations::AsValueInto( | 239 void FilterOperations::AsValueInto( |
| 230 base::trace_event::TracedValue* value) const { | 240 base::trace_event::TracedValue* value) const { |
| 231 for (size_t i = 0; i < operations_.size(); ++i) { | 241 for (size_t i = 0; i < operations_.size(); ++i) { |
| 232 value->BeginDictionary(); | 242 value->BeginDictionary(); |
| 233 operations_[i].AsValueInto(value); | 243 operations_[i].AsValueInto(value); |
| 234 value->EndDictionary(); | 244 value->EndDictionary(); |
| 235 } | 245 } |
| 236 } | 246 } |
| 237 | 247 |
| 238 } // namespace cc | 248 } // namespace cc |
| OLD | NEW |