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, | 16 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, |
17 SkScalar outerThreshold, SkImageFilter* input); | 17 SkScalar outerThreshold, SkImageFilter* input); |
18 | 18 |
| 19 SK_TO_STRING_OVERRIDE() |
19 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm
pl) | 20 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm
pl) |
20 | 21 |
21 protected: | 22 protected: |
22 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 23 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
23 | 24 |
24 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 25 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
25 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE; | 26 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE; |
26 #if SK_SUPPORT_GPU | 27 #if SK_SUPPORT_GPU |
27 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk
Matrix&, | 28 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk
Matrix&, |
28 const SkIRect& bounds) const SK_OVERRIDE; | 29 const SkIRect& bounds) const SK_OVERRIDE; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 (U8CPU)(SkColorGetG(source) *
scale), | 368 (U8CPU)(SkColorGetG(source) *
scale), |
368 (U8CPU)(SkColorGetB(source) *
scale)); | 369 (U8CPU)(SkColorGetB(source) *
scale)); |
369 } | 370 } |
370 } | 371 } |
371 dptr[y * dst->width() + x] = output_color; | 372 dptr[y * dst->width() + x] = output_color; |
372 } | 373 } |
373 } | 374 } |
374 | 375 |
375 return true; | 376 return true; |
376 } | 377 } |
| 378 |
| 379 #ifndef SK_IGNORE_TO_STRING |
| 380 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
| 381 str->appendf("SkAlphaThresholdImageFilter: ("); |
| 382 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
| 383 str->append(")"); |
| 384 } |
| 385 #endif |
| 386 |
OLD | NEW |