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

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

Issue 31853003: Remove GrContext from SkXfermode::[Aa]sNewEffectOrCoeff() and all subclasses, (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkXfermode_proccoeff.h ('k') | src/effects/SkXfermodeImageFilter.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 "SkFlattenableBuffers.h" 10 #include "SkFlattenableBuffers.h"
(...skipping 18 matching lines...) Expand all
29 fK[3] = k4; 29 fK[3] = k4;
30 } 30 }
31 31
32 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, 32 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
33 const SkAlpha aa[]) const SK_OVERRIDE; 33 const SkAlpha aa[]) const SK_OVERRIDE;
34 34
35 SK_DEVELOPER_TO_STRING() 35 SK_DEVELOPER_TO_STRING()
36 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar) 36 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar)
37 37
38 #if SK_SUPPORT_GPU 38 #if SK_SUPPORT_GPU
39 virtual bool asNewEffectOrCoeff(GrContext*, GrEffectRef** effect, Coeff*, Co eff*, GrTexture* background) const SK_OVERRIDE; 39 virtual bool asNewEffectOrCoeff(GrEffectRef** effect, Coeff*, Coeff*, GrText ure* background) const SK_OVERRIDE;
40 #endif 40 #endif
41 41
42 private: 42 private:
43 SkArithmeticMode_scalar(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) { 43 SkArithmeticMode_scalar(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
44 fK[0] = buffer.readScalar(); 44 fK[0] = buffer.readScalar();
45 fK[1] = buffer.readScalar(); 45 fK[1] = buffer.readScalar();
46 fK[2] = buffer.readScalar(); 46 fK[2] = buffer.readScalar();
47 fK[3] = buffer.readScalar(); 47 fK[3] = buffer.readScalar();
48 } 48 }
49 49
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 float k2 = rand->nextF(); 401 float k2 = rand->nextF();
402 float k3 = rand->nextF(); 402 float k3 = rand->nextF();
403 float k4 = rand->nextF(); 403 float k4 = rand->nextF();
404 404
405 static AutoEffectUnref gEffect(SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k 4, NULL))); 405 static AutoEffectUnref gEffect(SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k 4, NULL)));
406 return CreateEffectRef(gEffect); 406 return CreateEffectRef(gEffect);
407 } 407 }
408 408
409 GR_DEFINE_EFFECT_TEST(GrArithmeticEffect); 409 GR_DEFINE_EFFECT_TEST(GrArithmeticEffect);
410 410
411 bool SkArithmeticMode_scalar::asNewEffectOrCoeff(GrContext*, 411 bool SkArithmeticMode_scalar::asNewEffectOrCoeff(GrEffectRef** effect,
412 GrEffectRef** effect,
413 Coeff*, 412 Coeff*,
414 Coeff*, 413 Coeff*,
415 GrTexture* background) const { 414 GrTexture* background) const {
416 if (effect) { 415 if (effect) {
417 *effect = GrArithmeticEffect::Create(SkScalarToFloat(fK[0]), 416 *effect = GrArithmeticEffect::Create(SkScalarToFloat(fK[0]),
418 SkScalarToFloat(fK[1]), 417 SkScalarToFloat(fK[1]),
419 SkScalarToFloat(fK[2]), 418 SkScalarToFloat(fK[2]),
420 SkScalarToFloat(fK[3]), 419 SkScalarToFloat(fK[3]),
421 background); 420 background);
422 } 421 }
423 return true; 422 return true;
424 } 423 }
425 424
426 #endif 425 #endif
427 426
428 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 427 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
429 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 428 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
430 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 429 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkXfermode_proccoeff.h ('k') | src/effects/SkXfermodeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698