| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 sk_sp<GrTexture> SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* contex
t, | 95 sk_sp<GrTexture> SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* contex
t, |
| 96 const SkMatrix& i
nMatrix, | 96 const SkMatrix& i
nMatrix, |
| 97 const SkIRect& bo
unds) const { | 97 const SkIRect& bo
unds) const { |
| 98 GrPixelConfig config; | 98 GrPixelConfig config; |
| 99 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { | 99 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { |
| 100 config = kAlpha_8_GrPixelConfig; | 100 config = kAlpha_8_GrPixelConfig; |
| 101 } else { | 101 } else { |
| 102 config = kRGBA_8888_GrPixelConfig; | 102 config = kRGBA_8888_GrPixelConfig; |
| 103 } | 103 } |
| 104 | 104 |
| 105 sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoose_B
ackingFit, | 105 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr
ox, |
| 106 bounds.width(), bou
nds.height(), | 106 bounds.width(), bou
nds.height(), |
| 107 config)); | 107 config)); |
| 108 if (!drawContext) { | 108 if (!drawContext) { |
| 109 return nullptr; | 109 return nullptr; |
| 110 } | 110 } |
| 111 | 111 |
| 112 GrPaint grPaint; | 112 GrPaint grPaint; |
| 113 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 113 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| 114 SkRegion::Iterator iter(fRegion); | 114 SkRegion::Iterator iter(fRegion); |
| 115 drawContext->clear(nullptr, 0x0, true); | 115 drawContext->clear(nullptr, 0x0, true); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 dst); | 259 dst); |
| 260 } | 260 } |
| 261 | 261 |
| 262 #ifndef SK_IGNORE_TO_STRING | 262 #ifndef SK_IGNORE_TO_STRING |
| 263 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 263 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
| 264 str->appendf("SkAlphaThresholdImageFilter: ("); | 264 str->appendf("SkAlphaThresholdImageFilter: ("); |
| 265 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 265 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
| 266 str->append(")"); | 266 str->append(")"); |
| 267 } | 267 } |
| 268 #endif | 268 #endif |
| OLD | NEW |