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

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

Issue 371103003: Remove GrEffect::CreateEffectRef and GrEffect::AutoEffectRef. (Closed) Base URL: https://skia.googlesource.com/skia.git@no_ref2
Patch Set: Address comments and update for new YUV effect 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/effects/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBlurMaskFilter.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 "SkArithmeticMode.h" 8 #include "SkArithmeticMode.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 typedef GrGLEffect INHERITED; 258 typedef GrGLEffect INHERITED;
259 }; 259 };
260 260
261 /////////////////////////////////////////////////////////////////////////////// 261 ///////////////////////////////////////////////////////////////////////////////
262 262
263 class GrArithmeticEffect : public GrEffect { 263 class GrArithmeticEffect : public GrEffect {
264 public: 264 public:
265 static GrEffectRef* Create(float k1, float k2, float k3, float k4, bool enfo rcePMColor, 265 static GrEffectRef* Create(float k1, float k2, float k3, float k4, bool enfo rcePMColor,
266 GrTexture* background) { 266 GrTexture* background) {
267 AutoEffectUnref effect(SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, e nforcePMColor, 267 return SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, enforcePMColor, b ackground));
268 background)));
269 return CreateEffectRef(effect);
270 } 268 }
271 269
272 virtual ~GrArithmeticEffect(); 270 virtual ~GrArithmeticEffect();
273 271
274 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; 272 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
275 273
276 typedef GrGLArithmeticEffect GLEffect; 274 typedef GrGLArithmeticEffect GLEffect;
277 static const char* Name() { return "Arithmetic"; } 275 static const char* Name() { return "Arithmetic"; }
278 GrTexture* backgroundTexture() const { return fBackgroundAccess.getTexture() ; } 276 GrTexture* backgroundTexture() const { return fBackgroundAccess.getTexture() ; }
279 277
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 GrEffectRef* GrArithmeticEffect::TestCreate(SkRandom* rand, 413 GrEffectRef* GrArithmeticEffect::TestCreate(SkRandom* rand,
416 GrContext*, 414 GrContext*,
417 const GrDrawTargetCaps&, 415 const GrDrawTargetCaps&,
418 GrTexture*[]) { 416 GrTexture*[]) {
419 float k1 = rand->nextF(); 417 float k1 = rand->nextF();
420 float k2 = rand->nextF(); 418 float k2 = rand->nextF();
421 float k3 = rand->nextF(); 419 float k3 = rand->nextF();
422 float k4 = rand->nextF(); 420 float k4 = rand->nextF();
423 bool enforcePMColor = rand->nextBool(); 421 bool enforcePMColor = rand->nextBool();
424 422
425 AutoEffectUnref gEffect(SkNEW_ARGS(GrArithmeticEffect, 423 return SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, enforcePMColor, NULL) );
426 (k1, k2, k3, k4, enforcePMColor, NULL)));
427 return CreateEffectRef(gEffect);
428 } 424 }
429 425
430 GR_DEFINE_EFFECT_TEST(GrArithmeticEffect); 426 GR_DEFINE_EFFECT_TEST(GrArithmeticEffect);
431 427
432 bool SkArithmeticMode_scalar::asNewEffect(GrEffectRef** effect, GrTexture* backg round) const { 428 bool SkArithmeticMode_scalar::asNewEffect(GrEffectRef** effect, GrTexture* backg round) const {
433 if (effect) { 429 if (effect) {
434 *effect = GrArithmeticEffect::Create(SkScalarToFloat(fK[0]), 430 *effect = GrArithmeticEffect::Create(SkScalarToFloat(fK[0]),
435 SkScalarToFloat(fK[1]), 431 SkScalarToFloat(fK[1]),
436 SkScalarToFloat(fK[2]), 432 SkScalarToFloat(fK[2]),
437 SkScalarToFloat(fK[3]), 433 SkScalarToFloat(fK[3]),
438 fEnforcePMColor, 434 fEnforcePMColor,
439 background); 435 background);
440 } 436 }
441 return true; 437 return true;
442 } 438 }
443 439
444 #endif 440 #endif
445 441
446 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 442 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
447 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 443 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
448 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 444 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698