From 75040f8a7727f18bb33da23696a32a0760926ff2 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Fri, 7 Sep 2012 13:56:43 -0700 Subject: 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 --- libs/hwui/OpenGLRenderer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libs/hwui/OpenGLRenderer.cpp') 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); -- cgit v1.1