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

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

Issue 1869753003: Replace many skia::RefPtr with sk_sp<> in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
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 <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"
13 #include "third_party/skia/include/core/SkColor.h" 12 #include "third_party/skia/include/core/SkColor.h"
14 #include "third_party/skia/include/core/SkImageFilter.h" 13 #include "third_party/skia/include/core/SkImageFilter.h"
15 #include "third_party/skia/include/core/SkRegion.h" 14 #include "third_party/skia/include/core/SkRegion.h"
16 #include "third_party/skia/include/core/SkScalar.h" 15 #include "third_party/skia/include/core/SkScalar.h"
17 #include "ui/gfx/geometry/point.h" 16 #include "ui/gfx/geometry/point.h"
18 17
19 namespace base { 18 namespace base {
20 namespace trace_event { 19 namespace trace_event {
21 class TracedValue; 20 class TracedValue;
22 } 21 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 gfx::Point drop_shadow_offset() const { 69 gfx::Point drop_shadow_offset() const {
71 DCHECK_EQ(type_, DROP_SHADOW); 70 DCHECK_EQ(type_, DROP_SHADOW);
72 return drop_shadow_offset_; 71 return drop_shadow_offset_;
73 } 72 }
74 73
75 SkColor drop_shadow_color() const { 74 SkColor drop_shadow_color() const {
76 DCHECK_EQ(type_, DROP_SHADOW); 75 DCHECK_EQ(type_, DROP_SHADOW);
77 return drop_shadow_color_; 76 return drop_shadow_color_;
78 } 77 }
79 78
80 skia::RefPtr<SkImageFilter> image_filter() const { 79 sk_sp<SkImageFilter> image_filter() const {
81 DCHECK_EQ(type_, REFERENCE); 80 DCHECK_EQ(type_, REFERENCE);
82 return image_filter_; 81 return image_filter_;
83 } 82 }
84 83
85 const SkScalar* matrix() const { 84 const SkScalar* matrix() const {
86 DCHECK_EQ(type_, COLOR_MATRIX); 85 DCHECK_EQ(type_, COLOR_MATRIX);
87 return matrix_; 86 return matrix_;
88 } 87 }
89 88
90 int zoom_inset() const { 89 int zoom_inset() const {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 140
142 static FilterOperation CreateColorMatrixFilter(SkScalar matrix[20]) { 141 static FilterOperation CreateColorMatrixFilter(SkScalar matrix[20]) {
143 return FilterOperation(COLOR_MATRIX, matrix); 142 return FilterOperation(COLOR_MATRIX, matrix);
144 } 143 }
145 144
146 static FilterOperation CreateZoomFilter(float amount, int inset) { 145 static FilterOperation CreateZoomFilter(float amount, int inset) {
147 return FilterOperation(ZOOM, amount, inset); 146 return FilterOperation(ZOOM, amount, inset);
148 } 147 }
149 148
150 static FilterOperation CreateReferenceFilter( 149 static FilterOperation CreateReferenceFilter(
151 const skia::RefPtr<SkImageFilter>& image_filter) { 150 const sk_sp<SkImageFilter>& image_filter) {
danakj 2016/04/14 19:37:31 while you're here, with c++11 I think you should w
tomhudson 2016/04/25 20:48:10 Done.
152 return FilterOperation(REFERENCE, image_filter); 151 return FilterOperation(REFERENCE, image_filter);
153 } 152 }
154 153
155 static FilterOperation CreateSaturatingBrightnessFilter(float amount) { 154 static FilterOperation CreateSaturatingBrightnessFilter(float amount) {
156 return FilterOperation(SATURATING_BRIGHTNESS, amount); 155 return FilterOperation(SATURATING_BRIGHTNESS, amount);
157 } 156 }
158 157
159 static FilterOperation CreateAlphaThresholdFilter(const SkRegion& region, 158 static FilterOperation CreateAlphaThresholdFilter(const SkRegion& region,
160 float inner_threshold, 159 float inner_threshold,
161 float outer_threshold) { 160 float outer_threshold) {
(...skipping 28 matching lines...) Expand all
190 void set_drop_shadow_offset(const gfx::Point& offset) { 189 void set_drop_shadow_offset(const gfx::Point& offset) {
191 DCHECK_EQ(type_, DROP_SHADOW); 190 DCHECK_EQ(type_, DROP_SHADOW);
192 drop_shadow_offset_ = offset; 191 drop_shadow_offset_ = offset;
193 } 192 }
194 193
195 void set_drop_shadow_color(SkColor color) { 194 void set_drop_shadow_color(SkColor color) {
196 DCHECK_EQ(type_, DROP_SHADOW); 195 DCHECK_EQ(type_, DROP_SHADOW);
197 drop_shadow_color_ = color; 196 drop_shadow_color_ = color;
198 } 197 }
199 198
200 void set_image_filter(const skia::RefPtr<SkImageFilter>& image_filter) { 199 void set_image_filter(const sk_sp<SkImageFilter>& image_filter) {
danakj 2016/04/14 19:37:31 ditto
tomhudson 2016/04/25 20:48:10 Done.
201 DCHECK_EQ(type_, REFERENCE); 200 DCHECK_EQ(type_, REFERENCE);
202 image_filter_ = image_filter; 201 image_filter_ = image_filter;
203 } 202 }
204 203
205 void set_matrix(const SkScalar matrix[20]) { 204 void set_matrix(const SkScalar matrix[20]) {
206 DCHECK_EQ(type_, COLOR_MATRIX); 205 DCHECK_EQ(type_, COLOR_MATRIX);
207 for (unsigned i = 0; i < 20; ++i) 206 for (unsigned i = 0; i < 20; ++i)
208 matrix_[i] = matrix[i]; 207 matrix_[i] = matrix[i];
209 } 208 }
210 209
(...skipping 28 matching lines...) Expand all
239 238
240 FilterOperation(FilterType type, 239 FilterOperation(FilterType type,
241 const gfx::Point& offset, 240 const gfx::Point& offset,
242 float stdDeviation, 241 float stdDeviation,
243 SkColor color); 242 SkColor color);
244 243
245 FilterOperation(FilterType, SkScalar matrix[20]); 244 FilterOperation(FilterType, SkScalar matrix[20]);
246 245
247 FilterOperation(FilterType type, float amount, int inset); 246 FilterOperation(FilterType type, float amount, int inset);
248 247
249 FilterOperation(FilterType type, 248 FilterOperation(FilterType type, const sk_sp<SkImageFilter>& image_filter);
danakj 2016/04/14 19:37:31 ditto
tomhudson 2016/04/25 20:48:10 Done.
250 const skia::RefPtr<SkImageFilter>& image_filter);
251 249
252 FilterOperation(FilterType type, 250 FilterOperation(FilterType type,
253 const SkRegion& region, 251 const SkRegion& region,
254 float inner_threshold, 252 float inner_threshold,
255 float outer_threshold); 253 float outer_threshold);
256 254
257 FilterType type_; 255 FilterType type_;
258 float amount_; 256 float amount_;
259 float outer_threshold_; 257 float outer_threshold_;
260 gfx::Point drop_shadow_offset_; 258 gfx::Point drop_shadow_offset_;
261 SkColor drop_shadow_color_; 259 SkColor drop_shadow_color_;
262 skia::RefPtr<SkImageFilter> image_filter_; 260 sk_sp<SkImageFilter> image_filter_;
263 SkScalar matrix_[20]; 261 SkScalar matrix_[20];
264 int zoom_inset_; 262 int zoom_inset_;
265 SkRegion region_; 263 SkRegion region_;
266 }; 264 };
267 265
268 } // namespace cc 266 } // namespace cc
269 267
270 #endif // CC_OUTPUT_FILTER_OPERATION_H_ 268 #endif // CC_OUTPUT_FILTER_OPERATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698