OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkLinearGradient.h" | 8 #include "SkLinearGradient.h" |
9 | 9 |
10 static inline int repeat_bits(int x, const int bits) { | 10 static inline int repeat_bits(int x, const int bits) { |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 const SkLinearGradient& shader, | 488 const SkLinearGradient& shader, |
489 const SkMatrix& matrix, | 489 const SkMatrix& matrix, |
490 SkShader::TileMode tm) { | 490 SkShader::TileMode tm) { |
491 return SkNEW_ARGS(GrLinearGradient, (ctx, procDataManager, shader, matri
x, tm)); | 491 return SkNEW_ARGS(GrLinearGradient, (ctx, procDataManager, shader, matri
x, tm)); |
492 } | 492 } |
493 | 493 |
494 virtual ~GrLinearGradient() { } | 494 virtual ~GrLinearGradient() { } |
495 | 495 |
496 const char* name() const override { return "Linear Gradient"; } | 496 const char* name() const override { return "Linear Gradient"; } |
497 | 497 |
498 GrGLFragmentProcessor* createGLInstance() const override { | |
499 return SkNEW_ARGS(GrGLLinearGradient, (*this)); | |
500 } | |
501 | |
502 private: | 498 private: |
503 GrLinearGradient(GrContext* ctx, | 499 GrLinearGradient(GrContext* ctx, |
504 GrProcessorDataManager* procDataManager, | 500 GrProcessorDataManager* procDataManager, |
505 const SkLinearGradient& shader, | 501 const SkLinearGradient& shader, |
506 const SkMatrix& matrix, | 502 const SkMatrix& matrix, |
507 SkShader::TileMode tm) | 503 SkShader::TileMode tm) |
508 : INHERITED(ctx, procDataManager, shader, matrix, tm) { | 504 : INHERITED(ctx, procDataManager, shader, matrix, tm) { |
509 this->initClassID<GrLinearGradient>(); | 505 this->initClassID<GrLinearGradient>(); |
510 } | 506 } |
511 | 507 |
| 508 GrGLFragmentProcessor* onCreateGLInstance() const override { |
| 509 return SkNEW_ARGS(GrGLLinearGradient, (*this)); |
| 510 } |
| 511 |
512 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, | 512 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, |
513 GrProcessorKeyBuilder* b) const override { | 513 GrProcessorKeyBuilder* b) const override { |
514 GrGLLinearGradient::GenKey(*this, caps, b); | 514 GrGLLinearGradient::GenKey(*this, caps, b); |
515 } | 515 } |
516 | 516 |
517 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 517 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
518 | 518 |
519 typedef GrGradientEffect INHERITED; | 519 typedef GrGradientEffect INHERITED; |
520 }; | 520 }; |
521 | 521 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 str->append("SkLinearGradient ("); | 599 str->append("SkLinearGradient ("); |
600 | 600 |
601 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); | 601 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); |
602 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); | 602 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); |
603 | 603 |
604 this->INHERITED::toString(str); | 604 this->INHERITED::toString(str); |
605 | 605 |
606 str->append(")"); | 606 str->append(")"); |
607 } | 607 } |
608 #endif | 608 #endif |
OLD | NEW |