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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
| 9 #include "cc/output/filter_operation.h" | 9 #include "cc/output/filter_operation.h" |
| 10 #include "third_party/skia/include/core/SkMath.h" | 10 #include "third_party/skia/include/core/SkMath.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 blended_filter.set_zoom_inset( | 242 blended_filter.set_zoom_inset( |
| 243 std::max(gfx::Tween::LinearIntValueBetween( | 243 std::max(gfx::Tween::LinearIntValueBetween( |
| 244 from_op.zoom_inset(), to_op.zoom_inset(), progress), | 244 from_op.zoom_inset(), to_op.zoom_inset(), progress), |
| 245 0)); | 245 0)); |
| 246 } else if (to_op.type() == FilterOperation::ALPHA_THRESHOLD) { | 246 } else if (to_op.type() == FilterOperation::ALPHA_THRESHOLD) { |
| 247 blended_filter.set_outer_threshold(ClampAmountForFilterType( | 247 blended_filter.set_outer_threshold(ClampAmountForFilterType( |
| 248 gfx::Tween::FloatValueBetween(progress, | 248 gfx::Tween::FloatValueBetween(progress, |
| 249 from_op.outer_threshold(), | 249 from_op.outer_threshold(), |
| 250 to_op.outer_threshold()), | 250 to_op.outer_threshold()), |
| 251 to_op.type())); | 251 to_op.type())); |
| 252 blended_filter.set_region(to_op.region()); | 252 const FilterOperation& copy_op = progress > 0.5 ? to_op : from_op; |
|
danakj
2014/07/11 16:08:22
is this needed?
| |
| 253 blended_filter.set_region(copy_op.region()); | |
| 253 } | 254 } |
| 254 | 255 |
| 255 return blended_filter; | 256 return blended_filter; |
| 256 } | 257 } |
| 257 | 258 |
| 258 scoped_ptr<base::Value> FilterOperation::AsValue() const { | 259 scoped_ptr<base::Value> FilterOperation::AsValue() const { |
| 259 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue); | 260 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue); |
| 260 value->SetInteger("type", type_); | 261 value->SetInteger("type", type_); |
| 261 switch (type_) { | 262 switch (type_) { |
| 262 case FilterOperation::GRAYSCALE: | 263 case FilterOperation::GRAYSCALE: |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 region_value->AppendInteger(it.rect().height()); | 311 region_value->AppendInteger(it.rect().height()); |
| 311 } | 312 } |
| 312 value->Set("region", region_value.release()); | 313 value->Set("region", region_value.release()); |
| 313 } | 314 } |
| 314 break; | 315 break; |
| 315 } | 316 } |
| 316 return value.PassAs<base::Value>(); | 317 return value.PassAs<base::Value>(); |
| 317 } | 318 } |
| 318 | 319 |
| 319 } // namespace cc | 320 } // namespace cc |
| OLD | NEW |