| 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 |
| 11 #include "GrContext.h" | 11 #include "GrContext.h" |
| 12 #include "GrDrawState.h" | 12 #include "GrDrawState.h" |
| 13 #include "GrDrawTargetCaps.h" | 13 #include "GrDrawTargetCaps.h" |
| 14 #include "GrEffect.h" | 14 #include "GrEffect.h" |
| 15 #include "GrPathUtils.h" | 15 #include "GrPathUtils.h" |
| 16 #include "GrTBackendEffectFactory.h" | 16 #include "GrTBackendEffectFactory.h" |
| 17 #include "SkString.h" | 17 #include "SkString.h" |
| 18 #include "SkStrokeRec.h" | 18 #include "SkStrokeRec.h" |
| 19 #include "SkTrace.h" | 19 #include "SkTrace.h" |
| 20 | 20 |
| 21 #include "gl/GrGLEffect.h" | 21 #include "gl/GrGLEffect.h" |
| 22 #include "gl/GrGLSL.h" | 22 #include "gl/GrGLSL.h" |
| 23 | 23 |
| 24 #include "effects/GrVertexEffect.h" |
| 25 |
| 24 GrAAConvexPathRenderer::GrAAConvexPathRenderer() { | 26 GrAAConvexPathRenderer::GrAAConvexPathRenderer() { |
| 25 } | 27 } |
| 26 | 28 |
| 27 struct Segment { | 29 struct Segment { |
| 28 enum { | 30 enum { |
| 29 // These enum values are assumed in member functions below. | 31 // These enum values are assumed in member functions below. |
| 30 kLine = 0, | 32 kLine = 0, |
| 31 kQuad = 1, | 33 kQuad = 1, |
| 32 } fType; | 34 } fType; |
| 33 | 35 |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 /* | 492 /* |
| 491 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first | 493 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first |
| 492 * two components of the vertex attribute. Coverage is based on signed | 494 * two components of the vertex attribute. Coverage is based on signed |
| 493 * distance with negative being inside, positive outside. The edge is specified
in | 495 * distance with negative being inside, positive outside. The edge is specified
in |
| 494 * window space (y-down). If either the third or fourth component of the interpo
lated | 496 * window space (y-down). If either the third or fourth component of the interpo
lated |
| 495 * vertex coord is > 0 then the pixel is considered outside the edge. This is us
ed to | 497 * vertex coord is > 0 then the pixel is considered outside the edge. This is us
ed to |
| 496 * attempt to trim to a portion of the infinite quad. | 498 * attempt to trim to a portion of the infinite quad. |
| 497 * Requires shader derivative instruction support. | 499 * Requires shader derivative instruction support. |
| 498 */ | 500 */ |
| 499 | 501 |
| 500 class QuadEdgeEffect : public GrEffect { | 502 class QuadEdgeEffect : public GrVertexEffect { |
| 501 public: | 503 public: |
| 502 | 504 |
| 503 static GrEffectRef* Create() { | 505 static GrEffectRef* Create() { |
| 504 GR_CREATE_STATIC_EFFECT(gQuadEdgeEffect, QuadEdgeEffect, ()); | 506 GR_CREATE_STATIC_EFFECT(gQuadEdgeEffect, QuadEdgeEffect, ()); |
| 505 gQuadEdgeEffect->ref(); | 507 gQuadEdgeEffect->ref(); |
| 506 return gQuadEdgeEffect; | 508 return gQuadEdgeEffect; |
| 507 } | 509 } |
| 508 | 510 |
| 509 virtual ~QuadEdgeEffect() {} | 511 virtual ~QuadEdgeEffect() {} |
| 510 | 512 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 QuadEdgeEffect() { | 581 QuadEdgeEffect() { |
| 580 this->addVertexAttrib(kVec4f_GrSLType); | 582 this->addVertexAttrib(kVec4f_GrSLType); |
| 581 } | 583 } |
| 582 | 584 |
| 583 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { | 585 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { |
| 584 return true; | 586 return true; |
| 585 } | 587 } |
| 586 | 588 |
| 587 GR_DECLARE_EFFECT_TEST; | 589 GR_DECLARE_EFFECT_TEST; |
| 588 | 590 |
| 589 typedef GrEffect INHERITED; | 591 typedef GrVertexEffect INHERITED; |
| 590 }; | 592 }; |
| 591 | 593 |
| 592 GR_DEFINE_EFFECT_TEST(QuadEdgeEffect); | 594 GR_DEFINE_EFFECT_TEST(QuadEdgeEffect); |
| 593 | 595 |
| 594 GrEffectRef* QuadEdgeEffect::TestCreate(SkRandom* random, | 596 GrEffectRef* QuadEdgeEffect::TestCreate(SkRandom* random, |
| 595 GrContext*, | 597 GrContext*, |
| 596 const GrDrawTargetCaps& caps, | 598 const GrDrawTargetCaps& caps, |
| 597 GrTexture*[]) { | 599 GrTexture*[]) { |
| 598 // Doesn't work without derivative instructions. | 600 // Doesn't work without derivative instructions. |
| 599 return caps.shaderDerivativeSupport() ? QuadEdgeEffect::Create() : NULL; | 601 return caps.shaderDerivativeSupport() ? QuadEdgeEffect::Create() : NULL; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 vOffset, // start vertex | 706 vOffset, // start vertex |
| 705 0, // start index | 707 0, // start index |
| 706 draw.fVertexCnt, | 708 draw.fVertexCnt, |
| 707 draw.fIndexCnt, | 709 draw.fIndexCnt, |
| 708 &devBounds); | 710 &devBounds); |
| 709 vOffset += draw.fVertexCnt; | 711 vOffset += draw.fVertexCnt; |
| 710 } | 712 } |
| 711 | 713 |
| 712 return true; | 714 return true; |
| 713 } | 715 } |
| OLD | NEW |