OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" | 9 #include "GrAAHairLinePathRenderer.h" |
10 | 10 |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 * The output of this effect is a hairline edge for quadratics. | 501 * The output of this effect is a hairline edge for quadratics. |
502 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first | 502 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first |
503 * two components of the vertex attribute. Uses unsigned distance. | 503 * two components of the vertex attribute. Uses unsigned distance. |
504 * Coverage is min(0, 1-distance). 3rd & 4th component unused. | 504 * Coverage is min(0, 1-distance). 3rd & 4th component unused. |
505 * Requires shader derivative instruction support. | 505 * Requires shader derivative instruction support. |
506 */ | 506 */ |
507 class HairQuadEdgeEffect : public GrEffect { | 507 class HairQuadEdgeEffect : public GrEffect { |
508 public: | 508 public: |
509 | 509 |
510 static GrEffectRef* Create() { | 510 static GrEffectRef* Create() { |
511 // we go through this so we only have one copy of each effect | 511 GR_CREATE_STATIC_EFFECT(gHairQuadEdgeEffect, HairQuadEdgeEffect, ()); |
512 static SkAutoTUnref<GrEffectRef> gHairQuadEdgeEffectRef( | 512 gHairQuadEdgeEffect->ref(); |
513 CreateEffectRef(AutoEffectUnref(SkNEW(HairQuadEdgeEffec
t)))); | 513 return gHairQuadEdgeEffect; |
514 | |
515 gHairQuadEdgeEffectRef.get()->ref(); | |
516 return gHairQuadEdgeEffectRef; | |
517 } | 514 } |
518 | 515 |
519 virtual ~HairQuadEdgeEffect() {} | 516 virtual ~HairQuadEdgeEffect() {} |
520 | 517 |
521 static const char* Name() { return "HairQuadEdge"; } | 518 static const char* Name() { return "HairQuadEdge"; } |
522 | 519 |
523 virtual void getConstantColorComponents(GrColor* color, | 520 virtual void getConstantColorComponents(GrColor* color, |
524 uint32_t* validFlags) const SK_OVERR
IDE { | 521 uint32_t* validFlags) const SK_OVERR
IDE { |
525 *validFlags = 0; | 522 *validFlags = 0; |
526 } | 523 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 /////////////////////////////////////////////////////////////////////////////// | 599 /////////////////////////////////////////////////////////////////////////////// |
603 | 600 |
604 /** | 601 /** |
605 * The output of this effect is a 1-pixel wide line. | 602 * The output of this effect is a 1-pixel wide line. |
606 * Input is 2D implicit device coord line eq (a*x + b*y +c = 0). 4th component u
nused. | 603 * Input is 2D implicit device coord line eq (a*x + b*y +c = 0). 4th component u
nused. |
607 */ | 604 */ |
608 class HairLineEdgeEffect : public GrEffect { | 605 class HairLineEdgeEffect : public GrEffect { |
609 public: | 606 public: |
610 | 607 |
611 static GrEffectRef* Create() { | 608 static GrEffectRef* Create() { |
612 // we go through this so we only have one copy of each effect | 609 GR_CREATE_STATIC_EFFECT(gHairLineEdge, HairLineEdgeEffect, ()); |
613 static SkAutoTUnref<GrEffectRef> gHairLineEdgeEffectRef( | 610 gHairLineEdge->ref(); |
614 CreateEffectRef(AutoEffectUnref(SkNEW(HairLineEdgeEf
fect)))); | 611 return gHairLineEdge; |
615 | |
616 gHairLineEdgeEffectRef.get()->ref(); | |
617 return gHairLineEdgeEffectRef; | |
618 } | 612 } |
619 | 613 |
620 virtual ~HairLineEdgeEffect() {} | 614 virtual ~HairLineEdgeEffect() {} |
621 | 615 |
622 static const char* Name() { return "HairLineEdge"; } | 616 static const char* Name() { return "HairLineEdge"; } |
623 | 617 |
624 virtual void getConstantColorComponents(GrColor* color, | 618 virtual void getConstantColorComponents(GrColor* color, |
625 uint32_t* validFlags) const SK_OVERR
IDE { | 619 uint32_t* validFlags) const SK_OVERR
IDE { |
626 *validFlags = 0; | 620 *validFlags = 0; |
627 } | 621 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 4 * lineCnt + kVertsPerQuad*quads, // startV | 838 4 * lineCnt + kVertsPerQuad*quads, // startV |
845 0, // startI | 839 0, // startI |
846 kVertsPerQuad*n, // vCount | 840 kVertsPerQuad*n, // vCount |
847 kIdxsPerQuad*n); // iCount | 841 kIdxsPerQuad*n); // iCount |
848 quads += n; | 842 quads += n; |
849 } | 843 } |
850 target->resetIndexSource(); | 844 target->resetIndexSource(); |
851 | 845 |
852 return true; | 846 return true; |
853 } | 847 } |
OLD | NEW |