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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 GrTextureAccess fMaskAccess; | 228 GrTextureAccess fMaskAccess; |
229 | 229 |
230 SkMatrix fBmpMatrix; | 230 SkMatrix fBmpMatrix; |
231 SkMatrix fMaskMatrix; | 231 SkMatrix fMaskMatrix; |
232 | 232 |
233 SkScalar fThreshold; | 233 SkScalar fThreshold; |
234 }; | 234 }; |
235 | 235 |
236 GR_DEFINE_EFFECT_TEST(ThresholdEffect); | 236 GR_DEFINE_EFFECT_TEST(ThresholdEffect); |
237 | 237 |
238 GrEffectRef* ThresholdEffect::TestCreate(SkMWCRandom* rand, | 238 GrEffectRef* ThresholdEffect::TestCreate(SkRandom* rand, |
239 GrContext*, | 239 GrContext*, |
240 const GrDrawTargetCaps&, | 240 const GrDrawTargetCaps&, |
241 GrTexture* textures[]) { | 241 GrTexture* textures[]) { |
242 GrTexture* bmpTex = textures[GrEffectUnitTest::kSkiaPMTextureIdx]; | 242 GrTexture* bmpTex = textures[GrEffectUnitTest::kSkiaPMTextureIdx]; |
243 GrTexture* maskTex = textures[GrEffectUnitTest::kAlphaTextureIdx]; | 243 GrTexture* maskTex = textures[GrEffectUnitTest::kAlphaTextureIdx]; |
244 U8CPU thresh = rand->nextU() % 0xff; | 244 U8CPU thresh = rand->nextU() % 0xff; |
245 return ThresholdEffect::Create(bmpTex, SkMatrix::I(), maskTex, SkMatrix::I()
, thresh); | 245 return ThresholdEffect::Create(bmpTex, SkMatrix::I(), maskTex, SkMatrix::I()
, thresh); |
246 } | 246 } |
247 | 247 |
248 GrEffectRef* BATShader::asNewEffect(GrContext* context, const SkPaint& paint) co
nst { | 248 GrEffectRef* BATShader::asNewEffect(GrContext* context, const SkPaint& paint) co
nst { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 GrEffectRef* effect = ThresholdEffect::Create(bmpTexture, bmpMatrix, | 302 GrEffectRef* effect = ThresholdEffect::Create(bmpTexture, bmpMatrix, |
303 maskTexture, maskMatrix, | 303 maskTexture, maskMatrix, |
304 fThreshold); | 304 fThreshold); |
305 | 305 |
306 GrUnlockAndUnrefCachedBitmapTexture(bmpTexture); | 306 GrUnlockAndUnrefCachedBitmapTexture(bmpTexture); |
307 | 307 |
308 return effect; | 308 return effect; |
309 } | 309 } |
310 | 310 |
311 #endif | 311 #endif |
OLD | NEW |