From ff2ed70fa30f04b90dd1a2c06ec2319e157152d7 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Sun, 1 Sep 2013 21:36:12 -0700 Subject: 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 --- services/surfaceflinger/Layer.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'services/surfaceflinger/Layer.cpp') 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 texCoords(mMesh.getTexCoordArray()); + 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& 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 position(mesh.getPositionArray()); + 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; } -- cgit v1.2.3-59-g8ed1b