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 { |
11 public: | 11 public: |
12 SK_DECLARE_INST_COUNT(SkThresholdShader); | 12 SK_DECLARE_INST_COUNT(BATShader); |
13 | 13 |
14 BATShader(const SkBitmap& bitmap, SkRegion region, U8CPU); | 14 BATShader(const SkBitmap& bitmap, SkRegion region, U8CPU); |
15 BATShader(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) { | 15 BATShader(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) { |
16 // We should probably do something here. | 16 // We should probably do something here. |
17 } | 17 } |
18 | 18 |
19 | 19 |
20 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE {}; | 20 virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE {}; |
21 | 21 |
22 #if SK_SUPPORT_GPU | 22 #if SK_SUPPORT_GPU |
23 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint& paint) c
onst SK_OVERRIDE; | 23 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint& paint) c
onst SK_OVERRIDE; |
24 #endif | 24 #endif |
25 | 25 |
26 SK_DEVELOPER_TO_STRING(); | 26 SK_DEVELOPER_TO_STRING(); |
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 |
37 SkShader* SkBitmapAlphaThresholdShader::Create(const SkBitmap& bitmap, | 39 SkShader* SkBitmapAlphaThresholdShader::Create(const SkBitmap& bitmap, |
38 const SkRegion& region, | 40 const SkRegion& region, |
39 U8CPU threshold) { | 41 U8CPU threshold) { |
40 SkASSERT(threshold < 256); | 42 SkASSERT(threshold < 256); |
41 return SkNEW_ARGS(BATShader, (bitmap, region, threshold)); | 43 return SkNEW_ARGS(BATShader, (bitmap, region, threshold)); |
42 } | 44 } |
43 | 45 |
44 BATShader::BATShader(const SkBitmap& bitmap, SkRegion region, U8CPU threshold) | 46 BATShader::BATShader(const SkBitmap& bitmap, SkRegion region, U8CPU threshold) |
45 : fBitmap(bitmap) | 47 : fBitmap(bitmap) |
46 , fRegion(region) | 48 , fRegion(region) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 GrEffectRef* effect = ThresholdEffect::Create(bmpTexture, bmpMatrix, | 270 GrEffectRef* effect = ThresholdEffect::Create(bmpTexture, bmpMatrix, |
269 maskTexture, maskMatrix, | 271 maskTexture, maskMatrix, |
270 fThreshold); | 272 fThreshold); |
271 | 273 |
272 GrUnlockAndUnrefCachedBitmapTexture(bmpTexture); | 274 GrUnlockAndUnrefCachedBitmapTexture(bmpTexture); |
273 | 275 |
274 return effect; | 276 return effect; |
275 } | 277 } |
276 | 278 |
277 #endif | 279 #endif |
OLD | NEW |