| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // we go through this so we only have one copy of each effect |
| 512 static GrEffectRef* gHairQuadEdgeEffectRef = | 512 static SkAutoTUnref<GrEffectRef> gHairQuadEdgeEffectRef( |
| 513 CreateEffectRef(AutoEffectUnref(SkNEW(HairQuadEdgeEffect))); | 513 CreateEffectRef(AutoEffectUnref(SkNEW(HairQuadEdgeEffec
t)))); |
| 514 static SkAutoTUnref<GrEffectRef> gUnref(gHairQuadEdgeEffectRef); | 514 |
| 515 | 515 gHairQuadEdgeEffectRef.get()->ref(); |
| 516 gHairQuadEdgeEffectRef->ref(); | |
| 517 return gHairQuadEdgeEffectRef; | 516 return gHairQuadEdgeEffectRef; |
| 518 } | 517 } |
| 519 | 518 |
| 520 virtual ~HairQuadEdgeEffect() {} | 519 virtual ~HairQuadEdgeEffect() {} |
| 521 | 520 |
| 522 static const char* Name() { return "HairQuadEdge"; } | 521 static const char* Name() { return "HairQuadEdge"; } |
| 523 | 522 |
| 524 virtual void getConstantColorComponents(GrColor* color, | 523 virtual void getConstantColorComponents(GrColor* color, |
| 525 uint32_t* validFlags) const SK_OVERR
IDE { | 524 uint32_t* validFlags) const SK_OVERR
IDE { |
| 526 *validFlags = 0; | 525 *validFlags = 0; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 603 |
| 605 /** | 604 /** |
| 606 * The output of this effect is a 1-pixel wide line. | 605 * The output of this effect is a 1-pixel wide line. |
| 607 * Input is 2D implicit device coord line eq (a*x + b*y +c = 0). 4th component u
nused. | 606 * Input is 2D implicit device coord line eq (a*x + b*y +c = 0). 4th component u
nused. |
| 608 */ | 607 */ |
| 609 class HairLineEdgeEffect : public GrEffect { | 608 class HairLineEdgeEffect : public GrEffect { |
| 610 public: | 609 public: |
| 611 | 610 |
| 612 static GrEffectRef* Create() { | 611 static GrEffectRef* Create() { |
| 613 // we go through this so we only have one copy of each effect | 612 // we go through this so we only have one copy of each effect |
| 614 static GrEffectRef* gHairLineEdgeEffectRef = | 613 static SkAutoTUnref<GrEffectRef> gHairLineEdgeEffectRef( |
| 615 CreateEffectRef(AutoEffectUnref(SkNEW(HairLineEdgeEffect))); | 614 CreateEffectRef(AutoEffectUnref(SkNEW(HairLineEdgeEf
fect)))); |
| 616 static SkAutoTUnref<GrEffectRef> gUnref(gHairLineEdgeEffectRef); | 615 |
| 617 | 616 gHairLineEdgeEffectRef.get()->ref(); |
| 618 gHairLineEdgeEffectRef->ref(); | |
| 619 return gHairLineEdgeEffectRef; | 617 return gHairLineEdgeEffectRef; |
| 620 } | 618 } |
| 621 | 619 |
| 622 virtual ~HairLineEdgeEffect() {} | 620 virtual ~HairLineEdgeEffect() {} |
| 623 | 621 |
| 624 static const char* Name() { return "HairLineEdge"; } | 622 static const char* Name() { return "HairLineEdge"; } |
| 625 | 623 |
| 626 virtual void getConstantColorComponents(GrColor* color, | 624 virtual void getConstantColorComponents(GrColor* color, |
| 627 uint32_t* validFlags) const SK_OVERR
IDE { | 625 uint32_t* validFlags) const SK_OVERR
IDE { |
| 628 *validFlags = 0; | 626 *validFlags = 0; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 target->drawIndexed(kTriangles_GrPrimitiveType, | 838 target->drawIndexed(kTriangles_GrPrimitiveType, |
| 841 4 * lineCnt + kVertsPerQuad*quads, // startV | 839 4 * lineCnt + kVertsPerQuad*quads, // startV |
| 842 0, // startI | 840 0, // startI |
| 843 kVertsPerQuad*n, // vCount | 841 kVertsPerQuad*n, // vCount |
| 844 kIdxsPerQuad*n); // iCount | 842 kIdxsPerQuad*n); // iCount |
| 845 quads += n; | 843 quads += n; |
| 846 } | 844 } |
| 847 | 845 |
| 848 return true; | 846 return true; |
| 849 } | 847 } |
| OLD | NEW |