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
diff --git a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h
index eb8f31a..8b67fcc 100644
--- a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h
+++ b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h
@@ -39,8 +39,19 @@
     GLuint mProtectedTexName;
     GLint mMaxViewportDims[2];
     GLint mMaxTextureSize;
+    GLuint mVpWidth;
+    GLuint mVpHeight;
+
+    struct Group {
+        GLuint texture;
+        GLuint fbo;
+        GLuint width;
+        GLuint height;
+        mat4 colorTransform;
+    };
 
     Description mState;
+    Vector<Group> mGroupStack;
 
     virtual void bindImageAsFramebuffer(EGLImageKHR image,
             uint32_t* texName, uint32_t* fbName, uint32_t* status);
@@ -64,6 +75,9 @@
 
     virtual void drawMesh(const Mesh& mesh);
 
+    virtual void beginGroup(const mat4& colorTransform);
+    virtual void endGroup();
+
     virtual size_t getMaxTextureSize() const;
     virtual size_t getMaxViewportDims() const;
 };