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

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: debug fixes Created 5 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 /* 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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 bool tweakAlphaForCoverage) { 701 bool tweakAlphaForCoverage) {
702 intptr_t verts = reinterpret_cast<intptr_t>(vertices); 702 intptr_t verts = reinterpret_cast<intptr_t>(vertices);
703 703
704 for (int i = 0; i < tess.numPts(); ++i) { 704 for (int i = 0; i < tess.numPts(); ++i) {
705 *((SkPoint*)((intptr_t)verts + i * vertexStride)) = tess.point(i); 705 *((SkPoint*)((intptr_t)verts + i * vertexStride)) = tess.point(i);
706 } 706 }
707 707
708 // Make 'verts' point to the colors 708 // Make 'verts' point to the colors
709 verts += sizeof(SkPoint); 709 verts += sizeof(SkPoint);
710 for (int i = 0; i < tess.numPts(); ++i) { 710 for (int i = 0; i < tess.numPts(); ++i) {
711 SkASSERT(tess.depth(i) >= -0.5f && tess.depth(i) <= 0.5f);
712 if (tweakAlphaForCoverage) { 711 if (tweakAlphaForCoverage) {
713 SkASSERT(SkScalarRoundToInt(255.0f * (tess.depth(i) + 0.5f)) <= 255) ; 712 SkASSERT(SkScalarRoundToInt(255.0f * tess.coverage(i)) <= 255);
714 unsigned scale = SkScalarRoundToInt(255.0f * (tess.depth(i) + 0.5f)) ; 713 unsigned scale = SkScalarRoundToInt(255.0f * tess.coverage(i));
715 GrColor scaledColor = (0xff == scale) ? color : SkAlphaMulQ(color, s cale); 714 GrColor scaledColor = (0xff == scale) ? color : SkAlphaMulQ(color, s cale);
716 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = scaledColor; 715 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = scaledColor;
717 } else { 716 } else {
718 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = color; 717 *reinterpret_cast<GrColor*>(verts + i * vertexStride) = color;
719 *reinterpret_cast<float*>(verts + i * vertexStride + sizeof(GrColor) ) = 718 *reinterpret_cast<float*>(verts + i * vertexStride + sizeof(GrColor) ) =
720 tess.depth(i ) + 0.5f; 719 tess.coverage(i);
721 } 720 }
722 } 721 }
723 722
724 for (int i = 0; i < tess.numIndices(); ++i) { 723 for (int i = 0; i < tess.numIndices(); ++i) {
725 idxs[i] = tess.index(i); 724 idxs[i] = tess.index(i);
726 } 725 }
727 } 726 }
728 727
729 static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage, 728 static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage,
730 const SkMatrix& localMatrix, 729 const SkMatrix& localMatrix,
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 BATCH_TEST_DEFINE(AAConvexPathBatch) { 1019 BATCH_TEST_DEFINE(AAConvexPathBatch) {
1021 AAConvexPathBatch::Geometry geometry; 1020 AAConvexPathBatch::Geometry geometry;
1022 geometry.fColor = GrRandomColor(random); 1021 geometry.fColor = GrRandomColor(random);
1023 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 1022 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
1024 geometry.fPath = GrTest::TestPathConvex(random); 1023 geometry.fPath = GrTest::TestPathConvex(random);
1025 1024
1026 return AAConvexPathBatch::Create(geometry); 1025 return AAConvexPathBatch::Create(geometry);
1027 } 1026 }
1028 1027
1029 #endif 1028 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698