Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/effects/SkAlphaThresholdFilter.cpp

Issue 374923002: Goodbye GrEffectRef. (Closed) Base URL: https://skia.googlesource.com/skia.git@noref3
Patch Set: Address comments Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "GrTBackendEffectFactory.h" 49 #include "GrTBackendEffectFactory.h"
50 #include "GrTextureAccess.h" 50 #include "GrTextureAccess.h"
51 51
52 #include "SkGr.h" 52 #include "SkGr.h"
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 GrEffect* Create(GrTexture* texture,
60 GrTexture* maskTexture, 60 GrTexture* maskTexture,
61 float innerThreshold, 61 float innerThreshold,
62 float outerThreshold) { 62 float outerThreshold) {
63 return SkNEW_ARGS(AlphaThresholdEffect, (texture, 63 return SkNEW_ARGS(AlphaThresholdEffect, (texture,
64 maskTexture, 64 maskTexture,
65 innerThreshold, 65 innerThreshold,
66 outerThreshold)); 66 outerThreshold));
67 } 67 }
68 68
69 virtual ~AlphaThresholdEffect() {}; 69 virtual ~AlphaThresholdEffect() {};
70 70
71 static const char* Name() { return "Alpha Threshold"; } 71 static const char* Name() { return "Alpha Threshold"; }
72 72
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 const AlphaThresholdEffect& alpha_threshold = 188 const AlphaThresholdEffect& alpha_threshold =
189 drawEffect.castEffect<AlphaThresholdEffect>(); 189 drawEffect.castEffect<AlphaThresholdEffect>();
190 uman.set1f(fInnerThresholdVar, alpha_threshold.innerThreshold()); 190 uman.set1f(fInnerThresholdVar, alpha_threshold.innerThreshold());
191 uman.set1f(fOuterThresholdVar, alpha_threshold.outerThreshold()); 191 uman.set1f(fOuterThresholdVar, alpha_threshold.outerThreshold());
192 } 192 }
193 193
194 ///////////////////////////////////////////////////////////////////// 194 /////////////////////////////////////////////////////////////////////
195 195
196 GR_DEFINE_EFFECT_TEST(AlphaThresholdEffect); 196 GR_DEFINE_EFFECT_TEST(AlphaThresholdEffect);
197 197
198 GrEffectRef* AlphaThresholdEffect::TestCreate(SkRandom* random, 198 GrEffect* AlphaThresholdEffect::TestCreate(SkRandom* random,
199 GrContext* context, 199 GrContext* context,
200 const GrDrawTargetCaps&, 200 const GrDrawTargetCaps&,
201 GrTexture** textures) { 201 GrTexture** textures) {
202 GrTexture* bmpTex = textures[GrEffectUnitTest::kSkiaPMTextureIdx]; 202 GrTexture* bmpTex = textures[GrEffectUnitTest::kSkiaPMTextureIdx];
203 GrTexture* maskTex = textures[GrEffectUnitTest::kAlphaTextureIdx]; 203 GrTexture* maskTex = textures[GrEffectUnitTest::kAlphaTextureIdx];
204 float inner_thresh = random->nextUScalar1(); 204 float inner_thresh = random->nextUScalar1();
205 float outer_thresh = random->nextUScalar1(); 205 float outer_thresh = random->nextUScalar1();
206 return AlphaThresholdEffect::Create(bmpTex, maskTex, inner_thresh, outer_thr esh); 206 return AlphaThresholdEffect::Create(bmpTex, maskTex, inner_thresh, outer_thr esh);
207 } 207 }
208 208
209 /////////////////////////////////////////////////////////////////////////////// 209 ///////////////////////////////////////////////////////////////////////////////
210 210
211 const GrBackendEffectFactory& AlphaThresholdEffect::getFactory() const { 211 const GrBackendEffectFactory& AlphaThresholdEffect::getFactory() const {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 (U8CPU)(SkColorGetG(source) * scale), 356 (U8CPU)(SkColorGetG(source) * scale),
357 (U8CPU)(SkColorGetB(source) * scale)); 357 (U8CPU)(SkColorGetB(source) * scale));
358 } 358 }
359 } 359 }
360 dptr[y * dst->width() + x] = output_color; 360 dptr[y * dst->width() + x] = output_color;
361 } 361 }
362 } 362 }
363 363
364 return true; 364 return true;
365 } 365 }
OLDNEW
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698