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

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

Issue 13468004: Make drawRect preserve vertex attrib state and push/pop the geom sources. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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
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 "GrAARectRenderer.h" 8 #include "GrAARectRenderer.h"
9 #include "GrRefCnt.h" 9 #include "GrRefCnt.h"
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 verts += 4 * vsize; 172 verts += 4 * vsize;
173 for (int i = 0; i < 4; ++i) { 173 for (int i = 0; i < 4; ++i) {
174 *reinterpret_cast<GrColor*>(verts + i * vsize) = innerColor; 174 *reinterpret_cast<GrColor*>(verts + i * vsize) = innerColor;
175 } 175 }
176 176
177 target->setIndexSourceToBuffer(indexBuffer); 177 target->setIndexSourceToBuffer(indexBuffer);
178 target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1, 178 target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1,
179 kVertsPerAAFillRect, 179 kVertsPerAAFillRect,
180 kIndicesPerAAFillRect); 180 kIndicesPerAAFillRect);
181 target->resetIndexSource();
181 } 182 }
182 183
183 void GrAARectRenderer::strokeAARect(GrGpu* gpu, 184 void GrAARectRenderer::strokeAARect(GrGpu* gpu,
184 GrDrawTarget* target, 185 GrDrawTarget* target,
185 const GrRect& devRect, 186 const GrRect& devRect,
186 const GrVec& devStrokeSize, 187 const GrVec& devStrokeSize,
187 bool useVertexCoverage) { 188 bool useVertexCoverage) {
188 GrDrawState* drawState = target->drawState(); 189 GrDrawState* drawState = target->drawState();
189 190
190 const SkScalar& dx = devStrokeSize.fX; 191 const SkScalar& dx = devStrokeSize.fX;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // The innermost rect has full coverage 265 // The innermost rect has full coverage
265 verts += 8 * vsize; 266 verts += 8 * vsize;
266 for (int i = 0; i < 4; ++i) { 267 for (int i = 0; i < 4; ++i) {
267 *reinterpret_cast<GrColor*>(verts + i * vsize) = 0; 268 *reinterpret_cast<GrColor*>(verts + i * vsize) = 0;
268 } 269 }
269 270
270 target->setIndexSourceToBuffer(indexBuffer); 271 target->setIndexSourceToBuffer(indexBuffer);
271 target->drawIndexed(kTriangles_GrPrimitiveType, 272 target->drawIndexed(kTriangles_GrPrimitiveType,
272 0, 0, 16, aaStrokeRectIndexCount()); 273 0, 0, 16, aaStrokeRectIndexCount());
273 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698