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 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
14 #include "GrDrawContext.h" | 14 #include "GrDrawContext.h" |
15 #endif | 15 #endif |
16 | 16 |
17 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter { | 17 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter { |
18 public: | 18 public: |
19 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, | 19 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, |
20 SkScalar outerThreshold, SkImageFilter* input); | 20 SkScalar outerThreshold, SkImageFilter* input); |
21 | 21 |
22 SK_TO_STRING_OVERRIDE() | 22 SK_TO_STRING_OVERRIDE() |
23 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm
pl) | 23 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm
pl) |
24 | 24 |
25 protected: | 25 protected: |
26 void flatten(SkWriteBuffer&) const override; | 26 void flatten(SkWriteBuffer&) const override; |
27 | 27 |
28 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 28 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
29 SkBitmap* result, SkIPoint* offset) const overrid
e; | 29 SkBitmap* result, SkIPoint* offset) const override; |
30 #if SK_SUPPORT_GPU | 30 #if SK_SUPPORT_GPU |
31 virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const Sk
Matrix&, | 31 bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&, |
32 const SkIRect& bounds) const override; | 32 const SkIRect& bounds) const override; |
33 #endif | 33 #endif |
34 | 34 |
35 private: | 35 private: |
36 SkRegion fRegion; | 36 SkRegion fRegion; |
37 SkScalar fInnerThreshold; | 37 SkScalar fInnerThreshold; |
38 SkScalar fOuterThreshold; | 38 SkScalar fOuterThreshold; |
39 typedef SkImageFilter INHERITED; | 39 typedef SkImageFilter INHERITED; |
40 }; | 40 }; |
41 | 41 |
42 SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region, | 42 SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region, |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 381 } |
382 | 382 |
383 #ifndef SK_IGNORE_TO_STRING | 383 #ifndef SK_IGNORE_TO_STRING |
384 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 384 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
385 str->appendf("SkAlphaThresholdImageFilter: ("); | 385 str->appendf("SkAlphaThresholdImageFilter: ("); |
386 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 386 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
387 str->append(")"); | 387 str->append(")"); |
388 } | 388 } |
389 #endif | 389 #endif |
390 | 390 |
OLD | NEW |