summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2013-09-01 21:36:12 -0700
committer Mathias Agopian <mathias@google.com> 2013-09-04 22:11:15 -0700
commitff2ed70fa30f04b90dd1a2c06ec2319e157152d7 (patch)
treece07917c9844239d37b000afd2518b08028ed8be /services/surfaceflinger/Layer.cpp
parent1d4d8f94e2989b7c8667602304df9059d2701653 (diff)
color blindness enhancement
This is an attempt at improving the experience of users with color vision impairement. At this time this feature can only be enabled for debugging: adb shell service call SurfaceFlinger 1014 i32 PARAM with PARAM: 0 : disabled 1 : protanomaly/protanopia simulation 2 : deuteranomaly/deuteranopia simulation 3 : tritanopia/tritanomaly simulation 11, 12, 13: same as above w/ attempted correction/enhancement The enhancement algorithm tries to spread the "error" such that tones that would otherwise appear similar can be distinguished. Bug: 9465644 Change-Id: I860f7eed0cb81f54ef9cf24ad78155b6395ade48
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 56bddd61ee..b610c20660 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -547,15 +547,11 @@ void Layer::drawWithOpenGL(
// TODO: we probably want to generate the texture coords with the mesh
// here we assume that we only have 4 vertices
- Mesh::VertexArray texCoords(mMesh.getTexCoordArray());
- texCoords[0].s = left;
- texCoords[0].t = 1.0f - top;
- texCoords[1].s = left;
- texCoords[1].t = 1.0f - bottom;
- texCoords[2].s = right;
- texCoords[2].t = 1.0f - bottom;
- texCoords[3].s = right;
- texCoords[3].t = 1.0f - top;
+ Mesh::VertexArray<vec2> texCoords(mMesh.getTexCoordArray<vec2>());
+ texCoords[0] = vec2(left, 1.0f - top);
+ texCoords[1] = vec2(left, 1.0f - bottom);
+ texCoords[2] = vec2(right, 1.0f - bottom);
+ texCoords[3] = vec2(right, 1.0f - top);
RenderEngine& engine(mFlinger->getRenderEngine());
engine.setupLayerBlending(mPremultipliedAlpha, isOpaque(), s.alpha);
@@ -608,11 +604,11 @@ void Layer::computeGeometry(const sp<const DisplayDevice>& hw, Mesh& mesh) const
// subtract the transparent region and snap to the bounds
win = reduce(win, s.activeTransparentRegion);
- Mesh::VertexArray position(mesh.getPositionArray());
- tr.transform(position[0], win.left, win.top);
- tr.transform(position[1], win.left, win.bottom);
- tr.transform(position[2], win.right, win.bottom);
- tr.transform(position[3], win.right, win.top);
+ Mesh::VertexArray<vec2> position(mesh.getPositionArray<vec2>());
+ position[0] = tr.transform(win.left, win.top);
+ position[1] = tr.transform(win.left, win.bottom);
+ position[2] = tr.transform(win.right, win.bottom);
+ position[3] = tr.transform(win.right, win.top);
for (size_t i=0 ; i<4 ; i++) {
position[i].y = hw_h - position[i].y;
}