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

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

Issue 1180903006: added stroking support to GrAALinearizingConvexPathRenderer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: windows build issue Created 5 years, 5 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 | « src/core/SkPathPriv.h ('k') | src/gpu/GrAAConvexTessellator.h » ('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 /* 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 bool tweakAlphaForCoverage) { 700 bool tweakAlphaForCoverage) {
701 intptr_t verts = reinterpret_cast<intptr_t>(vertices); 701 intptr_t verts = reinterpret_cast<intptr_t>(vertices);
702 702
703 for (int i = 0; i < tess.numPts(); ++i) { 703 for (int i = 0; i < tess.numPts(); ++i) {
704 *((SkPoint*)((intptr_t)verts + i * vertexStride)) = tess.point(i); 704 *((SkPoint*)((intptr_t)verts + i * vertexStride)) = tess.point(i);
705 } 705 }
706 706
707 // Make 'verts' point to the colors 707 // Make 'verts' point to the colors
708 verts += sizeof(SkPoint); 708 verts += sizeof(SkPoint);
709 for (int i = 0; i < tess.numPts(); ++i) { 709 for (int i = 0; i < tess.numPts(); ++i) {
710 SkASSERT(tess.depth(i) >= -0.5f && tess.depth(i) <= 0.5f);
711 if (tweakAlphaForCoverage) { 710 if (tweakAlphaForCoverage) {
712 SkASSERT(SkScalarRoundToInt(255.0f * (tess.depth(i) + 0.5f)) <= 255) ; 711 SkASSERT(SkScalarRoundToInt(255.0f * tess.coverage(i)) <= 255);
713 unsigned scale = SkScalarRoundToInt(255.0f * (tess.depth(i) + 0.5f)) ; 712 unsigned scale = SkScalarRoundToInt(255.0f * tess.coverage(i));
714 GrColor scaledColor = (0xff == scale) ? color : SkAlphaMulQ(color, s cale); 713 GrColor scaledColor = (0xff == scale) ? color : SkAlphaMulQ(color, s cale);
715 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = scaledColor; 714 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = scaledColor;
716 } else { 715 } else {
717 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = color; 716 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = color;
718 *reinterpret_cast<float*>(verts + i * vertexStride + sizeof(GrColor) ) = 717 *reinterpret_cast<float*>(verts + i * vertexStride + sizeof(GrColor) ) =
719 tess.depth(i ) + 0.5f; 718 tess.coverage(i);
720 } 719 }
721 } 720 }
722 721
723 for (int i = 0; i < tess.numIndices(); ++i) { 722 for (int i = 0; i < tess.numIndices(); ++i) {
724 idxs[i] = tess.index(i); 723 idxs[i] = tess.index(i);
725 } 724 }
726 } 725 }
727 726
728 static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage, 727 static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage,
729 const SkMatrix& localMatrix, 728 const SkMatrix& localMatrix,
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 BATCH_TEST_DEFINE(AAConvexPathBatch) { 1018 BATCH_TEST_DEFINE(AAConvexPathBatch) {
1020 AAConvexPathBatch::Geometry geometry; 1019 AAConvexPathBatch::Geometry geometry;
1021 geometry.fColor = GrRandomColor(random); 1020 geometry.fColor = GrRandomColor(random);
1022 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 1021 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
1023 geometry.fPath = GrTest::TestPathConvex(random); 1022 geometry.fPath = GrTest::TestPathConvex(random);
1024 1023
1025 return AAConvexPathBatch::Create(geometry); 1024 return AAConvexPathBatch::Create(geometry);
1026 } 1025 }
1027 1026
1028 #endif 1027 #endif
OLDNEW
« no previous file with comments | « src/core/SkPathPriv.h ('k') | src/gpu/GrAAConvexTessellator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698