OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkAlphaThresholdFilter.h" | 8 #include "SkAlphaThresholdFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
11 #include "SkWriteBuffer.h" | 11 #include "SkWriteBuffer.h" |
12 #include "SkRegion.h" | 12 #include "SkRegion.h" |
13 | 13 |
14 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter { | 14 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter { |
15 public: | 15 public: |
16 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, SkScalar outerThreshold); | 16 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, SkScalar outerThreshold, SkImageFilter* input = NULL); |
reed1
2014/07/08 15:15:24
nit: 100 col
Stephen White
2014/07/08 15:33:30
Fixed.
| |
17 | 17 |
18 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm pl) | 18 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm pl) |
19 | 19 |
20 protected: | 20 protected: |
21 explicit SkAlphaThresholdFilterImpl(SkReadBuffer& buffer); | 21 explicit SkAlphaThresholdFilterImpl(SkReadBuffer& buffer); |
22 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 22 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
23 | 23 |
24 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 24 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
25 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE; | 25 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE; |
26 #if SK_SUPPORT_GPU | 26 #if SK_SUPPORT_GPU |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 | 233 |
234 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(SkReadBuffer& buffer) | 234 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(SkReadBuffer& buffer) |
235 : INHERITED(1, buffer) { | 235 : INHERITED(1, buffer) { |
236 fInnerThreshold = buffer.readScalar(); | 236 fInnerThreshold = buffer.readScalar(); |
237 fOuterThreshold = buffer.readScalar(); | 237 fOuterThreshold = buffer.readScalar(); |
238 buffer.readRegion(&fRegion); | 238 buffer.readRegion(&fRegion); |
239 } | 239 } |
240 | 240 |
241 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region, | 241 SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region, |
242 SkScalar innerThreshold, | 242 SkScalar innerThreshold, |
243 SkScalar outerThreshold) | 243 SkScalar outerThreshold, |
244 : INHERITED(0) | 244 SkImageFilter* input) |
245 : INHERITED(1, &input) | |
245 , fRegion(region) | 246 , fRegion(region) |
246 , fInnerThreshold(innerThreshold) | 247 , fInnerThreshold(innerThreshold) |
247 , fOuterThreshold(outerThreshold) { | 248 , fOuterThreshold(outerThreshold) { |
248 } | 249 } |
249 | 250 |
250 #if SK_SUPPORT_GPU | 251 #if SK_SUPPORT_GPU |
251 bool SkAlphaThresholdFilterImpl::asNewEffect(GrEffect** effect, GrTexture* textu re, | 252 bool SkAlphaThresholdFilterImpl::asNewEffect(GrEffect** effect, GrTexture* textu re, |
252 const SkMatrix& in_matrix, const Sk IRect&) const { | 253 const SkMatrix& in_matrix, const Sk IRect&) const { |
253 if (effect) { | 254 if (effect) { |
254 GrContext* context = texture->getContext(); | 255 GrContext* context = texture->getContext(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 (U8CPU)(SkColorGetG(source) * scale), | 358 (U8CPU)(SkColorGetG(source) * scale), |
358 (U8CPU)(SkColorGetB(source) * scale)); | 359 (U8CPU)(SkColorGetB(source) * scale)); |
359 } | 360 } |
360 } | 361 } |
361 dptr[y * dst->width() + x] = output_color; | 362 dptr[y * dst->width() + x] = output_color; |
362 } | 363 } |
363 } | 364 } |
364 | 365 |
365 return true; | 366 return true; |
366 } | 367 } |
OLD | NEW |