| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { | 271 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { |
| 272 maskDesc.fConfig = kAlpha_8_GrPixelConfig; | 272 maskDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 273 } else { | 273 } else { |
| 274 maskDesc.fConfig = kRGBA_8888_GrPixelConfig; | 274 maskDesc.fConfig = kRGBA_8888_GrPixelConfig; |
| 275 } | 275 } |
| 276 maskDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 276 maskDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 277 // Add one pixel of border to ensure that clamp mode will be all zeros | 277 // Add one pixel of border to ensure that clamp mode will be all zeros |
| 278 // the outside. | 278 // the outside. |
| 279 maskDesc.fWidth = texture->width(); | 279 maskDesc.fWidth = texture->width(); |
| 280 maskDesc.fHeight = texture->height(); | 280 maskDesc.fHeight = texture->height(); |
| 281 SkAutoTUnref<GrTexture> maskTexture( | 281 SkAutoTUnref<GrTexture> maskTexture(context->textureProvider()->refScrat
chTexture( |
| 282 context->refScratchTexture(maskDesc, GrContext::kApprox_ScratchTexMa
tch)); | 282 maskDesc, GrTextureProvider::kApprox_ScratchTexMatch)); |
| 283 if (!maskTexture) { | 283 if (!maskTexture) { |
| 284 return false; | 284 return false; |
| 285 } | 285 } |
| 286 | 286 |
| 287 { | 287 { |
| 288 GrPaint grPaint; | 288 GrPaint grPaint; |
| 289 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 289 grPaint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| 290 SkRegion::Iterator iter(fRegion); | 290 SkRegion::Iterator iter(fRegion); |
| 291 context->clear(NULL, 0x0, true, maskTexture->asRenderTarget()); | 291 context->clear(NULL, 0x0, true, maskTexture->asRenderTarget()); |
| 292 | 292 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 } | 377 } |
| 378 | 378 |
| 379 #ifndef SK_IGNORE_TO_STRING | 379 #ifndef SK_IGNORE_TO_STRING |
| 380 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 380 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
| 381 str->appendf("SkAlphaThresholdImageFilter: ("); | 381 str->appendf("SkAlphaThresholdImageFilter: ("); |
| 382 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 382 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
| 383 str->append(")"); | 383 str->append(")"); |
| 384 } | 384 } |
| 385 #endif | 385 #endif |
| 386 | 386 |
| OLD | NEW |