Chromium Code Reviews| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |