Skip to content

Commit d84aaa2

Browse files
ChrisCraikAndroid (Google) Code Review
authored andcommitted
Merge "Fix line drawing path to use proportional distance from center" into jb-mr1-dev
2 parents c83f982 + 8f5ad76 commit d84aaa2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libs/hwui/OpenGLRenderer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,7 +1933,7 @@ status_t OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
19331933
// This value is used in the fragment shader to determine how to fill fragments.
19341934
// We will need to calculate the actual width proportion on each segment for
19351935
// scaled non-hairlines, since the boundary proportion may differ per-axis when scaled.
1936-
float boundaryWidthProportion = 1 / (2 * halfStrokeWidth);
1936+
float boundaryWidthProportion = .5 - 1 / (2 * halfStrokeWidth);
19371937
setupDrawAALine((void*) aaVertices, widthCoords, lengthCoords,
19381938
boundaryWidthProportion, widthSlot, lengthSlot);
19391939
}
@@ -1997,9 +1997,9 @@ status_t OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
19971997
abVector.x *= inverseScaleX;
19981998
abVector.y *= inverseScaleY;
19991999
float abLength = abVector.length();
2000-
boundaryLengthProportion = abLength / (length + abLength);
2000+
boundaryLengthProportion = .5 - abLength / (length + abLength);
20012001
} else {
2002-
boundaryLengthProportion = .5 / (length + 1);
2002+
boundaryLengthProportion = .5 - .5 / (length + 1);
20032003
}
20042004

20052005
abVector /= 2;

0 commit comments

Comments
 (0)