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 "SkAlphaThresholdFilterImpl.h" | |
9 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
10 #include "SkDevice.h" | 11 #include "SkDevice.h" |
11 #include "SkReadBuffer.h" | 12 #include "SkReadBuffer.h" |
12 #include "SkWriteBuffer.h" | 13 #include "SkWriteBuffer.h" |
13 #include "SkRegion.h" | 14 #include "SkRegion.h" |
14 #if SK_SUPPORT_GPU | 15 #if SK_SUPPORT_GPU |
15 #include "GrDrawContext.h" | 16 #include "GrDrawContext.h" |
16 #endif | 17 #endif |
17 | 18 |
18 class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter { | |
mtklein
2015/12/07 16:47:10
Why can't this stay here in the .cpp file? Seems
| |
19 public: | |
20 SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, | |
21 SkScalar outerThreshold, SkImageFilter* input); | |
22 | |
23 SK_TO_STRING_OVERRIDE() | |
24 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterIm pl) | |
25 | |
26 protected: | |
27 void flatten(SkWriteBuffer&) const override; | |
28 | |
29 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | |
30 SkBitmap* result, SkIPoint* offset) const override; | |
31 #if SK_SUPPORT_GPU | |
32 bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&, | |
33 const SkIRect& bounds) const override; | |
34 #endif | |
35 | |
36 private: | |
37 SkRegion fRegion; | |
38 SkScalar fInnerThreshold; | |
39 SkScalar fOuterThreshold; | |
40 typedef SkImageFilter INHERITED; | |
41 }; | |
42 | |
43 SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region, | 19 SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region, |
44 SkScalar innerThreshold, | 20 SkScalar innerThreshold, |
45 SkScalar outerThreshold, | 21 SkScalar outerThreshold, |
46 SkImageFilter* input) { | 22 SkImageFilter* input) { |
47 return new SkAlphaThresholdFilterImpl(region, innerThreshold, outerThreshold , input); | 23 return new SkAlphaThresholdFilterImpl(region, innerThreshold, outerThreshold , input); |
48 } | 24 } |
49 | 25 |
50 #if SK_SUPPORT_GPU | 26 #if SK_SUPPORT_GPU |
51 #include "GrContext.h" | 27 #include "GrContext.h" |
52 #include "GrCoordTransform.h" | 28 #include "GrCoordTransform.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 } | 347 } |
372 | 348 |
373 #ifndef SK_IGNORE_TO_STRING | 349 #ifndef SK_IGNORE_TO_STRING |
374 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 350 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
375 str->appendf("SkAlphaThresholdImageFilter: ("); | 351 str->appendf("SkAlphaThresholdImageFilter: ("); |
376 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 352 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
377 str->append(")"); | 353 str->append(")"); |
378 } | 354 } |
379 #endif | 355 #endif |
380 | 356 |
OLD | NEW |