| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrBezierEffect.h" | 8 #include "GrBezierEffect.h" |
| 9 | 9 |
| 10 #include "glsl/GrGLSLGeometryProcessor.h" | 10 #include "glsl/GrGLSLGeometryProcessor.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 key |= 0xff != ce.coverageScale() ? 0x8 : 0x0; | 175 key |= 0xff != ce.coverageScale() ? 0x8 : 0x0; |
| 176 key |= ce.usesLocalCoords() && ce.localMatrix().hasPerspective() ? 0x10 : 0x
0; | 176 key |= ce.usesLocalCoords() && ce.localMatrix().hasPerspective() ? 0x10 : 0x
0; |
| 177 key |= ComputePosKey(ce.viewMatrix()) << 5; | 177 key |= ComputePosKey(ce.viewMatrix()) << 5; |
| 178 b->add32(key); | 178 b->add32(key); |
| 179 } | 179 } |
| 180 | 180 |
| 181 ////////////////////////////////////////////////////////////////////////////// | 181 ////////////////////////////////////////////////////////////////////////////// |
| 182 | 182 |
| 183 GrConicEffect::~GrConicEffect() {} | 183 GrConicEffect::~GrConicEffect() {} |
| 184 | 184 |
| 185 void GrConicEffect::getGLProcessorKey(const GrGLSLCaps& caps, | 185 void GrConicEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, |
| 186 GrProcessorKeyBuilder* b) const { | 186 GrProcessorKeyBuilder* b) const { |
| 187 GrGLConicEffect::GenKey(*this, caps, b); | 187 GrGLConicEffect::GenKey(*this, caps, b); |
| 188 } | 188 } |
| 189 | 189 |
| 190 GrGLSLPrimitiveProcessor* GrConicEffect::createGLInstance(const GrGLSLCaps&) con
st { | 190 GrGLSLPrimitiveProcessor* GrConicEffect::createGLSLInstance(const GrGLSLCaps&) c
onst { |
| 191 return new GrGLConicEffect(*this); | 191 return new GrGLConicEffect(*this); |
| 192 } | 192 } |
| 193 | 193 |
| 194 GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
coverage, | 194 GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t
coverage, |
| 195 GrPrimitiveEdgeType edgeType, const SkMatrix& local
Matrix, | 195 GrPrimitiveEdgeType edgeType, const SkMatrix& local
Matrix, |
| 196 bool usesLocalCoords) | 196 bool usesLocalCoords) |
| 197 : fColor(color) | 197 : fColor(color) |
| 198 , fViewMatrix(viewMatrix) | 198 , fViewMatrix(viewMatrix) |
| 199 , fLocalMatrix(viewMatrix) | 199 , fLocalMatrix(viewMatrix) |
| 200 , fUsesLocalCoords(usesLocalCoords) | 200 , fUsesLocalCoords(usesLocalCoords) |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 key |= ce.coverageScale() != 0xff ? 0x8 : 0x0; | 376 key |= ce.coverageScale() != 0xff ? 0x8 : 0x0; |
| 377 key |= ce.usesLocalCoords() && ce.localMatrix().hasPerspective() ? 0x10 : 0x
0; | 377 key |= ce.usesLocalCoords() && ce.localMatrix().hasPerspective() ? 0x10 : 0x
0; |
| 378 key |= ComputePosKey(ce.viewMatrix()) << 5; | 378 key |= ComputePosKey(ce.viewMatrix()) << 5; |
| 379 b->add32(key); | 379 b->add32(key); |
| 380 } | 380 } |
| 381 | 381 |
| 382 ////////////////////////////////////////////////////////////////////////////// | 382 ////////////////////////////////////////////////////////////////////////////// |
| 383 | 383 |
| 384 GrQuadEffect::~GrQuadEffect() {} | 384 GrQuadEffect::~GrQuadEffect() {} |
| 385 | 385 |
| 386 void GrQuadEffect::getGLProcessorKey(const GrGLSLCaps& caps, | 386 void GrQuadEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, |
| 387 GrProcessorKeyBuilder* b) const { | 387 GrProcessorKeyBuilder* b) const { |
| 388 GrGLQuadEffect::GenKey(*this, caps, b); | 388 GrGLQuadEffect::GenKey(*this, caps, b); |
| 389 } | 389 } |
| 390 | 390 |
| 391 GrGLSLPrimitiveProcessor* GrQuadEffect::createGLInstance(const GrGLSLCaps&) cons
t { | 391 GrGLSLPrimitiveProcessor* GrQuadEffect::createGLSLInstance(const GrGLSLCaps&) co
nst { |
| 392 return new GrGLQuadEffect(*this); | 392 return new GrGLQuadEffect(*this); |
| 393 } | 393 } |
| 394 | 394 |
| 395 GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
verage, | 395 GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co
verage, |
| 396 GrPrimitiveEdgeType edgeType, const SkMatrix& localMa
trix, | 396 GrPrimitiveEdgeType edgeType, const SkMatrix& localMa
trix, |
| 397 bool usesLocalCoords) | 397 bool usesLocalCoords) |
| 398 : fColor(color) | 398 : fColor(color) |
| 399 , fViewMatrix(viewMatrix) | 399 , fViewMatrix(viewMatrix) |
| 400 , fLocalMatrix(localMatrix) | 400 , fLocalMatrix(localMatrix) |
| 401 , fUsesLocalCoords(usesLocalCoords) | 401 , fUsesLocalCoords(usesLocalCoords) |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; | 593 uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; |
| 594 key |= ce.color() != GrColor_ILLEGAL ? 0x4 : 0x8; | 594 key |= ce.color() != GrColor_ILLEGAL ? 0x4 : 0x8; |
| 595 key |= ComputePosKey(ce.viewMatrix()) << 5; | 595 key |= ComputePosKey(ce.viewMatrix()) << 5; |
| 596 b->add32(key); | 596 b->add32(key); |
| 597 } | 597 } |
| 598 | 598 |
| 599 ////////////////////////////////////////////////////////////////////////////// | 599 ////////////////////////////////////////////////////////////////////////////// |
| 600 | 600 |
| 601 GrCubicEffect::~GrCubicEffect() {} | 601 GrCubicEffect::~GrCubicEffect() {} |
| 602 | 602 |
| 603 void GrCubicEffect::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuil
der* b) const { | 603 void GrCubicEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBu
ilder* b) const { |
| 604 GrGLCubicEffect::GenKey(*this, caps, b); | 604 GrGLCubicEffect::GenKey(*this, caps, b); |
| 605 } | 605 } |
| 606 | 606 |
| 607 GrGLSLPrimitiveProcessor* GrCubicEffect::createGLInstance(const GrGLSLCaps&) con
st { | 607 GrGLSLPrimitiveProcessor* GrCubicEffect::createGLSLInstance(const GrGLSLCaps&) c
onst { |
| 608 return new GrGLCubicEffect(*this); | 608 return new GrGLCubicEffect(*this); |
| 609 } | 609 } |
| 610 | 610 |
| 611 GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, | 611 GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, |
| 612 GrPrimitiveEdgeType edgeType) | 612 GrPrimitiveEdgeType edgeType) |
| 613 : fColor(color) | 613 : fColor(color) |
| 614 , fViewMatrix(viewMatrix) | 614 , fViewMatrix(viewMatrix) |
| 615 , fEdgeType(edgeType) { | 615 , fEdgeType(edgeType) { |
| 616 this->initClassID<GrCubicEffect>(); | 616 this->initClassID<GrCubicEffect>(); |
| 617 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, | 617 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 629 do { | 629 do { |
| 630 GrPrimitiveEdgeType edgeType = | 630 GrPrimitiveEdgeType edgeType = |
| 631 static_cast<GrPrimitiveEdgeType>( | 631 static_cast<GrPrimitiveEdgeType>( |
| 632 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); | 632 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
| 633 gp = GrCubicEffect::Create(GrRandomColor(d->fRandom), | 633 gp = GrCubicEffect::Create(GrRandomColor(d->fRandom), |
| 634 GrTest::TestMatrix(d->fRandom), edgeType, *d-
>fCaps); | 634 GrTest::TestMatrix(d->fRandom), edgeType, *d-
>fCaps); |
| 635 } while (nullptr == gp); | 635 } while (nullptr == gp); |
| 636 return gp; | 636 return gp; |
| 637 } | 637 } |
| 638 | 638 |
| OLD | NEW |