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_BASE_FILTER_OPERATION_H_ |
6 #define CC_OUTPUT_FILTER_OPERATION_H_ | 6 #define CC_BASE_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/base_export.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 } | 22 } |
23 | 23 |
24 namespace gfx { | 24 namespace gfx { |
25 class Rect; | 25 class Rect; |
26 } | 26 } |
27 | 27 |
28 namespace cc { | 28 namespace cc { |
29 | 29 |
30 class CC_EXPORT FilterOperation { | 30 class CC_BASE_EXPORT FilterOperation { |
31 public: | 31 public: |
32 enum FilterType { | 32 enum FilterType { |
33 GRAYSCALE, | 33 GRAYSCALE, |
34 SEPIA, | 34 SEPIA, |
35 SATURATE, | 35 SATURATE, |
36 HUE_ROTATE, | 36 HUE_ROTATE, |
37 INVERT, | 37 INVERT, |
38 BRIGHTNESS, | 38 BRIGHTNESS, |
39 CONTRAST, | 39 CONTRAST, |
40 OPACITY, | 40 OPACITY, |
41 BLUR, | 41 BLUR, |
42 DROP_SHADOW, | 42 DROP_SHADOW, |
43 COLOR_MATRIX, | 43 COLOR_MATRIX, |
44 ZOOM, | 44 ZOOM, |
45 REFERENCE, | 45 REFERENCE, |
46 SATURATING_BRIGHTNESS, // Not used in CSS/SVG. | 46 SATURATING_BRIGHTNESS, // Not used in CSS/SVG. |
47 ALPHA_THRESHOLD, // Not used in CSS/SVG. | 47 ALPHA_THRESHOLD, // Not used in CSS/SVG. |
48 FILTER_TYPE_LAST = ALPHA_THRESHOLD | 48 FILTER_TYPE_LAST = ALPHA_THRESHOLD |
49 }; | 49 }; |
50 | 50 |
51 FilterOperation(); | 51 FilterOperation(); |
52 | 52 |
53 FilterOperation(const FilterOperation& other); | 53 FilterOperation(const FilterOperation& other); |
54 | 54 |
55 ~FilterOperation(); | 55 ~FilterOperation(); |
56 | 56 |
57 FilterType type() const { return type_; } | 57 FilterType type() const { return type_; } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return FilterOperation(REFERENCE, std::move(image_filter)); | 152 return FilterOperation(REFERENCE, std::move(image_filter)); |
153 } | 153 } |
154 | 154 |
155 static FilterOperation CreateSaturatingBrightnessFilter(float amount) { | 155 static FilterOperation CreateSaturatingBrightnessFilter(float amount) { |
156 return FilterOperation(SATURATING_BRIGHTNESS, amount); | 156 return FilterOperation(SATURATING_BRIGHTNESS, amount); |
157 } | 157 } |
158 | 158 |
159 static FilterOperation CreateAlphaThresholdFilter(const SkRegion& region, | 159 static FilterOperation CreateAlphaThresholdFilter(const SkRegion& region, |
160 float inner_threshold, | 160 float inner_threshold, |
161 float outer_threshold) { | 161 float outer_threshold) { |
162 return FilterOperation(ALPHA_THRESHOLD, region, | 162 return FilterOperation(ALPHA_THRESHOLD, region, inner_threshold, |
163 inner_threshold, outer_threshold); | 163 outer_threshold); |
164 } | 164 } |
165 | 165 |
166 bool operator==(const FilterOperation& other) const; | 166 bool operator==(const FilterOperation& other) const; |
167 | 167 |
168 bool operator!=(const FilterOperation& other) const { | 168 bool operator!=(const FilterOperation& other) const { |
169 return !(*this == other); | 169 return !(*this == other); |
170 } | 170 } |
171 | 171 |
172 // Methods for restoring a FilterOperation. | 172 // Methods for restoring a FilterOperation. |
173 static FilterOperation CreateEmptyFilter() { | 173 static FilterOperation CreateEmptyFilter() { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 gfx::Point drop_shadow_offset_; | 263 gfx::Point drop_shadow_offset_; |
264 SkColor drop_shadow_color_; | 264 SkColor drop_shadow_color_; |
265 sk_sp<SkImageFilter> image_filter_; | 265 sk_sp<SkImageFilter> image_filter_; |
266 SkScalar matrix_[20]; | 266 SkScalar matrix_[20]; |
267 int zoom_inset_; | 267 int zoom_inset_; |
268 SkRegion region_; | 268 SkRegion region_; |
269 }; | 269 }; |
270 | 270 |
271 } // namespace cc | 271 } // namespace cc |
272 | 272 |
273 #endif // CC_OUTPUT_FILTER_OPERATION_H_ | 273 #endif // CC_BASE_FILTER_OPERATION_H_ |
OLD | NEW |