| 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" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 static FilterOperation CreateOpacityFilter(float amount) { | 108 static FilterOperation CreateOpacityFilter(float amount) { |
| 109 return FilterOperation(OPACITY, amount); | 109 return FilterOperation(OPACITY, amount); |
| 110 } | 110 } |
| 111 | 111 |
| 112 static FilterOperation CreateBlurFilter(float amount) { | 112 static FilterOperation CreateBlurFilter(float amount) { |
| 113 return FilterOperation(BLUR, amount); | 113 return FilterOperation(BLUR, amount); |
| 114 } | 114 } |
| 115 | 115 |
| 116 static FilterOperation CreateDropShadowFilter(gfx::Point offset, | 116 static FilterOperation CreateDropShadowFilter(const gfx::Point& offset, |
| 117 float std_deviation, | 117 float std_deviation, |
| 118 SkColor color) { | 118 SkColor color) { |
| 119 return FilterOperation(DROP_SHADOW, offset, std_deviation, color); | 119 return FilterOperation(DROP_SHADOW, offset, std_deviation, color); |
| 120 } | 120 } |
| 121 | 121 |
| 122 static FilterOperation CreateColorMatrixFilter(SkScalar matrix[20]) { | 122 static FilterOperation CreateColorMatrixFilter(SkScalar matrix[20]) { |
| 123 return FilterOperation(COLOR_MATRIX, matrix); | 123 return FilterOperation(COLOR_MATRIX, matrix); |
| 124 } | 124 } |
| 125 | 125 |
| 126 static FilterOperation CreateZoomFilter(float amount, int inset) { | 126 static FilterOperation CreateZoomFilter(float amount, int inset) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 148 } | 148 } |
| 149 | 149 |
| 150 void set_type(FilterType type) { type_ = type; } | 150 void set_type(FilterType type) { type_ = type; } |
| 151 | 151 |
| 152 void set_amount(float amount) { | 152 void set_amount(float amount) { |
| 153 DCHECK_NE(type_, COLOR_MATRIX); | 153 DCHECK_NE(type_, COLOR_MATRIX); |
| 154 DCHECK_NE(type_, REFERENCE); | 154 DCHECK_NE(type_, REFERENCE); |
| 155 amount_ = amount; | 155 amount_ = amount; |
| 156 } | 156 } |
| 157 | 157 |
| 158 void set_drop_shadow_offset(gfx::Point offset) { | 158 void set_drop_shadow_offset(const gfx::Point& offset) { |
| 159 DCHECK_EQ(type_, DROP_SHADOW); | 159 DCHECK_EQ(type_, DROP_SHADOW); |
| 160 drop_shadow_offset_ = offset; | 160 drop_shadow_offset_ = offset; |
| 161 } | 161 } |
| 162 | 162 |
| 163 void set_drop_shadow_color(SkColor color) { | 163 void set_drop_shadow_color(SkColor color) { |
| 164 DCHECK_EQ(type_, DROP_SHADOW); | 164 DCHECK_EQ(type_, DROP_SHADOW); |
| 165 drop_shadow_color_ = color; | 165 drop_shadow_color_ = color; |
| 166 } | 166 } |
| 167 | 167 |
| 168 void set_image_filter(const skia::RefPtr<SkImageFilter>& image_filter) { | 168 void set_image_filter(const skia::RefPtr<SkImageFilter>& image_filter) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 190 static FilterOperation Blend(const FilterOperation* from, | 190 static FilterOperation Blend(const FilterOperation* from, |
| 191 const FilterOperation* to, | 191 const FilterOperation* to, |
| 192 double progress); | 192 double progress); |
| 193 | 193 |
| 194 scoped_ptr<base::Value> AsValue() const; | 194 scoped_ptr<base::Value> AsValue() const; |
| 195 | 195 |
| 196 private: | 196 private: |
| 197 FilterOperation(FilterType type, float amount); | 197 FilterOperation(FilterType type, float amount); |
| 198 | 198 |
| 199 FilterOperation(FilterType type, | 199 FilterOperation(FilterType type, |
| 200 gfx::Point offset, | 200 const gfx::Point& offset, |
| 201 float stdDeviation, | 201 float stdDeviation, |
| 202 SkColor color); | 202 SkColor color); |
| 203 | 203 |
| 204 FilterOperation(FilterType, SkScalar matrix[20]); | 204 FilterOperation(FilterType, SkScalar matrix[20]); |
| 205 | 205 |
| 206 FilterOperation(FilterType type, float amount, int inset); | 206 FilterOperation(FilterType type, float amount, int inset); |
| 207 | 207 |
| 208 FilterOperation(FilterType type, | 208 FilterOperation(FilterType type, |
| 209 const skia::RefPtr<SkImageFilter>& image_filter); | 209 const skia::RefPtr<SkImageFilter>& image_filter); |
| 210 | 210 |
| 211 FilterType type_; | 211 FilterType type_; |
| 212 float amount_; | 212 float amount_; |
| 213 gfx::Point drop_shadow_offset_; | 213 gfx::Point drop_shadow_offset_; |
| 214 SkColor drop_shadow_color_; | 214 SkColor drop_shadow_color_; |
| 215 skia::RefPtr<SkImageFilter> image_filter_; | 215 skia::RefPtr<SkImageFilter> image_filter_; |
| 216 SkScalar matrix_[20]; | 216 SkScalar matrix_[20]; |
| 217 int zoom_inset_; | 217 int zoom_inset_; |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 } // namespace cc | 220 } // namespace cc |
| 221 | 221 |
| 222 #endif // CC_OUTPUT_FILTER_OPERATION_H_ | 222 #endif // CC_OUTPUT_FILTER_OPERATION_H_ |
| OLD | NEW |