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

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

Issue 761563002: First step to moving vertex attributes to the geometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase and small cleanup Created 6 years 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "GrDefaultPathRenderer.h" 8 #include "GrDefaultPathRenderer.h"
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 } else { 227 } else {
228 if (indexed) { 228 if (indexed) {
229 maxIdxs = 3 * maxPts; 229 maxIdxs = 3 * maxPts;
230 *primType = kTriangles_GrPrimitiveType; 230 *primType = kTriangles_GrPrimitiveType;
231 } else { 231 } else {
232 *primType = kTriangleFan_GrPrimitiveType; 232 *primType = kTriangleFan_GrPrimitiveType;
233 } 233 }
234 } 234 }
235 235
236 drawState->setDefaultVertexAttribs(); 236 // TODO this is really wierd, I just need default vertex stride, can I think of a better way?
237 if (!arg->set(target, maxPts, drawState->getVertexStride(), maxIdxs)) { 237 SkAutoTUnref<const GrGeometryProcessor> gp(GrDefaultGeoProcFactory::Create() );
238 if (!arg->set(target, maxPts, gp->getVertexStride(), maxIdxs)) {
238 return false; 239 return false;
239 } 240 }
240 241
241 uint16_t* idxBase = reinterpret_cast<uint16_t*>(arg->indices()); 242 uint16_t* idxBase = reinterpret_cast<uint16_t*>(arg->indices());
242 uint16_t* idx = idxBase; 243 uint16_t* idx = idxBase;
243 uint16_t subpathIdxStart = 0; 244 uint16_t subpathIdxStart = 0;
244 245
245 SkPoint* base = reinterpret_cast<SkPoint*>(arg->vertices()); 246 SkPoint* base = reinterpret_cast<SkPoint*>(arg->vertices());
246 SkASSERT(base); 247 SkASSERT(base);
247 SkPoint* vert = base; 248 SkPoint* vert = base;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } else { 491 } else {
491 bounds = path.getBounds(); 492 bounds = path.getBounds();
492 } 493 }
493 GrDrawTarget::AutoGeometryPush agp(target); 494 GrDrawTarget::AutoGeometryPush agp(target);
494 target->drawSimpleRect(drawState, bounds); 495 target->drawSimpleRect(drawState, bounds);
495 } else { 496 } else {
496 if (passCount > 1) { 497 if (passCount > 1) {
497 drawState->enableState(GrDrawState::kNoColorWrites_StateBit); 498 drawState->enableState(GrDrawState::kNoColorWrites_StateBit);
498 } 499 }
499 GrDrawState::AutoRestoreEffects are(drawState); 500 GrDrawState::AutoRestoreEffects are(drawState);
500 drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(fals e))->unref(); 501 drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create())-> unref();
501 if (indexCnt) { 502 if (indexCnt) {
502 target->drawIndexed(drawState, 503 target->drawIndexed(drawState,
503 primType, 504 primType,
504 0, 505 0,
505 0, 506 0,
506 vertexCnt, 507 vertexCnt,
507 indexCnt, 508 indexCnt,
508 &devBounds); 509 &devBounds);
509 } else { 510 } else {
510 target->drawNonIndexed(drawState, primType, 0, vertexCnt, &devBo unds); 511 target->drawNonIndexed(drawState, primType, 0, vertexCnt, &devBo unds);
(...skipping 28 matching lines...) Expand all
539 } 540 }
540 541
541 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, 542 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target,
542 GrDrawState* drawState, 543 GrDrawState* drawState,
543 const SkPath& path, 544 const SkPath& path,
544 const SkStrokeRec& stroke) { 545 const SkStrokeRec& stroke) {
545 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); 546 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType());
546 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); 547 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType());
547 this->internalDrawPath(target, drawState, path, stroke, true); 548 this->internalDrawPath(target, drawState, path, stroke, true);
548 } 549 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698