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

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

Issue 2115163002: cc: Fix a bug where filter outsets for drop-shadow could be negative. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 5 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
« no previous file with comments | « no previous file | cc/output/filter_operations_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } else { 103 } else {
104 if (op.type() == FilterOperation::BLUR || 104 if (op.type() == FilterOperation::BLUR ||
105 op.type() == FilterOperation::DROP_SHADOW) { 105 op.type() == FilterOperation::DROP_SHADOW) {
106 int spread = SpreadForStdDeviation(op.amount()); 106 int spread = SpreadForStdDeviation(op.amount());
107 if (op.type() == FilterOperation::BLUR) { 107 if (op.type() == FilterOperation::BLUR) {
108 *top += spread; 108 *top += spread;
109 *right += spread; 109 *right += spread;
110 *bottom += spread; 110 *bottom += spread;
111 *left += spread; 111 *left += spread;
112 } else { 112 } else {
113 *top += spread - op.drop_shadow_offset().y(); 113 *top += std::max(0, spread - op.drop_shadow_offset().y());
enne (OOO) 2016/07/06 17:34:57 What if your drop shadow is up and to the left ins
jbroman 2016/07/06 17:37:32 I don't understand your question. No, it doesn't h
enne (OOO) 2016/07/06 17:57:18 *drinks more coffee* Oops, sorry about misreading
114 *right += spread + op.drop_shadow_offset().x(); 114 *right += std::max(0, spread + op.drop_shadow_offset().x());
115 *bottom += spread + op.drop_shadow_offset().y(); 115 *bottom += std::max(0, spread + op.drop_shadow_offset().y());
116 *left += spread - op.drop_shadow_offset().x(); 116 *left += std::max(0, spread - op.drop_shadow_offset().x());
117 } 117 }
118 } 118 }
119 } 119 }
120 } 120 }
121 } 121 }
122 122
123 bool FilterOperations::HasFilterThatMovesPixels() const { 123 bool FilterOperations::HasFilterThatMovesPixels() const {
124 for (size_t i = 0; i < operations_.size(); ++i) { 124 for (size_t i = 0; i < operations_.size(); ++i) {
125 const FilterOperation& op = operations_[i]; 125 const FilterOperation& op = operations_[i];
126 switch (op.type()) { 126 switch (op.type()) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 void FilterOperations::AsValueInto( 239 void FilterOperations::AsValueInto(
240 base::trace_event::TracedValue* value) const { 240 base::trace_event::TracedValue* value) const {
241 for (size_t i = 0; i < operations_.size(); ++i) { 241 for (size_t i = 0; i < operations_.size(); ++i) {
242 value->BeginDictionary(); 242 value->BeginDictionary();
243 operations_[i].AsValueInto(value); 243 operations_[i].AsValueInto(value);
244 value->EndDictionary(); 244 value->EndDictionary();
245 } 245 }
246 } 246 }
247 247
248 } // namespace cc 248 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/filter_operations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698