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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 SkAutoTUnref<GrTexture> maskTexture( | 305 SkAutoTUnref<GrTexture> maskTexture( |
306 context->textureProvider()->createApproxTexture(maskDesc)); | 306 context->textureProvider()->createApproxTexture(maskDesc)); |
307 if (!maskTexture) { | 307 if (!maskTexture) { |
308 return false; | 308 return false; |
309 } | 309 } |
310 | 310 |
311 SkAutoTUnref<GrDrawContext> drawContext( | 311 SkAutoTUnref<GrDrawContext> drawContext( |
312 context->drawContext(maskTexture->as RenderTarget())); | 312 context->drawContext(maskTexture->as RenderTarget())); |
313 if (drawContext) { | 313 if (drawContext) { |
314 GrPaint grPaint; | 314 GrPaint grPaint; |
315 // SRGBTODO: AllowSRGBInputs? | |
bsalomon
2016/04/05 13:24:00
Nah, this is really drawing a mask.
Brian Osman
2016/04/05 15:36:41
Acknowledged.
| |
315 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 316 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
316 SkRegion::Iterator iter(fRegion); | 317 SkRegion::Iterator iter(fRegion); |
317 drawContext->clear(nullptr, 0x0, true); | 318 drawContext->clear(nullptr, 0x0, true); |
318 | 319 |
319 GrClip clip(SkRect::Make(SkIRect::MakeWH(bounds.width(), bounds.heig ht()))); | 320 GrClip clip(SkRect::Make(SkIRect::MakeWH(bounds.width(), bounds.heig ht()))); |
320 while (!iter.done()) { | 321 while (!iter.done()) { |
321 SkRect rect = SkRect::Make(iter.rect()); | 322 SkRect rect = SkRect::Make(iter.rect()); |
322 drawContext->drawRect(clip, grPaint, inMatrix, rect); | 323 drawContext->drawRect(clip, grPaint, inMatrix, rect); |
323 iter.next(); | 324 iter.next(); |
324 } | 325 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 return true; | 406 return true; |
406 } | 407 } |
407 | 408 |
408 #ifndef SK_IGNORE_TO_STRING | 409 #ifndef SK_IGNORE_TO_STRING |
409 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 410 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
410 str->appendf("SkAlphaThresholdImageFilter: ("); | 411 str->appendf("SkAlphaThresholdImageFilter: ("); |
411 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 412 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
412 str->append(")"); | 413 str->append(")"); |
413 } | 414 } |
414 #endif | 415 #endif |
OLD | NEW |