Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: src/gpu/GrDrawTarget.cpp

Issue 446953002: Add an opaqueness hint to GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@greg
Patch Set: Address comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "GrDrawTarget.h" 11 #include "GrDrawTarget.h"
12 #include "GrContext.h" 12 #include "GrContext.h"
13 #include "GrDrawTargetCaps.h" 13 #include "GrDrawTargetCaps.h"
14 #include "GrPath.h" 14 #include "GrPath.h"
15 #include "GrRenderTarget.h" 15 #include "GrRenderTarget.h"
16 #include "GrTemplates.h"
16 #include "GrTexture.h" 17 #include "GrTexture.h"
17 #include "GrVertexBuffer.h" 18 #include "GrVertexBuffer.h"
18 19
19 #include "SkStrokeRec.h" 20 #include "SkStrokeRec.h"
20 21
21 //////////////////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////////////////
22 23
23 GrDrawTarget::DrawInfo& GrDrawTarget::DrawInfo::operator =(const DrawInfo& di) { 24 GrDrawTarget::DrawInfo& GrDrawTarget::DrawInfo::operator =(const DrawInfo& di) {
24 fPrimitiveType = di.fPrimitiveType; 25 fPrimitiveType = di.fPrimitiveType;
25 fStartVertex = di.fStartVertex; 26 fStartVertex = di.fStartVertex;
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 if (this->caps()->gpuTracingSupport()) { 607 if (this->caps()->gpuTracingSupport()) {
607 SkASSERT(fGpuTraceMarkerCount >= 1); 608 SkASSERT(fGpuTraceMarkerCount >= 1);
608 this->fActiveTraceMarkers.remove(*marker); 609 this->fActiveTraceMarkers.remove(*marker);
609 this->didRemoveGpuTraceMarker(); 610 this->didRemoveGpuTraceMarker();
610 --fGpuTraceMarkerCount; 611 --fGpuTraceMarkerCount;
611 } 612 }
612 } 613 }
613 614
614 //////////////////////////////////////////////////////////////////////////////// 615 ////////////////////////////////////////////////////////////////////////////////
615 616
616 bool GrDrawTarget::canApplyCoverage() const {
617 // we can correctly apply coverage if a) we have dual source blending
618 // or b) one of our blend optimizations applies
619 // or c) the src, dst blend coeffs are 1,0 and we will read Dst Color
620 GrBlendCoeff srcCoeff;
621 GrBlendCoeff dstCoeff;
622 GrDrawState::BlendOptFlags flag = this->getDrawState().getBlendOpts(true, &s rcCoeff, &dstCoeff);
623 return this->caps()->dualSourceBlendingSupport() ||
624 GrDrawState::kNone_BlendOpt != flag ||
625 (this->getDrawState().willEffectReadDstColor() &&
626 kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff);
627 }
628
629 ////////////////////////////////////////////////////////////////////////////////
630
631 void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type, 617 void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type,
632 int instanceCount, 618 int instanceCount,
633 int verticesPerInstance, 619 int verticesPerInstance,
634 int indicesPerInstance, 620 int indicesPerInstance,
635 const SkRect* devBounds) { 621 const SkRect* devBounds) {
636 if (!verticesPerInstance || !indicesPerInstance) { 622 if (!verticesPerInstance || !indicesPerInstance) {
637 return; 623 return;
638 } 624 }
639 625
640 int maxInstancesPerDraw = this->indexCountInCurrentSource() / indicesPerInst ance; 626 int maxInstancesPerDraw = this->indexCountInCurrentSource() / indicesPerInst ance;
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 SkASSERT(!fConfigTextureSupport[kUnknown_GrPixelConfig]); 1132 SkASSERT(!fConfigTextureSupport[kUnknown_GrPixelConfig]);
1147 1133
1148 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) { 1134 for (size_t i = 1; i < SK_ARRAY_COUNT(kConfigNames); ++i) {
1149 r.appendf("%s is uploadable to a texture: %s\n", 1135 r.appendf("%s is uploadable to a texture: %s\n",
1150 kConfigNames[i], 1136 kConfigNames[i],
1151 gNY[fConfigTextureSupport[i]]); 1137 gNY[fConfigTextureSupport[i]]);
1152 } 1138 }
1153 1139
1154 return r; 1140 return r;
1155 } 1141 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698