Add support for non AA lines.
Change-Id: Id5200e94815404d62760437d0d2dbb0a9276c700
diff --git a/libs/hwui/Line.h b/libs/hwui/Line.h
index 75f3321e..820793c 100644
--- a/libs/hwui/Line.h
+++ b/libs/hwui/Line.h
@@ -80,8 +80,12 @@
glDeleteTextures(1, &mTexture);
}
+ inline float getLength(float x1, float y1, float x2, float y2) {
+ return sqrtf((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
+ }
+
void update(float x1, float y1, float x2, float y2, float lineWidth, float& tx, float& ty) {
- const float length = sqrtf((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
+ const float length = getLength(x1, y1, x2, y2);
const float half = lineWidth * 0.5f;
mPatch->updateVertices(gLineTextureWidth, gLineTextureHeight,
@@ -89,7 +93,7 @@
mXDivs, mYDivs, mXDivsCount, mYDivsCount);
tx = -gLineAABias;
- ty = -half - gLineAABias;
+ ty = lineWidth == 1.0f ? -gLineAABias : -half - gLineAABias;
}
inline GLvoid* getVertices() const {