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