| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 264 } |
| 265 | 265 |
| 266 #if SK_SUPPORT_GPU | 266 #if SK_SUPPORT_GPU |
| 267 bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp, | 267 bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp, |
| 268 GrTexture* texture, | 268 GrTexture* texture, |
| 269 const SkMatrix& in_matrix, | 269 const SkMatrix& in_matrix, |
| 270 const SkIRect&) const { | 270 const SkIRect&) const { |
| 271 if (fp) { | 271 if (fp) { |
| 272 GrContext* context = texture->getContext(); | 272 GrContext* context = texture->getContext(); |
| 273 GrSurfaceDesc maskDesc; | 273 GrSurfaceDesc maskDesc; |
| 274 if (context->isConfigRenderable(kAlpha_8_GrPixelConfig, false)) { | 274 if (context->caps()->isConfigRenderable(kAlpha_8_GrPixelConfig, false))
{ |
| 275 maskDesc.fConfig = kAlpha_8_GrPixelConfig; | 275 maskDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 276 } else { | 276 } else { |
| 277 maskDesc.fConfig = kRGBA_8888_GrPixelConfig; | 277 maskDesc.fConfig = kRGBA_8888_GrPixelConfig; |
| 278 } | 278 } |
| 279 maskDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 279 maskDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 280 // Add one pixel of border to ensure that clamp mode will be all zeros | 280 // Add one pixel of border to ensure that clamp mode will be all zeros |
| 281 // the outside. | 281 // the outside. |
| 282 maskDesc.fWidth = texture->width(); | 282 maskDesc.fWidth = texture->width(); |
| 283 maskDesc.fHeight = texture->height(); | 283 maskDesc.fHeight = texture->height(); |
| 284 SkAutoTUnref<GrTexture> maskTexture(context->textureProvider()->refScrat
chTexture( | 284 SkAutoTUnref<GrTexture> maskTexture(context->textureProvider()->refScrat
chTexture( |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 } | 381 } |
| 382 | 382 |
| 383 #ifndef SK_IGNORE_TO_STRING | 383 #ifndef SK_IGNORE_TO_STRING |
| 384 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 384 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
| 385 str->appendf("SkAlphaThresholdImageFilter: ("); | 385 str->appendf("SkAlphaThresholdImageFilter: ("); |
| 386 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 386 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
| 387 str->append(")"); | 387 str->append(")"); |
| 388 } | 388 } |
| 389 #endif | 389 #endif |
| 390 | 390 |
| OLD | NEW |