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 "gl/GrGLProcessor.h" | 10 #include "gl/GrGLProcessor.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 void GrGLConicEffect::GenKey(const GrGeometryProcessor& processor, | 159 void GrGLConicEffect::GenKey(const GrGeometryProcessor& processor, |
160 const GrBatchTracker& bt, | 160 const GrBatchTracker& bt, |
161 const GrGLCaps&, | 161 const GrGLCaps&, |
162 GrProcessorKeyBuilder* b) { | 162 GrProcessorKeyBuilder* b) { |
163 const GrConicEffect& ce = processor.cast<GrConicEffect>(); | 163 const GrConicEffect& ce = processor.cast<GrConicEffect>(); |
164 const ConicBatchTracker& local = bt.cast<ConicBatchTracker>(); | 164 const ConicBatchTracker& local = bt.cast<ConicBatchTracker>(); |
165 uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; | 165 uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; |
166 key |= kUniform_GrGPInput == local.fInputColorType ? 0x4 : 0x0; | 166 key |= kUniform_GrGPInput == local.fInputColorType ? 0x4 : 0x0; |
167 key |= 0xff != local.fCoverageScale ? 0x8 : 0x0; | 167 key |= 0xff != local.fCoverageScale ? 0x8 : 0x0; |
| 168 key |= local.fUsesLocalCoords && processor.localMatrix().hasPerspective() ?
0x10 : 0x0; |
168 b->add32(key); | 169 b->add32(key); |
169 } | 170 } |
170 | 171 |
171 ////////////////////////////////////////////////////////////////////////////// | 172 ////////////////////////////////////////////////////////////////////////////// |
172 | 173 |
173 GrConicEffect::~GrConicEffect() {} | 174 GrConicEffect::~GrConicEffect() {} |
174 | 175 |
175 void GrConicEffect::getGLProcessorKey(const GrBatchTracker& bt, | 176 void GrConicEffect::getGLProcessorKey(const GrBatchTracker& bt, |
176 const GrGLCaps& caps, | 177 const GrGLCaps& caps, |
177 GrProcessorKeyBuilder* b) const { | 178 GrProcessorKeyBuilder* b) const { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 368 |
368 void GrGLQuadEffect::GenKey(const GrGeometryProcessor& processor, | 369 void GrGLQuadEffect::GenKey(const GrGeometryProcessor& processor, |
369 const GrBatchTracker& bt, | 370 const GrBatchTracker& bt, |
370 const GrGLCaps&, | 371 const GrGLCaps&, |
371 GrProcessorKeyBuilder* b) { | 372 GrProcessorKeyBuilder* b) { |
372 const GrQuadEffect& ce = processor.cast<GrQuadEffect>(); | 373 const GrQuadEffect& ce = processor.cast<GrQuadEffect>(); |
373 const QuadBatchTracker& local = bt.cast<QuadBatchTracker>(); | 374 const QuadBatchTracker& local = bt.cast<QuadBatchTracker>(); |
374 uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; | 375 uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; |
375 key |= kUniform_GrGPInput == local.fInputColorType ? 0x4 : 0x0; | 376 key |= kUniform_GrGPInput == local.fInputColorType ? 0x4 : 0x0; |
376 key |= 0xff != local.fCoverageScale ? 0x8 : 0x0; | 377 key |= 0xff != local.fCoverageScale ? 0x8 : 0x0; |
| 378 key |= local.fUsesLocalCoords && processor.localMatrix().hasPerspective() ?
0x10 : 0x0; |
377 b->add32(key); | 379 b->add32(key); |
378 } | 380 } |
379 | 381 |
380 ////////////////////////////////////////////////////////////////////////////// | 382 ////////////////////////////////////////////////////////////////////////////// |
381 | 383 |
382 GrQuadEffect::~GrQuadEffect() {} | 384 GrQuadEffect::~GrQuadEffect() {} |
383 | 385 |
384 void GrQuadEffect::getGLProcessorKey(const GrBatchTracker& bt, | 386 void GrQuadEffect::getGLProcessorKey(const GrBatchTracker& bt, |
385 const GrGLCaps& caps, | 387 const GrGLCaps& caps, |
386 GrProcessorKeyBuilder* b) const { | 388 GrProcessorKeyBuilder* b) const { |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 } | 600 } |
599 | 601 |
600 void GrGLCubicEffect::GenKey(const GrGeometryProcessor& processor, | 602 void GrGLCubicEffect::GenKey(const GrGeometryProcessor& processor, |
601 const GrBatchTracker& bt, | 603 const GrBatchTracker& bt, |
602 const GrGLCaps&, | 604 const GrGLCaps&, |
603 GrProcessorKeyBuilder* b) { | 605 GrProcessorKeyBuilder* b) { |
604 const GrCubicEffect& ce = processor.cast<GrCubicEffect>(); | 606 const GrCubicEffect& ce = processor.cast<GrCubicEffect>(); |
605 const CubicBatchTracker& local = bt.cast<CubicBatchTracker>(); | 607 const CubicBatchTracker& local = bt.cast<CubicBatchTracker>(); |
606 uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; | 608 uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; |
607 key |= kUniform_GrGPInput == local.fInputColorType ? 0x4 : 0x8; | 609 key |= kUniform_GrGPInput == local.fInputColorType ? 0x4 : 0x8; |
| 610 key |= local.fUsesLocalCoords && processor.localMatrix().hasPerspective() ?
0x10 : 0x0; |
608 b->add32(key); | 611 b->add32(key); |
609 } | 612 } |
610 | 613 |
611 ////////////////////////////////////////////////////////////////////////////// | 614 ////////////////////////////////////////////////////////////////////////////// |
612 | 615 |
613 GrCubicEffect::~GrCubicEffect() {} | 616 GrCubicEffect::~GrCubicEffect() {} |
614 | 617 |
615 void GrCubicEffect::getGLProcessorKey(const GrBatchTracker& bt, | 618 void GrCubicEffect::getGLProcessorKey(const GrBatchTracker& bt, |
616 const GrGLCaps& caps, | 619 const GrGLCaps& caps, |
617 GrProcessorKeyBuilder* b) const { | 620 GrProcessorKeyBuilder* b) const { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 GrTexture*[]) { | 665 GrTexture*[]) { |
663 GrGeometryProcessor* gp; | 666 GrGeometryProcessor* gp; |
664 do { | 667 do { |
665 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 668 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
666 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); | 669 random->nextULessThan(kGrPro
cessorEdgeTypeCnt)); |
667 gp = GrCubicEffect::Create(GrRandomColor(random), edgeType, caps); | 670 gp = GrCubicEffect::Create(GrRandomColor(random), edgeType, caps); |
668 } while (NULL == gp); | 671 } while (NULL == gp); |
669 return gp; | 672 return gp; |
670 } | 673 } |
671 | 674 |
OLD | NEW |