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