diff options
author | 2011-03-18 17:14:27 -0700 | |
---|---|---|
committer | 2011-03-18 17:14:27 -0700 | |
commit | 67ac217a81f34ee3d35df84b38f3456843c40706 (patch) | |
tree | 7d6bda2903af512621d1fd775d186b4f374bd591 /libs/hwui/OpenGLRenderer.cpp | |
parent | a168d7372132d6c87835878794b6ed43d0d282fd (diff) |
Fix hairline rendering.
Change-Id: Ib6129b446b53678b1b955d8516418370cbae4f10
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index e47a6963d9f0..a711289dbd8e 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1426,25 +1426,23 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { } else { // TODO: Handle the AA case for (int i = 0; i < count; i += 4) { - const float left = fmin(points[i], points[i + 1]); - const float right = fmax(points[i], points[i + 1]); - const float top = fmin(points[i + 2], points[i + 3]); - const float bottom = fmax(points[i + 2], points[i + 3]); + TextureVertex::set(vertex++, points[i], points[i + 1], 0.0f, 0.0f); + TextureVertex::set(vertex++, points[i + 2], points[i + 3], 0.0f, 0.0f); - if (!quickReject(left, top, right, bottom)) { - TextureVertex::set(vertex++, points[i], points[i + 1], 0.0f, 0.0f); - TextureVertex::set(vertex++, points[i + 2], points[i + 3], 0.0f, 0.0f); + generatedVerticesCount += 2; - generatedVerticesCount += 2; + const float left = fmin(points[i], points[i + 2]); + const float right = fmax(points[i], points[i + 2]); + const float top = fmin(points[i + 1], points[i + 3]); + const float bottom = fmax(points[i + 1], points[i + 3]); - dirtyLayer(left, top, right, bottom, *mSnapshot->transform); - } + dirtyLayer(left, top, + right == left ? left + 1 : right, bottom == top ? top + 1 : bottom, + *mSnapshot->transform); } - if (generatedVerticesCount > 0) { - glLineWidth(1.0f); - glDrawArrays(GL_LINES, 0, generatedVerticesCount); - } + glLineWidth(1.0f); + glDrawArrays(GL_LINES, 0, generatedVerticesCount); } } |