summaryrefslogtreecommitdiff
path: root/libs/hwui/Program.cpp
diff options
context:
space:
mode:
author Chet Haase <chet@google.com> 2011-04-27 14:26:40 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2011-04-27 14:26:40 -0700
commit75e3ef048d8826f0db58f117403ce412e1d076a7 (patch)
treef720e1a1cf871eb8997e535f6ea708521e123041 /libs/hwui/Program.cpp
parent2ef1ce494c923a9163de08f5cda6259e23134761 (diff)
parent8a5cc92a150bae38ec43732d941b38bb381fe153 (diff)
Merge "Fix various hw-accelerated line/point bugs"
Diffstat (limited to 'libs/hwui/Program.cpp')
-rw-r--r--libs/hwui/Program.cpp9
1 files changed, 8 insertions, 1 deletions
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);