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

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

Issue 1094293002: Fix double blend in GrAAConvexPathRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | 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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 10
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 verts[*v + 2].fUV.set(0, 0); 418 verts[*v + 2].fUV.set(0, 0);
419 verts[*v + 3].fUV.set(0, -SK_Scalar1); 419 verts[*v + 3].fUV.set(0, -SK_Scalar1);
420 verts[*v + 4].fUV.set(0, -SK_Scalar1); 420 verts[*v + 4].fUV.set(0, -SK_Scalar1);
421 421
422 verts[*v + 0].fD0 = verts[*v + 0].fD1 = -SK_Scalar1; 422 verts[*v + 0].fD0 = verts[*v + 0].fD1 = -SK_Scalar1;
423 verts[*v + 1].fD0 = verts[*v + 1].fD1 = -SK_Scalar1; 423 verts[*v + 1].fD0 = verts[*v + 1].fD1 = -SK_Scalar1;
424 verts[*v + 2].fD0 = verts[*v + 2].fD1 = -SK_Scalar1; 424 verts[*v + 2].fD0 = verts[*v + 2].fD1 = -SK_Scalar1;
425 verts[*v + 3].fD0 = verts[*v + 3].fD1 = -SK_Scalar1; 425 verts[*v + 3].fD0 = verts[*v + 3].fD1 = -SK_Scalar1;
426 verts[*v + 4].fD0 = verts[*v + 4].fD1 = -SK_Scalar1; 426 verts[*v + 4].fD0 = verts[*v + 4].fD1 = -SK_Scalar1;
427 427
428 idxs[*i + 0] = *v + 0; 428 idxs[*i + 0] = *v + 3;
429 idxs[*i + 1] = *v + 2; 429 idxs[*i + 1] = *v + 1;
430 idxs[*i + 2] = *v + 1; 430 idxs[*i + 2] = *v + 2;
431 431
432 idxs[*i + 3] = *v + 3; 432 idxs[*i + 3] = *v + 4;
433 idxs[*i + 4] = *v + 1; 433 idxs[*i + 4] = *v + 3;
434 idxs[*i + 5] = *v + 2; 434 idxs[*i + 5] = *v + 2;
435 435
436 idxs[*i + 6] = *v + 4; 436 *i += 6;
437 idxs[*i + 7] = *v + 3; 437
438 idxs[*i + 8] = *v + 2; 438 // Fill the interior, if any.
439 if (count > 2) {
Chris Dalton 2015/04/21 11:49:05 Do we need to worry about the case where two colin
bsalomon 2015/04/21 15:50:07 SkPath won't notice colinear lines when constructi
440 idxs[*i + 0] = *v + 0;
441 idxs[*i + 1] = *v + 2;
442 idxs[*i + 2] = *v + 1;
443
444 *i += 3;
445 }
439 446
440 *v += 5; 447 *v += 5;
441 *i += 9;
442 } else { 448 } else {
443 SkPoint qpts[] = {sega.endPt(), segb.fPts[0], segb.fPts[1]}; 449 SkPoint qpts[] = {sega.endPt(), segb.fPts[0], segb.fPts[1]};
444 450
445 SkVector midVec = segb.fNorms[0] + segb.fNorms[1]; 451 SkVector midVec = segb.fNorms[0] + segb.fNorms[1];
446 midVec.normalize(); 452 midVec.normalize();
447 453
448 verts[*v + 0].fPos = fanPt; 454 verts[*v + 0].fPos = fanPt;
449 verts[*v + 1].fPos = qpts[0]; 455 verts[*v + 1].fPos = qpts[0];
450 verts[*v + 2].fPos = qpts[2]; 456 verts[*v + 2].fPos = qpts[2];
451 verts[*v + 3].fPos = qpts[0] + segb.fNorms[0]; 457 verts[*v + 3].fPos = qpts[0] + segb.fNorms[0];
(...skipping 23 matching lines...) Expand all
475 idxs[*i + 1] = *v + 1; 481 idxs[*i + 1] = *v + 1;
476 idxs[*i + 2] = *v + 2; 482 idxs[*i + 2] = *v + 2;
477 idxs[*i + 3] = *v + 4; 483 idxs[*i + 3] = *v + 4;
478 idxs[*i + 4] = *v + 3; 484 idxs[*i + 4] = *v + 3;
479 idxs[*i + 5] = *v + 2; 485 idxs[*i + 5] = *v + 2;
480 486
481 idxs[*i + 6] = *v + 5; 487 idxs[*i + 6] = *v + 5;
482 idxs[*i + 7] = *v + 3; 488 idxs[*i + 7] = *v + 3;
483 idxs[*i + 8] = *v + 4; 489 idxs[*i + 8] = *v + 4;
484 490
485 idxs[*i + 9] = *v + 0; 491 *i += 9;
486 idxs[*i + 10] = *v + 2; 492
487 idxs[*i + 11] = *v + 1; 493 // Fill the interior, if any.
494 if (count > 2) {
Chris Dalton 2015/04/21 11:41:59 I decided to err on the side of minimal change, bu
495 idxs[*i + 0] = *v + 0;
496 idxs[*i + 1] = *v + 2;
497 idxs[*i + 2] = *v + 1;
498
499 *i += 3;
500 }
488 501
489 *v += 6; 502 *v += 6;
490 *i += 12;
491 } 503 }
492 } 504 }
493 } 505 }
494 506
495 /////////////////////////////////////////////////////////////////////////////// 507 ///////////////////////////////////////////////////////////////////////////////
496 508
497 /* 509 /*
498 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first 510 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first
499 * two components of the vertex attribute. Coverage is based on signed 511 * two components of the vertex attribute. Coverage is based on signed
500 * distance with negative being inside, positive outside. The edge is specified in 512 * distance with negative being inside, positive outside. The edge is specified in
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 geometry.fColor = color; 897 geometry.fColor = color;
886 geometry.fViewMatrix = vm; 898 geometry.fViewMatrix = vm;
887 geometry.fPath = path; 899 geometry.fPath = path;
888 900
889 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); 901 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
890 target->drawBatch(pipelineBuilder, batch, &devRect); 902 target->drawBatch(pipelineBuilder, batch, &devRect);
891 903
892 return true; 904 return true;
893 905
894 } 906 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698