OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAAConvexPathRenderer.h" | 9 #include "GrAAConvexPathRenderer.h" |
10 | 10 |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 * vertex coord is > 0 then the pixel is considered outside the edge. This is us
ed to | 444 * vertex coord is > 0 then the pixel is considered outside the edge. This is us
ed to |
445 * attempt to trim to a portion of the infinite quad. | 445 * attempt to trim to a portion of the infinite quad. |
446 * Requires shader derivative instruction support. | 446 * Requires shader derivative instruction support. |
447 */ | 447 */ |
448 | 448 |
449 class QuadEdgeEffect : public GrEffect { | 449 class QuadEdgeEffect : public GrEffect { |
450 public: | 450 public: |
451 | 451 |
452 static GrEffectRef* Create() { | 452 static GrEffectRef* Create() { |
453 // we go through this so we only have one copy of each effect | 453 // we go through this so we only have one copy of each effect |
454 static GrEffectRef* gQuadEdgeEffectRef = | 454 static SkAutoTUnref<GrEffectRef> gQuadEdgeEffectRef( |
455 CreateEffectRef(AutoEffectUnref(SkNEW(QuadEdgeEffect))); | 455 CreateEffectRef(AutoEffectUnref(SkNEW(QuadEdgeEffect)))); |
456 static SkAutoTUnref<GrEffectRef> gUnref(gQuadEdgeEffectRef); | |
457 | 456 |
458 gQuadEdgeEffectRef->ref(); | 457 gQuadEdgeEffectRef.get()->ref(); |
459 return gQuadEdgeEffectRef; | 458 return gQuadEdgeEffectRef; |
460 } | 459 } |
461 | 460 |
462 virtual ~QuadEdgeEffect() {} | 461 virtual ~QuadEdgeEffect() {} |
463 | 462 |
464 static const char* Name() { return "QuadEdge"; } | 463 static const char* Name() { return "QuadEdge"; } |
465 | 464 |
466 virtual void getConstantColorComponents(GrColor* color, | 465 virtual void getConstantColorComponents(GrColor* color, |
467 uint32_t* validFlags) const SK_OVERR
IDE { | 466 uint32_t* validFlags) const SK_OVERR
IDE { |
468 *validFlags = 0; | 467 *validFlags = 0; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 516 |
518 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { | 517 static inline EffectKey GenKey(const GrDrawEffect& drawEffect, const GrG
LCaps&) { |
519 return 0x0; | 518 return 0x0; |
520 } | 519 } |
521 | 520 |
522 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE {} | 521 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_
OVERRIDE {} |
523 | 522 |
524 private: | 523 private: |
525 typedef GrGLEffect INHERITED; | 524 typedef GrGLEffect INHERITED; |
526 }; | 525 }; |
527 | 526 |
528 private: | 527 private: |
529 QuadEdgeEffect() { | 528 QuadEdgeEffect() { |
530 this->addVertexAttrib(kVec4f_GrSLType); | 529 this->addVertexAttrib(kVec4f_GrSLType); |
531 } | 530 } |
532 | 531 |
533 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { | 532 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { |
534 return true; | 533 return true; |
535 } | 534 } |
536 | 535 |
537 GR_DECLARE_EFFECT_TEST; | 536 GR_DECLARE_EFFECT_TEST; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 create_vertices(segments, fanPt, verts, idxs); | 630 create_vertices(segments, fanPt, verts, idxs); |
632 | 631 |
633 target->drawIndexed(kTriangles_GrPrimitiveType, | 632 target->drawIndexed(kTriangles_GrPrimitiveType, |
634 0, // start vertex | 633 0, // start vertex |
635 0, // start index | 634 0, // start index |
636 vCount, | 635 vCount, |
637 iCount); | 636 iCount); |
638 | 637 |
639 return true; | 638 return true; |
640 } | 639 } |
OLD | NEW |