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 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 maskDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 104 maskDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
105 // Add one pixel of border to ensure that clamp mode will be all zeros | 105 // Add one pixel of border to ensure that clamp mode will be all zeros |
106 // the outside. | 106 // the outside. |
107 maskDesc.fWidth = bounds.width(); | 107 maskDesc.fWidth = bounds.width(); |
108 maskDesc.fHeight = bounds.height(); | 108 maskDesc.fHeight = bounds.height(); |
109 sk_sp<GrTexture> maskTexture(context->textureProvider()->createApproxTexture
(maskDesc)); | 109 sk_sp<GrTexture> maskTexture(context->textureProvider()->createApproxTexture
(maskDesc)); |
110 if (!maskTexture) { | 110 if (!maskTexture) { |
111 return nullptr; | 111 return nullptr; |
112 } | 112 } |
113 | 113 |
114 sk_sp<GrDrawContext> drawContext(context->drawContext(maskTexture->asRenderT
arget())); | 114 sk_sp<GrDrawContext> drawContext( |
| 115 context->drawContext(sk_ref_sp(maskTexture->asRe
nderTarget()))); |
115 if (!drawContext) { | 116 if (!drawContext) { |
116 return nullptr; | 117 return nullptr; |
117 } | 118 } |
118 | 119 |
119 GrPaint grPaint; | 120 GrPaint grPaint; |
120 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 121 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
121 SkRegion::Iterator iter(fRegion); | 122 SkRegion::Iterator iter(fRegion); |
122 drawContext->clear(nullptr, 0x0, true); | 123 drawContext->clear(nullptr, 0x0, true); |
123 | 124 |
124 GrClip clip(SkRect::Make(SkIRect::MakeWH(bounds.width(), bounds.height()))); | 125 GrClip clip(SkRect::Make(SkIRect::MakeWH(bounds.width(), bounds.height()))); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 dst); | 267 dst); |
267 } | 268 } |
268 | 269 |
269 #ifndef SK_IGNORE_TO_STRING | 270 #ifndef SK_IGNORE_TO_STRING |
270 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 271 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
271 str->appendf("SkAlphaThresholdImageFilter: ("); | 272 str->appendf("SkAlphaThresholdImageFilter: ("); |
272 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 273 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
273 str->append(")"); | 274 str->append(")"); |
274 } | 275 } |
275 #endif | 276 #endif |
OLD | NEW |