特殊需求,对Android的输出图像做镜像翻转。

Screen convert

翻转x修改

源码:frameworks/native/services/surfaceflinger/RenderEngine/ProgramCache.cpp

  String8 ProgramCache::generateVertexShader(const Key& needs) {      Formatter vs;      if (needs.isTexturing()) {          vs << "attribute vec4 texCoords;"             << "varying vec2 outTexCoords;";      }      vs << "attribute vec4 position;"         << "uniform mat4 projection;"         << "uniform mat4 texture;"         << "void main(void) {" << indent << "gl_Position = projection * position;"         << "gl_Position.x = float(0) - gl_Position.x;";// 修改内容      if (needs.isTexturing()) {          vs << "outTexCoords = (texture * texCoords).st;";      }      vs << dedent << "}";      return vs.getString();  }
  • diff
  diff --git a/android9.0.0/frameworks/native/services/surfaceflinger/RenderEngine/ProgramCache.cpp b/android9.0.0/frameworks/native/services/surfaceflinger/RenderEngine/ProgramCache.cpp  index 9dc6858566..45545665b6 100644  --- a/android9.0.0/frameworks/native/services/surfaceflinger/RenderEngine/ProgramCache.cpp  +++ b/android9.0.0/frameworks/native/services/surfaceflinger/RenderEngine/ProgramCache.cpp  @@ -523,7 +523,8 @@ String8 ProgramCache::generateVertexShader(const Key& needs) {       vs << "attribute vec4 position;"          << "uniform mat4 projection;"          << "uniform mat4 texture;"  -       << "void main(void) {" << indent << "gl_Position = projection * position;";  +       << "void main(void) {" << indent << "gl_Position = projection * position;"  +       << "gl_Position.x = float(0) - gl_Position.x;";       if (needs.isTexturing()) {           vs << "outTexCoords = (texture * texCoords).st;";       }

更多相关文章

  1. 近百android程序源码贡献 转载的自己看的
  2. android 音乐播放器源码
  3. Android查看jar包源码问题
  4. Android Usb源码分析
  5. Android模仿乐淘的应用程序分析源码
  6. Android Appium源码分析
  7. Q版疯狂大炮游戏android源码下载

随机推荐

  1. Android是如何规避GPL传染性的
  2. linux android sdk的问题(Unable to get
  3. Android 动态设置TextView的drawableLeft
  4. 开发Android应用的时候遇到的问题
  5. Android 开机动画
  6. 重拾Android之路之开发准备
  7. Android的线程使用来更新UI----Thread、H
  8. Android的内存管理机制
  9. Android中intent传递对象和Bundle的用法
  10. [Android 源码] Android源码下载