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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // Add one pixel of border to ensure that clamp mode will be all zeros | 270 // Add one pixel of border to ensure that clamp mode will be all zeros |
271 // the outside. | 271 // the outside. |
272 maskDesc.fWidth = texture->width(); | 272 maskDesc.fWidth = texture->width(); |
273 maskDesc.fHeight = texture->height(); | 273 maskDesc.fHeight = texture->height(); |
274 SkAutoTUnref<GrTexture> maskTexture( | 274 SkAutoTUnref<GrTexture> maskTexture( |
275 context->textureProvider()->createApproxTexture(maskDesc)); | 275 context->textureProvider()->createApproxTexture(maskDesc)); |
276 if (!maskTexture) { | 276 if (!maskTexture) { |
277 return false; | 277 return false; |
278 } | 278 } |
279 | 279 |
280 GrDrawContext* drawContext = context->drawContext(); | 280 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext()); |
281 if (drawContext) { | 281 if (drawContext) { |
282 GrPaint grPaint; | 282 GrPaint grPaint; |
283 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 283 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
284 SkRegion::Iterator iter(fRegion); | 284 SkRegion::Iterator iter(fRegion); |
285 drawContext->clear(maskTexture->asRenderTarget(), nullptr, 0x0, true
); | 285 drawContext->clear(maskTexture->asRenderTarget(), nullptr, 0x0, true
); |
286 | 286 |
287 while (!iter.done()) { | 287 while (!iter.done()) { |
288 SkRect rect = SkRect::Make(iter.rect()); | 288 SkRect rect = SkRect::Make(iter.rect()); |
289 drawContext->drawRect(maskTexture->asRenderTarget(), GrClip::Wid
eOpen(), grPaint, | 289 drawContext->drawRect(maskTexture->asRenderTarget(), GrClip::Wid
eOpen(), grPaint, |
290 in_matrix, rect); | 290 in_matrix, rect); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 372 } |
373 | 373 |
374 #ifndef SK_IGNORE_TO_STRING | 374 #ifndef SK_IGNORE_TO_STRING |
375 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 375 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
376 str->appendf("SkAlphaThresholdImageFilter: ("); | 376 str->appendf("SkAlphaThresholdImageFilter: ("); |
377 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 377 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
378 str->append(")"); | 378 str->append(")"); |
379 } | 379 } |
380 #endif | 380 #endif |
381 | 381 |
OLD | NEW |