| 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 #ifndef CC_OUTPUT_FILTER_OPERATION_H_ | 5 #ifndef CC_OUTPUT_FILTER_OPERATION_H_ |
| 6 #define CC_OUTPUT_FILTER_OPERATION_H_ | 6 #define CC_OUTPUT_FILTER_OPERATION_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "skia/ext/refptr.h" | 12 #include "skia/ext/refptr.h" |
| 13 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
| 14 #include "third_party/skia/include/core/SkImageFilter.h" | 14 #include "third_party/skia/include/core/SkImageFilter.h" |
| 15 #include "third_party/skia/include/core/SkRegion.h" | 15 #include "third_party/skia/include/core/SkRegion.h" |
| 16 #include "third_party/skia/include/core/SkScalar.h" | 16 #include "third_party/skia/include/core/SkScalar.h" |
| 17 #include "ui/gfx/geometry/point.h" | 17 #include "ui/gfx/geometry/point.h" |
| 18 | 18 |
| 19 namespace base { | 19 namespace base { |
| 20 namespace trace_event { | 20 namespace trace_event { |
| 21 class TracedValue; | 21 class TracedValue; |
| 22 } | 22 } |
| 23 class Value; | 23 class Value; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace gfx { |
| 27 class Rect; |
| 28 } |
| 29 |
| 26 namespace cc { | 30 namespace cc { |
| 27 | 31 |
| 28 class CC_EXPORT FilterOperation { | 32 class CC_EXPORT FilterOperation { |
| 29 public: | 33 public: |
| 30 enum FilterType { | 34 enum FilterType { |
| 31 GRAYSCALE, | 35 GRAYSCALE, |
| 32 SEPIA, | 36 SEPIA, |
| 33 SATURATE, | 37 SATURATE, |
| 34 HUE_ROTATE, | 38 HUE_ROTATE, |
| 35 INVERT, | 39 INVERT, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 // |from| or |to| (but not both) is null, it is treated as a no-op filter of | 223 // |from| or |to| (but not both) is null, it is treated as a no-op filter of |
| 220 // the same type as the other given filter. If both |from| and |to| are null, | 224 // the same type as the other given filter. If both |from| and |to| are null, |
| 221 // or if |from| and |to| are non-null but of different types, returns a | 225 // or if |from| and |to| are non-null but of different types, returns a |
| 222 // no-op filter. | 226 // no-op filter. |
| 223 static FilterOperation Blend(const FilterOperation* from, | 227 static FilterOperation Blend(const FilterOperation* from, |
| 224 const FilterOperation* to, | 228 const FilterOperation* to, |
| 225 double progress); | 229 double progress); |
| 226 | 230 |
| 227 void AsValueInto(base::trace_event::TracedValue* value) const; | 231 void AsValueInto(base::trace_event::TracedValue* value) const; |
| 228 | 232 |
| 233 // Maps "forward" to determine which pixels in a destination rect are affected |
| 234 // by pixels in the source rect. |
| 235 gfx::Rect MapRect(const gfx::Rect& rect) const; |
| 236 |
| 229 private: | 237 private: |
| 230 FilterOperation(FilterType type, float amount); | 238 FilterOperation(FilterType type, float amount); |
| 231 | 239 |
| 232 FilterOperation(FilterType type, | 240 FilterOperation(FilterType type, |
| 233 const gfx::Point& offset, | 241 const gfx::Point& offset, |
| 234 float stdDeviation, | 242 float stdDeviation, |
| 235 SkColor color); | 243 SkColor color); |
| 236 | 244 |
| 237 FilterOperation(FilterType, SkScalar matrix[20]); | 245 FilterOperation(FilterType, SkScalar matrix[20]); |
| 238 | 246 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 253 SkColor drop_shadow_color_; | 261 SkColor drop_shadow_color_; |
| 254 skia::RefPtr<SkImageFilter> image_filter_; | 262 skia::RefPtr<SkImageFilter> image_filter_; |
| 255 SkScalar matrix_[20]; | 263 SkScalar matrix_[20]; |
| 256 int zoom_inset_; | 264 int zoom_inset_; |
| 257 SkRegion region_; | 265 SkRegion region_; |
| 258 }; | 266 }; |
| 259 | 267 |
| 260 } // namespace cc | 268 } // namespace cc |
| 261 | 269 |
| 262 #endif // CC_OUTPUT_FILTER_OPERATION_H_ | 270 #endif // CC_OUTPUT_FILTER_OPERATION_H_ |
| OLD | NEW |