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

Side by Side Diff: cc/output/filter_operations.cc

Issue 1998233002: cc: Implement and use FilterOperations::MapRectReverse for mapping backdrop bounding box. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 gfx::Rect FilterOperations::MapRect(const gfx::Rect& rect, 58 gfx::Rect FilterOperations::MapRect(const gfx::Rect& rect,
59 const SkMatrix& matrix) const { 59 const SkMatrix& matrix) const {
60 auto accumulate_rect = [matrix](const gfx::Rect& rect, 60 auto accumulate_rect = [matrix](const gfx::Rect& rect,
61 const FilterOperation& op) { 61 const FilterOperation& op) {
62 return op.MapRect(rect, matrix); 62 return op.MapRect(rect, matrix);
63 }; 63 };
64 return std::accumulate(operations_.begin(), operations_.end(), rect, 64 return std::accumulate(operations_.begin(), operations_.end(), rect,
65 accumulate_rect); 65 accumulate_rect);
66 } 66 }
67 67
68 gfx::Rect FilterOperations::MapRectReverse(const gfx::Rect& rect,
69 const SkMatrix& matrix) const {
70 auto accumulate_rect = [&matrix](const gfx::Rect& rect,
71 const FilterOperation& op) {
72 return op.MapRectReverse(rect, matrix);
73 };
74 return std::accumulate(operations_.rbegin(), operations_.rend(), rect,
75 accumulate_rect);
76 }
77
68 void FilterOperations::GetOutsets(int* top, 78 void FilterOperations::GetOutsets(int* top,
69 int* right, 79 int* right,
70 int* bottom, 80 int* bottom,
71 int* left) const { 81 int* left) const {
72 *top = *right = *bottom = *left = 0; 82 *top = *right = *bottom = *left = 0;
73 for (size_t i = 0; i < operations_.size(); ++i) { 83 for (size_t i = 0; i < operations_.size(); ++i) {
74 const FilterOperation& op = operations_[i]; 84 const FilterOperation& op = operations_[i];
75 // TODO(hendrikw): We should refactor some of this. See crbug.com/523534. 85 // TODO(hendrikw): We should refactor some of this. See crbug.com/523534.
76 if (op.type() == FilterOperation::REFERENCE) { 86 if (op.type() == FilterOperation::REFERENCE) {
77 if (!op.image_filter()) 87 if (!op.image_filter())
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 void FilterOperations::AsValueInto( 231 void FilterOperations::AsValueInto(
222 base::trace_event::TracedValue* value) const { 232 base::trace_event::TracedValue* value) const {
223 for (size_t i = 0; i < operations_.size(); ++i) { 233 for (size_t i = 0; i < operations_.size(); ++i) {
224 value->BeginDictionary(); 234 value->BeginDictionary();
225 operations_[i].AsValueInto(value); 235 operations_[i].AsValueInto(value);
226 value->EndDictionary(); 236 value->EndDictionary();
227 } 237 }
228 } 238 }
229 239
230 } // namespace cc 240 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698