Android P系统输出图像镜像翻转实现
16lz
2021-01-23
特殊需求,对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;"; }
更多相关文章
- 近百android程序源码贡献 转载的自己看的
- android 音乐播放器源码
- Android查看jar包源码问题
- Android Usb源码分析
- Android模仿乐淘的应用程序分析源码
- Android Appium源码分析
- Q版疯狂大炮游戏android源码下载