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" |
(...skipping 10 matching lines...) Expand all Loading... |
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 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 28 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
29 SkBitmap* result, SkIPoint* offset) const override; | 29 SkBitmap* result, SkIPoint* offset) const override; |
30 #if SK_SUPPORT_GPU | 30 #if SK_SUPPORT_GPU |
31 bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&, | 31 bool asFragmentProcessor(GrFragmentProcessor**, GrShaderDataManager*, GrText
ure*, |
32 const SkIRect& bounds) const override; | 32 const SkMatrix&, const SkIRect& bounds) const overr
ide; |
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 SkScalar outerThreshold, | 258 SkScalar outerThreshold, |
259 SkImageFilter* input) | 259 SkImageFilter* input) |
260 : INHERITED(1, &input) | 260 : INHERITED(1, &input) |
261 , fRegion(region) | 261 , fRegion(region) |
262 , fInnerThreshold(innerThreshold) | 262 , fInnerThreshold(innerThreshold) |
263 , fOuterThreshold(outerThreshold) { | 263 , fOuterThreshold(outerThreshold) { |
264 } | 264 } |
265 | 265 |
266 #if SK_SUPPORT_GPU | 266 #if SK_SUPPORT_GPU |
267 bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp, | 267 bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp, |
| 268 GrShaderDataManager*, |
268 GrTexture* texture, | 269 GrTexture* texture, |
269 const SkMatrix& in_matrix, | 270 const SkMatrix& in_matrix, |
270 const SkIRect&) const { | 271 const SkIRect&) const { |
271 if (fp) { | 272 if (fp) { |
272 GrContext* context = texture->getContext(); | 273 GrContext* context = texture->getContext(); |
273 GrSurfaceDesc maskDesc; | 274 GrSurfaceDesc maskDesc; |
274 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false))
{ | 275 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false))
{ |
275 maskDesc.fConfig = kAlpha_8_GrPixelConfig; | 276 maskDesc.fConfig = kAlpha_8_GrPixelConfig; |
276 } else { | 277 } else { |
277 maskDesc.fConfig = kRGBA_8888_GrPixelConfig; | 278 maskDesc.fConfig = kRGBA_8888_GrPixelConfig; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 382 } |
382 | 383 |
383 #ifndef SK_IGNORE_TO_STRING | 384 #ifndef SK_IGNORE_TO_STRING |
384 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 385 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
385 str->appendf("SkAlphaThresholdImageFilter: ("); | 386 str->appendf("SkAlphaThresholdImageFilter: ("); |
386 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 387 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
387 str->append(")"); | 388 str->append(")"); |
388 } | 389 } |
389 #endif | 390 #endif |
390 | 391 |
OLD | NEW |