Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: cc/output/filter_operation.h

Issue 317663005: Scale the ALPHA_THRESHOLD filter's region based on the device scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove call to SetAlphaShape from this cl Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/output/filter_operation.cc » ('j') | cc/output/filter_operation.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 int zoom_inset() const { 82 int zoom_inset() const {
83 DCHECK_EQ(type_, ZOOM); 83 DCHECK_EQ(type_, ZOOM);
84 return zoom_inset_; 84 return zoom_inset_;
85 } 85 }
86 86
87 const SkRegion& region() const { 87 const SkRegion& region() const {
88 DCHECK_EQ(type_, ALPHA_THRESHOLD); 88 DCHECK_EQ(type_, ALPHA_THRESHOLD);
89 return region_; 89 return region_;
90 } 90 }
91 91
92 float device_scale_factor() const {
93 DCHECK_EQ(type_, ALPHA_THRESHOLD);
94 return device_scale_factor_;
95 }
96
92 static FilterOperation CreateGrayscaleFilter(float amount) { 97 static FilterOperation CreateGrayscaleFilter(float amount) {
93 return FilterOperation(GRAYSCALE, amount); 98 return FilterOperation(GRAYSCALE, amount);
94 } 99 }
95 100
96 static FilterOperation CreateSepiaFilter(float amount) { 101 static FilterOperation CreateSepiaFilter(float amount) {
97 return FilterOperation(SEPIA, amount); 102 return FilterOperation(SEPIA, amount);
98 } 103 }
99 104
100 static FilterOperation CreateSaturateFilter(float amount) { 105 static FilterOperation CreateSaturateFilter(float amount) {
101 return FilterOperation(SATURATE, amount); 106 return FilterOperation(SATURATE, amount);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 static FilterOperation CreateReferenceFilter( 147 static FilterOperation CreateReferenceFilter(
143 const skia::RefPtr<SkImageFilter>& image_filter) { 148 const skia::RefPtr<SkImageFilter>& image_filter) {
144 return FilterOperation(REFERENCE, image_filter); 149 return FilterOperation(REFERENCE, image_filter);
145 } 150 }
146 151
147 static FilterOperation CreateSaturatingBrightnessFilter(float amount) { 152 static FilterOperation CreateSaturatingBrightnessFilter(float amount) {
148 return FilterOperation(SATURATING_BRIGHTNESS, amount); 153 return FilterOperation(SATURATING_BRIGHTNESS, amount);
149 } 154 }
150 155
151 static FilterOperation CreateAlphaThresholdFilter(const SkRegion& region, 156 static FilterOperation CreateAlphaThresholdFilter(const SkRegion& region,
157 float device_scale_factor,
danakj 2014/06/17 21:35:28 The fact that you're setting this to the DSF doesn
garykac 2014/07/10 23:02:24 Acknowledged.
152 float inner_threshold, 158 float inner_threshold,
153 float outer_threshold) { 159 float outer_threshold) {
154 return FilterOperation(ALPHA_THRESHOLD, region, 160 return FilterOperation(ALPHA_THRESHOLD,
155 inner_threshold, outer_threshold); 161 region,
162 device_scale_factor,
163 inner_threshold,
164 outer_threshold);
156 } 165 }
157 166
158 bool operator==(const FilterOperation& other) const; 167 bool operator==(const FilterOperation& other) const;
159 168
160 bool operator!=(const FilterOperation& other) const { 169 bool operator!=(const FilterOperation& other) const {
161 return !(*this == other); 170 return !(*this == other);
162 } 171 }
163 172
164 // Methods for restoring a FilterOperation. 173 // Methods for restoring a FilterOperation.
165 static FilterOperation CreateEmptyFilter() { 174 static FilterOperation CreateEmptyFilter() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 void set_zoom_inset(int inset) { 212 void set_zoom_inset(int inset) {
204 DCHECK_EQ(type_, ZOOM); 213 DCHECK_EQ(type_, ZOOM);
205 zoom_inset_ = inset; 214 zoom_inset_ = inset;
206 } 215 }
207 216
208 void set_region(const SkRegion& region) { 217 void set_region(const SkRegion& region) {
209 DCHECK_EQ(type_, ALPHA_THRESHOLD); 218 DCHECK_EQ(type_, ALPHA_THRESHOLD);
210 region_ = region; 219 region_ = region;
211 } 220 }
212 221
222 void set_device_scale_factor(float scale) {
223 DCHECK_EQ(type_, ALPHA_THRESHOLD);
224 device_scale_factor_ = scale;
225 }
226
213 // Given two filters of the same type, returns a filter operation created by 227 // Given two filters of the same type, returns a filter operation created by
214 // linearly interpolating a |progress| fraction from |from| to |to|. If either 228 // linearly interpolating a |progress| fraction from |from| to |to|. If either
215 // |from| or |to| (but not both) is null, it is treated as a no-op filter of 229 // |from| or |to| (but not both) is null, it is treated as a no-op filter of
216 // the same type as the other given filter. If both |from| and |to| are null, 230 // the same type as the other given filter. If both |from| and |to| are null,
217 // or if |from| and |to| are non-null but of different types, returns a 231 // or if |from| and |to| are non-null but of different types, returns a
218 // no-op filter. 232 // no-op filter.
219 static FilterOperation Blend(const FilterOperation* from, 233 static FilterOperation Blend(const FilterOperation* from,
220 const FilterOperation* to, 234 const FilterOperation* to,
221 double progress); 235 double progress);
222 236
223 scoped_ptr<base::Value> AsValue() const; 237 scoped_ptr<base::Value> AsValue() const;
224 238
225 private: 239 private:
226 FilterOperation(FilterType type, float amount); 240 FilterOperation(FilterType type, float amount);
227 241
228 FilterOperation(FilterType type, 242 FilterOperation(FilterType type,
229 const gfx::Point& offset, 243 const gfx::Point& offset,
230 float stdDeviation, 244 float stdDeviation,
231 SkColor color); 245 SkColor color);
232 246
233 FilterOperation(FilterType, SkScalar matrix[20]); 247 FilterOperation(FilterType, SkScalar matrix[20]);
234 248
235 FilterOperation(FilterType type, float amount, int inset); 249 FilterOperation(FilterType type, float amount, int inset);
236 250
237 FilterOperation(FilterType type, 251 FilterOperation(FilterType type,
238 const skia::RefPtr<SkImageFilter>& image_filter); 252 const skia::RefPtr<SkImageFilter>& image_filter);
239 253
240 FilterOperation(FilterType type, 254 FilterOperation(FilterType type,
241 const SkRegion& region, 255 const SkRegion& region,
256 float device_scale_factor,
242 float inner_threshold, 257 float inner_threshold,
243 float outer_threshold); 258 float outer_threshold);
244 259
245 FilterType type_; 260 FilterType type_;
246 float amount_; 261 float amount_;
247 float outer_threshold_; 262 float outer_threshold_;
248 gfx::Point drop_shadow_offset_; 263 gfx::Point drop_shadow_offset_;
249 SkColor drop_shadow_color_; 264 SkColor drop_shadow_color_;
250 skia::RefPtr<SkImageFilter> image_filter_; 265 skia::RefPtr<SkImageFilter> image_filter_;
251 SkScalar matrix_[20]; 266 SkScalar matrix_[20];
252 int zoom_inset_; 267 int zoom_inset_;
253 SkRegion region_; 268 SkRegion region_;
269 float device_scale_factor_;
254 }; 270 };
255 271
256 } // namespace cc 272 } // namespace cc
257 273
258 #endif // CC_OUTPUT_FILTER_OPERATION_H_ 274 #endif // CC_OUTPUT_FILTER_OPERATION_H_
OLDNEW
« no previous file with comments | « no previous file | cc/output/filter_operation.cc » ('j') | cc/output/filter_operation.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698