summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-09-07 13:56:43 -0700
committerChris Craik <ccraik@google.com>2012-09-07 15:20:38 -0700
commit75040f8a7727f18bb33da23696a32a0760926ff2 (patch)
tree9f32eb9b41df3c09ce0f27abae389695eaa3ff3d /libs
parent9147cd4ac56d53dec6da1ef13dd04ba1eec1a7df (diff)
downloadframeworks_base-75040f8a7727f18bb33da23696a32a0760926ff2.zip
frameworks_base-75040f8a7727f18bb33da23696a32a0760926ff2.tar.gz
frameworks_base-75040f8a7727f18bb33da23696a32a0760926ff2.tar.bz2
Handle different x, y scales in drawLines AA path
bug:7114630 Fixes different x, y scales, and fixes boundaryWidthProportion to be from center, not edge. Also adds drawLine tests that previously drew blurry. Change-Id: I2b648a60361ad3931eac67647b9b27909525ee1e
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index b66c898..77a4f13 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1978,6 +1978,10 @@ status_t OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
// Find the normal to the line
vec2 n = (b - a).copyNormalized() * halfStrokeWidth;
+ float x = n.x;
+ n.x = -n.y;
+ n.y = x;
+
if (isHairLine) {
if (isAA) {
float wideningFactor;
@@ -2002,14 +2006,10 @@ status_t OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) {
float extendedNLength = extendedN.length();
// We need to set this value on the shader prior to drawing
- boundaryWidthProportion = extendedNLength / (halfStrokeWidth + extendedNLength);
+ boundaryWidthProportion = .5 - extendedNLength / (halfStrokeWidth + extendedNLength);
n += extendedN;
}
- float x = n.x;
- n.x = -n.y;
- n.y = x;
-
// aa lines expand the endpoint vertices to encompass the AA boundary
if (isAA) {
vec2 abVector = (b - a);