From 8a5cc92a150bae38ec43732d941b38bb381fe153 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Tue, 26 Apr 2011 07:28:09 -0700 Subject: Fix various hw-accelerated line/point bugs All accelerated lines are now rendered as quads. Hairlines used to be rendered as GL_LINES, but these lines don't render the same as our non-accelerated lines, so we're using quads for everything. Also, fixed a bug in the way that we were offsetting quads (and not offseting points) to ensure that our lines/points actuall start on the same pixels as Skia's. Change-Id: I51b923cc08a9858444c430ba07bc8aa0c83cbe6a --- libs/hwui/Program.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libs/hwui/Program.cpp') diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp index 2187f24e2c83..972dd87a5d71 100644 --- a/libs/hwui/Program.cpp +++ b/libs/hwui/Program.cpp @@ -124,8 +124,15 @@ GLuint Program::buildShader(const char* source, GLenum type) { } void Program::set(const mat4& projectionMatrix, const mat4& modelViewMatrix, - const mat4& transformMatrix) { + const mat4& transformMatrix, bool offset) { mat4 t(projectionMatrix); + if (offset) { + // offset screenspace xy by an amount that compensates for typical precision issues + // in GPU hardware that tends to paint hor/vert lines in pixels shifted up and to the left. + // This offset value is based on an assumption that some hardware may use as little + // as 12.4 precision, so we offset by slightly more than 1/16. + t.translate(.375, .375, 0); + } t.multiply(transformMatrix); t.multiply(modelViewMatrix); -- cgit v1.2.3-59-g8ed1b