特殊需求,对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. 建本地 repo server
  2. Android(安卓)判断是否有声音在播放
  3. 基于Android(安卓)Q 修改默认音量等级
  4. Android(安卓)8.1 (O) Launcher3 方面修改
  5. Android(安卓)ril移植-6410开发板SIM300模块
  6. Android(安卓)2.1 源码结构分析
  7. Android(安卓)Studio 更新时提示connection failed的解決方法
  8. react native 修改Picker样式Android
  9. Android查看jar包源码问题

随机推荐

  1. Android之在子线程更新UI(超详细)
  2. 解决WebView加载URL跳转到系统浏览器的问
  3. android kernel启动学习笔记
  4. 风投称Android将像Windows一样主宰移动市
  5. Android签名漏洞分析
  6. Android自定义权限的使用
  7. Android Schema的妙用
  8. ANDROID – TOOLBAR STEP BY STEP
  9. Android聊天室(服务器)
  10. android:viewpager实现图片循环滑动+索引