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

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: Remove colinear lineTo stuff Created 5 years, 7 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 // Draw the interior fan if it exists.
439 // TODO: Detect and combine colinear segments. This will ensure we c atch every case
440 // with no interior, and that the resulting shared edge uses the sam e endpoints.
441 if (count >= 3) {
442 idxs[*i + 0] = *v + 0;
443 idxs[*i + 1] = *v + 2;
444 idxs[*i + 2] = *v + 1;
445
446 *i += 3;
447 }
439 448
440 *v += 5; 449 *v += 5;
441 *i += 9;
442 } else { 450 } else {
443 SkPoint qpts[] = {sega.endPt(), segb.fPts[0], segb.fPts[1]}; 451 SkPoint qpts[] = {sega.endPt(), segb.fPts[0], segb.fPts[1]};
444 452
445 SkVector midVec = segb.fNorms[0] + segb.fNorms[1]; 453 SkVector midVec = segb.fNorms[0] + segb.fNorms[1];
446 midVec.normalize(); 454 midVec.normalize();
447 455
448 verts[*v + 0].fPos = fanPt; 456 verts[*v + 0].fPos = fanPt;
449 verts[*v + 1].fPos = qpts[0]; 457 verts[*v + 1].fPos = qpts[0];
450 verts[*v + 2].fPos = qpts[2]; 458 verts[*v + 2].fPos = qpts[2];
451 verts[*v + 3].fPos = qpts[0] + segb.fNorms[0]; 459 verts[*v + 3].fPos = qpts[0] + segb.fNorms[0];
(...skipping 23 matching lines...) Expand all
475 idxs[*i + 1] = *v + 1; 483 idxs[*i + 1] = *v + 1;
476 idxs[*i + 2] = *v + 2; 484 idxs[*i + 2] = *v + 2;
477 idxs[*i + 3] = *v + 4; 485 idxs[*i + 3] = *v + 4;
478 idxs[*i + 4] = *v + 3; 486 idxs[*i + 4] = *v + 3;
479 idxs[*i + 5] = *v + 2; 487 idxs[*i + 5] = *v + 2;
480 488
481 idxs[*i + 6] = *v + 5; 489 idxs[*i + 6] = *v + 5;
482 idxs[*i + 7] = *v + 3; 490 idxs[*i + 7] = *v + 3;
483 idxs[*i + 8] = *v + 4; 491 idxs[*i + 8] = *v + 4;
484 492
485 idxs[*i + 9] = *v + 0; 493 *i += 9;
486 idxs[*i + 10] = *v + 2; 494
487 idxs[*i + 11] = *v + 1; 495 // Draw the interior fan if it exists.
496 // TODO: Detect and combine colinear segments. This will ensure we c atch every case
497 // with no interior, and that the resulting shared edge uses the sam e endpoints.
498 if (count >= 3) {
Chris Dalton 2015/04/29 16:38:04 I decided to err on the side of minimal code chang
499 idxs[*i + 0] = *v + 0;
500 idxs[*i + 1] = *v + 2;
501 idxs[*i + 2] = *v + 1;
502
503 *i += 3;
504 }
488 505
489 *v += 6; 506 *v += 6;
490 *i += 12;
491 } 507 }
492 } 508 }
493 } 509 }
494 510
495 /////////////////////////////////////////////////////////////////////////////// 511 ///////////////////////////////////////////////////////////////////////////////
496 512
497 /* 513 /*
498 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first 514 * 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 515 * two components of the vertex attribute. Coverage is based on signed
500 * distance with negative being inside, positive outside. The edge is specified in 516 * 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; 901 geometry.fColor = color;
886 geometry.fViewMatrix = vm; 902 geometry.fViewMatrix = vm;
887 geometry.fPath = path; 903 geometry.fPath = path;
888 904
889 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry)); 905 SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
890 target->drawBatch(pipelineBuilder, batch, &devRect); 906 target->drawBatch(pipelineBuilder, batch, &devRect);
891 907
892 return true; 908 return true;
893 909
894 } 910 }
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