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

Side by Side Diff: src/gpu/batches/GrMSAAPathRenderer.cpp

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make it run. Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 "GrMSAAPathRenderer.h" 8 #include "GrMSAAPathRenderer.h"
9 9
10 #include "GrAuditTrail.h" 10 #include "GrAuditTrail.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 385 }
386 } 386 }
387 int lineVertexOffset = (int) (lines.nextVertex - lines.vertices); 387 int lineVertexOffset = (int) (lines.nextVertex - lines.vertices);
388 int lineIndexOffset = (int) (lines.nextIndex - lines.indices); 388 int lineIndexOffset = (int) (lines.nextIndex - lines.indices);
389 SkASSERT(lineVertexOffset <= fMaxLineVertices && lineIndexOffset <= fMax LineIndices); 389 SkASSERT(lineVertexOffset <= fMaxLineVertices && lineIndexOffset <= fMax LineIndices);
390 int quadVertexOffset = (int) (quads.nextVertex - quads.vertices); 390 int quadVertexOffset = (int) (quads.nextVertex - quads.vertices);
391 int quadIndexOffset = (int) (quads.nextIndex - quads.indices); 391 int quadIndexOffset = (int) (quads.nextIndex - quads.indices);
392 SkASSERT(quadVertexOffset <= fMaxQuadVertices && quadIndexOffset <= fMax QuadIndices); 392 SkASSERT(quadVertexOffset <= fMaxQuadVertices && quadIndexOffset <= fMax QuadIndices);
393 393
394 if (lineVertexOffset) { 394 if (lineVertexOffset) {
395 SkAutoTUnref<const GrGeometryProcessor> lineGP; 395 sk_sp<GrGeometryProcessor> lineGP;
396 { 396 {
397 using namespace GrDefaultGeoProcFactory; 397 using namespace GrDefaultGeoProcFactory;
398 lineGP.reset(GrDefaultGeoProcFactory::Create(Color(Color::kAttri bute_Type), 398 lineGP = GrDefaultGeoProcFactory::Make(Color(Color::kAttribute_T ype),
399 Coverage(255), 399 Coverage(255),
400 LocalCoords(LocalCo ords::kUnused_Type), 400 LocalCoords(LocalCoords:: kUnused_Type),
401 fViewMatrix)); 401 fViewMatrix);
402 } 402 }
403 SkASSERT(lineVertexStride == lineGP->getVertexStride()); 403 SkASSERT(lineVertexStride == lineGP->getVertexStride());
404 404
405 GrMesh lineMeshes; 405 GrMesh lineMeshes;
406 if (fIsIndexed) { 406 if (fIsIndexed) {
407 lineMeshes.initIndexed(primitiveType, lineVertexBuffer, lineInde xBuffer, 407 lineMeshes.initIndexed(primitiveType, lineVertexBuffer, lineInde xBuffer,
408 firstLineVertex, firstLineIndex, lineVe rtexOffset, 408 firstLineVertex, firstLineIndex, lineVe rtexOffset,
409 lineIndexOffset); 409 lineIndexOffset);
410 } else { 410 } else {
411 lineMeshes.init(primitiveType, lineVertexBuffer, firstLineVertex , 411 lineMeshes.init(primitiveType, lineVertexBuffer, firstLineVertex ,
412 lineVertexOffset); 412 lineVertexOffset);
413 } 413 }
414 target->draw(lineGP, lineMeshes); 414 target->draw(lineGP.get(), lineMeshes);
415 } 415 }
416 416
417 if (quadVertexOffset) { 417 if (quadVertexOffset) {
418 SkAutoTUnref<const GrGeometryProcessor> quadGP(MSAAQuadProcessor::Cr eate(fViewMatrix)); 418 SkAutoTUnref<const GrGeometryProcessor> quadGP(MSAAQuadProcessor::Cr eate(fViewMatrix));
419 SkASSERT(quadVertexStride == quadGP->getVertexStride()); 419 SkASSERT(quadVertexStride == quadGP->getVertexStride());
420 420
421 const GrBuffer* quadVertexBuffer; 421 const GrBuffer* quadVertexBuffer;
422 int firstQuadVertex; 422 int firstQuadVertex;
423 MSAAQuadVertices::Vertex* quadVertices = (MSAAQuadVertices::Vertex*) 423 MSAAQuadVertices::Vertex* quadVertices = (MSAAQuadVertices::Vertex*)
424 target->makeVertexSpace(quadVertexStride, quadVertexOffset, &quadVertexBuffer, 424 target->makeVertexSpace(quadVertexStride, quadVertexOffset, &quadVertexBuffer,
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 false); 742 false);
743 } 743 }
744 744
745 void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) { 745 void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) {
746 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), 746 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
747 "GrMSAAPathRenderer::onStencilPath"); 747 "GrMSAAPathRenderer::onStencilPath");
748 SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType()); 748 SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType());
749 SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType()); 749 SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType());
750 750
751 GrPaint paint; 751 GrPaint paint;
752 SkSafeUnref(paint.setXPFactory(GrDisableColorXPFactory::Create())); 752 paint.setXPFactory(GrDisableColorXPFactory::Create());
753 paint.setAntiAlias(args.fIsAA); 753 paint.setAntiAlias(args.fIsAA);
754 754
755 this->internalDrawPath(args.fDrawContext, 755 this->internalDrawPath(args.fDrawContext,
756 paint, 756 paint,
757 &GrUserStencilSettings::kUnused, 757 &GrUserStencilSettings::kUnused,
758 *args.fClip, 758 *args.fClip,
759 GrColor_WHITE, 759 GrColor_WHITE,
760 *args.fViewMatrix, 760 *args.fViewMatrix,
761 *args.fPath, 761 *args.fPath,
762 true); 762 true);
763 } 763 }
764 764
765 //////////////////////////////////////////////////////////////////////////////// /////////////////// 765 //////////////////////////////////////////////////////////////////////////////// ///////////////////
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698