OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 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 | 9 |
10 | 10 |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 if (this->caps()->gpuTracingSupport()) { | 606 if (this->caps()->gpuTracingSupport()) { |
607 SkASSERT(fGpuTraceMarkerCount >= 1); | 607 SkASSERT(fGpuTraceMarkerCount >= 1); |
608 this->fActiveTraceMarkers.remove(*marker); | 608 this->fActiveTraceMarkers.remove(*marker); |
609 this->didRemoveGpuTraceMarker(); | 609 this->didRemoveGpuTraceMarker(); |
610 --fGpuTraceMarkerCount; | 610 --fGpuTraceMarkerCount; |
611 } | 611 } |
612 } | 612 } |
613 | 613 |
614 //////////////////////////////////////////////////////////////////////////////// | 614 //////////////////////////////////////////////////////////////////////////////// |
615 | 615 |
| 616 bool GrDrawTarget::willUseHWAALines() const { |
| 617 // There is a conflict between using smooth lines and our use of premultipli
ed alpha. Smooth |
| 618 // lines tweak the incoming alpha value but not in a premul-alpha way. So we
only use them when |
| 619 // our alpha is 0xff and tweaking the color for partial coverage is OK |
| 620 if (!this->caps()->hwAALineSupport() || |
| 621 !this->getDrawState().isHWAntialiasState()) { |
| 622 return false; |
| 623 } |
| 624 GrDrawState::BlendOptFlags opts = this->getDrawState().getBlendOpts(); |
| 625 return (GrDrawState::kDisableBlend_BlendOptFlag & opts) && |
| 626 (GrDrawState::kCoverageAsAlpha_BlendOptFlag & opts); |
| 627 } |
| 628 |
616 bool GrDrawTarget::canApplyCoverage() const { | 629 bool GrDrawTarget::canApplyCoverage() const { |
617 // we can correctly apply coverage if a) we have dual source blending | 630 // we can correctly apply coverage if a) we have dual source blending |
618 // or b) one of our blend optimizations applies | 631 // or b) one of our blend optimizations applies. |
619 // or c) the src/dst coefficients are 1, 0 respectively. | |
620 GrBlendCoeff srcCoeff; | |
621 GrBlendCoeff dstCoeff; | |
622 return this->caps()->dualSourceBlendingSupport() || | 632 return this->caps()->dualSourceBlendingSupport() || |
623 GrDrawState::kNone_BlendOpt != this->getDrawState().getBlendOpts(true
, &srcCoeff, | 633 GrDrawState::kNone_BlendOpt != this->getDrawState().getBlendOpts(true
); |
624 &dst
Coeff) || | |
625 (kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff); | |
626 } | 634 } |
627 | 635 |
628 //////////////////////////////////////////////////////////////////////////////// | 636 //////////////////////////////////////////////////////////////////////////////// |
629 | 637 |
630 void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type, | 638 void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type, |
631 int instanceCount, | 639 int instanceCount, |
632 int verticesPerInstance, | 640 int verticesPerInstance, |
633 int indicesPerInstance, | 641 int indicesPerInstance, |
634 const SkRect* devBounds) { | 642 const SkRect* devBounds) { |
635 if (!verticesPerInstance || !indicesPerInstance) { | 643 if (!verticesPerInstance || !indicesPerInstance) { |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 SkASSERT(!fConfigTextureSupport[kUnknown_GrPixelConfig]); | 1156 SkASSERT(!fConfigTextureSupport[kUnknown_GrPixelConfig]); |
1149 | 1157 |
1150 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { | 1158 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { |
1151 r.appendf("%s is uploadable to a texture: %s\n", | 1159 r.appendf("%s is uploadable to a texture: %s\n", |
1152 kConfigNames[i], | 1160 kConfigNames[i], |
1153 gNY[fConfigTextureSupport[i]]); | 1161 gNY[fConfigTextureSupport[i]]); |
1154 } | 1162 } |
1155 | 1163 |
1156 return r; | 1164 return r; |
1157 } | 1165 } |
OLD | NEW |