diff options
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 10 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java | 8 |
2 files changed, 13 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); diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java index f0abb50..eed0ec8 100644 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/LinesActivity.java @@ -153,6 +153,14 @@ public class LinesActivity extends Activity { canvas.drawLine(10.0f, 45.0f, 20.0f, 55.0f, mSmallPaint); canvas.drawLine(10.0f, 60.0f, 50.0f, 60.0f, mHairLinePaint); canvas.restore(); + + canvas.save(); + canvas.scale(10.0f, 50.0f); + mSmallPaint.setStrokeWidth(0.0f); + canvas.drawLine(20.0f, 9.0f, 30.0f, 11.0f, mSmallPaint); + mSmallPaint.setStrokeWidth(1.0f); + canvas.drawLine(30.0f, 9.0f, 40.0f, 11.0f, mSmallPaint); + canvas.restore(); } } } |