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 16 matching lines...) Expand all Loading... |
27 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(BATShader) | 27 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(BATShader) |
28 | 28 |
29 private: | 29 private: |
30 SkBitmap fBitmap; | 30 SkBitmap fBitmap; |
31 SkRegion fRegion; | 31 SkRegion fRegion; |
32 U8CPU fThreshold; | 32 U8CPU fThreshold; |
33 | 33 |
34 typedef SkShader INHERITED; | 34 typedef SkShader INHERITED; |
35 }; | 35 }; |
36 | 36 |
37 SK_DEFINE_INST_COUNT(BATShader) | |
38 | |
39 SkShader* SkBitmapAlphaThresholdShader::Create(const SkBitmap& bitmap, | 37 SkShader* SkBitmapAlphaThresholdShader::Create(const SkBitmap& bitmap, |
40 const SkRegion& region, | 38 const SkRegion& region, |
41 U8CPU threshold) { | 39 U8CPU threshold) { |
42 SkASSERT(threshold < 256); | 40 SkASSERT(threshold < 256); |
43 return SkNEW_ARGS(BATShader, (bitmap, region, threshold)); | 41 return SkNEW_ARGS(BATShader, (bitmap, region, threshold)); |
44 } | 42 } |
45 | 43 |
46 BATShader::BATShader(const SkBitmap& bitmap, SkRegion region, U8CPU threshold) | 44 BATShader::BATShader(const SkBitmap& bitmap, SkRegion region, U8CPU threshold) |
47 : fBitmap(bitmap) | 45 : fBitmap(bitmap) |
48 , fRegion(region) | 46 , fRegion(region) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 GrEffectRef* effect = ThresholdEffect::Create(bmpTexture, bmpMatrix, | 268 GrEffectRef* effect = ThresholdEffect::Create(bmpTexture, bmpMatrix, |
271 maskTexture, maskMatrix, | 269 maskTexture, maskMatrix, |
272 fThreshold); | 270 fThreshold); |
273 | 271 |
274 GrUnlockAndUnrefCachedBitmapTexture(bmpTexture); | 272 GrUnlockAndUnrefCachedBitmapTexture(bmpTexture); |
275 | 273 |
276 return effect; | 274 return effect; |
277 } | 275 } |
278 | 276 |
279 #endif | 277 #endif |
OLD | NEW |