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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 class GrGLAlphaThresholdEffect; | 54 class GrGLAlphaThresholdEffect; |
55 | 55 |
56 class AlphaThresholdEffect : public GrEffect { | 56 class AlphaThresholdEffect : public GrEffect { |
57 | 57 |
58 public: | 58 public: |
59 static GrEffectRef* Create(GrTexture* texture, | 59 static GrEffectRef* Create(GrTexture* texture, |
60 GrTexture* maskTexture, | 60 GrTexture* maskTexture, |
61 float innerThreshold, | 61 float innerThreshold, |
62 float outerThreshold) { | 62 float outerThreshold) { |
63 AutoEffectUnref effect(SkNEW_ARGS(AlphaThresholdEffect, (texture, | 63 return SkNEW_ARGS(AlphaThresholdEffect, (texture, |
64 maskTexture, | 64 maskTexture, |
65 innerThreshold, | 65 innerThreshold, |
66 outerThreshold)
)); | 66 outerThreshold)); |
67 return CreateEffectRef(effect); | |
68 } | 67 } |
69 | 68 |
70 virtual ~AlphaThresholdEffect() {}; | 69 virtual ~AlphaThresholdEffect() {}; |
71 | 70 |
72 static const char* Name() { return "Alpha Threshold"; } | 71 static const char* Name() { return "Alpha Threshold"; } |
73 | 72 |
74 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; | 73 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
75 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; | 74 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; |
76 | 75 |
77 float innerThreshold() const { return fInnerThreshold; } | 76 float innerThreshold() const { return fInnerThreshold; } |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 (U8CPU)(SkColorGetG(source) *
scale), | 356 (U8CPU)(SkColorGetG(source) *
scale), |
358 (U8CPU)(SkColorGetB(source) *
scale)); | 357 (U8CPU)(SkColorGetB(source) *
scale)); |
359 } | 358 } |
360 } | 359 } |
361 dptr[y * dst->width() + x] = output_color; | 360 dptr[y * dst->width() + x] = output_color; |
362 } | 361 } |
363 } | 362 } |
364 | 363 |
365 return true; | 364 return true; |
366 } | 365 } |
OLD | NEW |