summaryrefslogtreecommitdiffstats
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-09-04 14:35:19 -0700
committerChris Craik <ccraik@google.com>2012-09-04 14:35:19 -0700
commit8f5ad7657b6c7cdb8927d7da5140602b68b450ac (patch)
tree2df87bbf09f8d9c202d5b1ec1ce7c21dd87f8da0 /libs/hwui/OpenGLRenderer.cpp
parent176d105d2f71198966b566d36d4e856a797695c7 (diff)
downloadframeworks_base-8f5ad7657b6c7cdb8927d7da5140602b68b450ac.zip
frameworks_base-8f5ad7657b6c7cdb8927d7da5140602b68b450ac.tar.gz
frameworks_base-8f5ad7657b6c7cdb8927d7da5140602b68b450ac.tar.bz2
Fix line drawing path to use proportional distance from center
boundaryWidth and boundaryLength are now distance from center, instead of distance from edge, in order to avoid unnecessary calculation in the shader. New calculation of these matches drawAARect. Change-Id: I1c7f576a97a6f0ce00d521661fd56fb62e05e6f2
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 8da9f66..c9d5159 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1937,7 +1937,7 @@ status_t OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
// This value is used in the fragment shader to determine how to fill fragments.
// We will need to calculate the actual width proportion on each segment for
// scaled non-hairlines, since the boundary proportion may differ per-axis when scaled.
- float boundaryWidthProportion = 1 / (2 * halfStrokeWidth);
+ float boundaryWidthProportion = .5 - 1 / (2 * halfStrokeWidth);
setupDrawAALine((void*) aaVertices, widthCoords, lengthCoords,
boundaryWidthProportion, widthSlot, lengthSlot);
}
@@ -2001,9 +2001,9 @@ status_t OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
abVector.x *= inverseScaleX;
abVector.y *= inverseScaleY;
float abLength = abVector.length();
- boundaryLengthProportion = abLength / (length + abLength);
+ boundaryLengthProportion = .5 - abLength / (length + abLength);
} else {
- boundaryLengthProportion = .5 / (length + 1);
+ boundaryLengthProportion = .5 - .5 / (length + 1);
}
abVector /= 2;