Enable anti-aliasing for hw-accelerated lines
Draw anti-aliased lines with OpenGL by constructing a quad with
a border that fades out (to mimic fragment coverage).
Change-Id: Ib81a3e62d663acdf1b46b401ac4aa7ee9855cc7e
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 4b93b80..0276095 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -283,6 +283,19 @@
void drawAlphaBitmap(Texture* texture, float left, float top, SkPaint* paint);
/**
+ * Draws a line as a quad. Called by drawLines() for all cases except hairline without AA.
+ *
+ * @param points The vertices of the lines. Every four entries specifies the x/y points
+ * of a single line segment.
+ * @param count The number of entries in the points array.
+ * @param isAA Whether the line is anti-aliased
+ * @param isHairline Whether the line has strokeWidth==0, which results in the line being
+ * one pixel wide on the display regardless of scale.
+ */
+ void drawLinesAsQuads(float *points, int count, bool isAA, bool isHairline,
+ float strokeWidth);
+
+ /**
* Draws a textured rectangle with the specified texture. The specified coordinates
* are transformed by the current snapshot's transform matrix.
*
@@ -425,6 +438,7 @@
* Various methods to setup OpenGL rendering.
*/
void setupDrawWithTexture(bool isAlpha8 = false);
+ void setupDrawAALine();
void setupDrawPoint(float pointSize);
void setupDrawColor(int color);
void setupDrawColor(int color, int alpha);
@@ -453,6 +467,8 @@
void setupDrawSimpleMesh();
void setupDrawTexture(GLuint texture);
void setupDrawMesh(GLvoid* vertices, GLvoid* texCoords = NULL, GLuint vbo = 0);
+ void setupDrawVertices(GLvoid* vertices);
+ void setupDrawAALine(GLvoid* vertices, GLvoid* distanceCoords, float strokeWidth);
void finishDrawTexture();
void drawRegionRects(const Region& region);