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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 FilterOperation::FilterOperation(FilterType type, float amount, int inset) | 61 FilterOperation::FilterOperation(FilterType type, float amount, int inset) |
62 : type_(type), | 62 : type_(type), |
63 amount_(amount), | 63 amount_(amount), |
64 drop_shadow_offset_(0, 0), | 64 drop_shadow_offset_(0, 0), |
65 drop_shadow_color_(0), | 65 drop_shadow_color_(0), |
66 zoom_inset_(inset) { | 66 zoom_inset_(inset) { |
67 DCHECK_EQ(type_, ZOOM); | 67 DCHECK_EQ(type_, ZOOM); |
68 memset(matrix_, 0, sizeof(matrix_)); | 68 memset(matrix_, 0, sizeof(matrix_)); |
69 } | 69 } |
70 | 70 |
71 // TODO(ajuma): Define a version of ui::Tween::ValueBetween for floats, and use | 71 // TODO(ajuma): Define a version of gfx::Tween::ValueBetween for floats, and use |
72 // that instead. | 72 // that instead. |
73 static float BlendFloats(float from, float to, double progress) { | 73 static float BlendFloats(float from, float to, double progress) { |
74 return from * (1.0 - progress) + to * progress; | 74 return from * (1.0 - progress) + to * progress; |
75 } | 75 } |
76 | 76 |
77 static int BlendInts(int from, int to, double progress) { | 77 static int BlendInts(int from, int to, double progress) { |
78 return static_cast<int>( | 78 return static_cast<int>( |
79 MathUtil::Round(from * (1.0 - progress) + to * progress)); | 79 MathUtil::Round(from * (1.0 - progress) + to * progress)); |
80 } | 80 } |
81 | 81 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 case FilterOperation::ZOOM: | 249 case FilterOperation::ZOOM: |
250 value->SetDouble("amount", amount_); | 250 value->SetDouble("amount", amount_); |
251 value->SetDouble("inset", zoom_inset_); | 251 value->SetDouble("inset", zoom_inset_); |
252 break; | 252 break; |
253 } | 253 } |
254 return value.PassAs<base::Value>(); | 254 return value.PassAs<base::Value>(); |
255 } | 255 } |
256 | 256 |
257 } // namespace cc | 257 } // namespace cc |
OLD | NEW |