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

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

Issue 23137022: Replace uses of GR_DEBUG by SK_DEBUG. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: not GR_RELEASE Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrDrawTarget.h » ('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 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "GrDrawState.h" 8 #include "GrDrawState.h"
9 #include "GrPaint.h" 9 #include "GrPaint.h"
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 this->setBlendFunc(paint.getSrcBlendCoeff(), paint.getDstBlendCoeff()); 61 this->setBlendFunc(paint.getSrcBlendCoeff(), paint.getDstBlendCoeff());
62 this->setColorFilter(paint.getColorFilterColor(), paint.getColorFilterMode() ); 62 this->setColorFilter(paint.getColorFilterColor(), paint.getColorFilterMode() );
63 this->setCoverage(paint.getCoverage()); 63 this->setCoverage(paint.getCoverage());
64 } 64 }
65 65
66 //////////////////////////////////////////////////////////////////////////////// 66 ////////////////////////////////////////////////////////////////////////////////
67 67
68 static size_t vertex_size(const GrVertexAttrib* attribs, int count) { 68 static size_t vertex_size(const GrVertexAttrib* attribs, int count) {
69 // this works as long as we're 4 byte-aligned 69 // this works as long as we're 4 byte-aligned
70 #if GR_DEBUG 70 #ifdef SK_DEBUG
71 uint32_t overlapCheck = 0; 71 uint32_t overlapCheck = 0;
72 #endif 72 #endif
73 SkASSERT(count <= GrDrawState::kMaxVertexAttribCnt); 73 SkASSERT(count <= GrDrawState::kMaxVertexAttribCnt);
74 size_t size = 0; 74 size_t size = 0;
75 for (int index = 0; index < count; ++index) { 75 for (int index = 0; index < count; ++index) {
76 size_t attribSize = GrVertexAttribTypeSize(attribs[index].fType); 76 size_t attribSize = GrVertexAttribTypeSize(attribs[index].fType);
77 size += attribSize; 77 size += attribSize;
78 #if GR_DEBUG 78 #ifdef SK_DEBUG
79 size_t dwordCount = attribSize >> 2; 79 size_t dwordCount = attribSize >> 2;
80 uint32_t mask = (1 << dwordCount)-1; 80 uint32_t mask = (1 << dwordCount)-1;
81 size_t offsetShift = attribs[index].fOffset >> 2; 81 size_t offsetShift = attribs[index].fOffset >> 2;
82 SkASSERT(!(overlapCheck & (mask << offsetShift))); 82 SkASSERT(!(overlapCheck & (mask << offsetShift)));
83 overlapCheck |= (mask << offsetShift); 83 overlapCheck |= (mask << offsetShift);
84 #endif 84 #endif
85 } 85 }
86 return size; 86 return size;
87 } 87 }
88 88
89 size_t GrDrawState::getVertexSize() const { 89 size_t GrDrawState::getVertexSize() const {
90 return vertex_size(fCommon.fVAPtr, fCommon.fVACount); 90 return vertex_size(fCommon.fVAPtr, fCommon.fVACount);
91 } 91 }
92 92
93 //////////////////////////////////////////////////////////////////////////////// 93 ////////////////////////////////////////////////////////////////////////////////
94 94
95 void GrDrawState::setVertexAttribs(const GrVertexAttrib* attribs, int count) { 95 void GrDrawState::setVertexAttribs(const GrVertexAttrib* attribs, int count) {
96 SkASSERT(count <= kMaxVertexAttribCnt); 96 SkASSERT(count <= kMaxVertexAttribCnt);
97 97
98 fCommon.fVAPtr = attribs; 98 fCommon.fVAPtr = attribs;
99 fCommon.fVACount = count; 99 fCommon.fVACount = count;
100 100
101 // Set all the indices to -1 101 // Set all the indices to -1
102 memset(fCommon.fFixedFunctionVertexAttribIndices, 102 memset(fCommon.fFixedFunctionVertexAttribIndices,
103 0xff, 103 0xff,
104 sizeof(fCommon.fFixedFunctionVertexAttribIndices)); 104 sizeof(fCommon.fFixedFunctionVertexAttribIndices));
105 #if GR_DEBUG 105 #ifdef SK_DEBUG
106 uint32_t overlapCheck = 0; 106 uint32_t overlapCheck = 0;
107 #endif 107 #endif
108 for (int i = 0; i < count; ++i) { 108 for (int i = 0; i < count; ++i) {
109 if (attribs[i].fBinding < kGrFixedFunctionVertexAttribBindingCnt) { 109 if (attribs[i].fBinding < kGrFixedFunctionVertexAttribBindingCnt) {
110 // The fixed function attribs can only be specified once 110 // The fixed function attribs can only be specified once
111 SkASSERT(-1 == fCommon.fFixedFunctionVertexAttribIndices[attribs[i]. fBinding]); 111 SkASSERT(-1 == fCommon.fFixedFunctionVertexAttribIndices[attribs[i]. fBinding]);
112 SkASSERT(GrFixedFunctionVertexAttribVectorCount(attribs[i].fBinding) == 112 SkASSERT(GrFixedFunctionVertexAttribVectorCount(attribs[i].fBinding) ==
113 GrVertexAttribTypeVectorCount(attribs[i].fType)); 113 GrVertexAttribTypeVectorCount(attribs[i].fType));
114 fCommon.fFixedFunctionVertexAttribIndices[attribs[i].fBinding] = i; 114 fCommon.fFixedFunctionVertexAttribIndices[attribs[i].fBinding] = i;
115 } 115 }
116 #if GR_DEBUG 116 #ifdef SK_DEBUG
117 size_t dwordCount = GrVertexAttribTypeSize(attribs[i].fType) >> 2; 117 size_t dwordCount = GrVertexAttribTypeSize(attribs[i].fType) >> 2;
118 uint32_t mask = (1 << dwordCount)-1; 118 uint32_t mask = (1 << dwordCount)-1;
119 size_t offsetShift = attribs[i].fOffset >> 2; 119 size_t offsetShift = attribs[i].fOffset >> 2;
120 SkASSERT(!(overlapCheck & (mask << offsetShift))); 120 SkASSERT(!(overlapCheck & (mask << offsetShift)));
121 overlapCheck |= (mask << offsetShift); 121 overlapCheck |= (mask << offsetShift);
122 #endif 122 #endif
123 } 123 }
124 // Positions must be specified. 124 // Positions must be specified.
125 SkASSERT(-1 != fCommon.fFixedFunctionVertexAttribIndices[kPosition_GrVertexA ttribBinding]); 125 SkASSERT(-1 != fCommon.fFixedFunctionVertexAttribIndices[kPosition_GrVertexA ttribBinding]);
126 } 126 }
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 fDrawState->fColorStages[s].saveCoordChange(&fSavedCoordChanges[i]); 475 fDrawState->fColorStages[s].saveCoordChange(&fSavedCoordChanges[i]);
476 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix); 476 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix);
477 } 477 }
478 478
479 int numCoverageStages = fDrawState->numCoverageStages(); 479 int numCoverageStages = fDrawState->numCoverageStages();
480 for (int s = 0; s < numCoverageStages; ++s, ++i) { 480 for (int s = 0; s < numCoverageStages; ++s, ++i) {
481 fDrawState->fCoverageStages[s].saveCoordChange(&fSavedCoordChanges[i]); 481 fDrawState->fCoverageStages[s].saveCoordChange(&fSavedCoordChanges[i]);
482 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix); 482 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix);
483 } 483 }
484 } 484 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698