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 "SkBitmapAlphaThresholdShader.h" | 8 #include "SkBitmapAlphaThresholdShader.h" |
9 | 9 |
10 class BATShader : public SkShader { | 10 class BATShader : public SkShader { |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 GrAutoScratchTexture ast(context, maskDesc, GrContext::kApprox_ScratchTexMat
ch); | 234 GrAutoScratchTexture ast(context, maskDesc, GrContext::kApprox_ScratchTexMat
ch); |
235 GrTexture* maskTexture = ast.texture(); | 235 GrTexture* maskTexture = ast.texture(); |
236 if (NULL == maskTexture) { | 236 if (NULL == maskTexture) { |
237 return NULL; | 237 return NULL; |
238 } | 238 } |
239 | 239 |
240 GrPaint grPaint; | 240 GrPaint grPaint; |
241 grPaint.setBlendFunc(kOne_GrBlendCoeff, kZero_GrBlendCoeff); | 241 grPaint.setBlendFunc(kOne_GrBlendCoeff, kZero_GrBlendCoeff); |
242 SkRegion::Iterator iter(fRegion); | 242 SkRegion::Iterator iter(fRegion); |
243 context->setRenderTarget(maskTexture->asRenderTarget()); | 243 context->setRenderTarget(maskTexture->asRenderTarget()); |
244 context->clear(NULL, 0x0); | 244 context->clear(NULL, 0x0, true); |
245 | 245 |
246 // offset to ensure border is zero on top/left | 246 // offset to ensure border is zero on top/left |
247 SkMatrix matrix; | 247 SkMatrix matrix; |
248 matrix.setTranslate(SK_Scalar1, SK_Scalar1); | 248 matrix.setTranslate(SK_Scalar1, SK_Scalar1); |
249 context->setMatrix(matrix); | 249 context->setMatrix(matrix); |
250 | 250 |
251 while (!iter.done()) { | 251 while (!iter.done()) { |
252 SkRect rect = SkRect::MakeFromIRect(iter.rect()); | 252 SkRect rect = SkRect::MakeFromIRect(iter.rect()); |
253 context->drawRect(grPaint, rect); | 253 context->drawRect(grPaint, rect); |
254 iter.next(); | 254 iter.next(); |
(...skipping 15 matching lines...) Expand all Loading... |
270 GrEffectRef* effect = ThresholdEffect::Create(bmpTexture, bmpMatrix, | 270 GrEffectRef* effect = ThresholdEffect::Create(bmpTexture, bmpMatrix, |
271 maskTexture, maskMatrix, | 271 maskTexture, maskMatrix, |
272 fThreshold); | 272 fThreshold); |
273 | 273 |
274 GrUnlockAndUnrefCachedBitmapTexture(bmpTexture); | 274 GrUnlockAndUnrefCachedBitmapTexture(bmpTexture); |
275 | 275 |
276 return effect; | 276 return effect; |
277 } | 277 } |
278 | 278 |
279 #endif | 279 #endif |
OLD | NEW |