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

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: adding test to ignore 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
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrDistanceFieldTextContext.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 * 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 }
241 SkASSERT(gp->getVertexStride() == sizeof(SkPoint));
240 242
241 uint16_t* idxBase = reinterpret_cast<uint16_t*>(arg->indices()); 243 uint16_t* idxBase = reinterpret_cast<uint16_t*>(arg->indices());
242 uint16_t* idx = idxBase; 244 uint16_t* idx = idxBase;
243 uint16_t subpathIdxStart = 0; 245 uint16_t subpathIdxStart = 0;
244 246
245 SkPoint* base = reinterpret_cast<SkPoint*>(arg->vertices()); 247 SkPoint* base = reinterpret_cast<SkPoint*>(arg->vertices());
246 SkASSERT(base); 248 SkASSERT(base);
247 SkPoint* vert = base; 249 SkPoint* vert = base;
248 250
249 SkPoint pts[4]; 251 SkPoint pts[4];
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } else { 492 } else {
491 bounds = path.getBounds(); 493 bounds = path.getBounds();
492 } 494 }
493 GrDrawTarget::AutoGeometryPush agp(target); 495 GrDrawTarget::AutoGeometryPush agp(target);
494 target->drawSimpleRect(drawState, bounds); 496 target->drawSimpleRect(drawState, bounds);
495 } else { 497 } else {
496 if (passCount > 1) { 498 if (passCount > 1) {
497 drawState->enableState(GrDrawState::kNoColorWrites_StateBit); 499 drawState->enableState(GrDrawState::kNoColorWrites_StateBit);
498 } 500 }
499 GrDrawState::AutoRestoreEffects are(drawState); 501 GrDrawState::AutoRestoreEffects are(drawState);
500 drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create(fals e))->unref(); 502 drawState->setGeometryProcessor(GrDefaultGeoProcFactory::Create())-> unref();
501 if (indexCnt) { 503 if (indexCnt) {
502 target->drawIndexed(drawState, 504 target->drawIndexed(drawState,
503 primType, 505 primType,
504 0, 506 0,
505 0, 507 0,
506 vertexCnt, 508 vertexCnt,
507 indexCnt, 509 indexCnt,
508 &devBounds); 510 &devBounds);
509 } else { 511 } else {
510 target->drawNonIndexed(drawState, primType, 0, vertexCnt, &devBo unds); 512 target->drawNonIndexed(drawState, primType, 0, vertexCnt, &devBo unds);
(...skipping 28 matching lines...) Expand all
539 } 541 }
540 542
541 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, 543 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target,
542 GrDrawState* drawState, 544 GrDrawState* drawState,
543 const SkPath& path, 545 const SkPath& path,
544 const SkStrokeRec& stroke) { 546 const SkStrokeRec& stroke) {
545 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); 547 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType());
546 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); 548 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType());
547 this->internalDrawPath(target, drawState, path, stroke, true); 549 this->internalDrawPath(target, drawState, path, stroke, true);
548 } 550 }
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698