Android(安卓)P系统输出图像镜像翻转实现
16lz
2021-12-04
特殊需求,对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;"; }
更多相关文章
- 建本地 repo server
- Android(安卓)判断是否有声音在播放
- 基于Android(安卓)Q 修改默认音量等级
- Android(安卓)8.1 (O) Launcher3 方面修改
- Android(安卓)ril移植-6410开发板SIM300模块
- Android(安卓)2.1 源码结构分析
- Android(安卓)Studio 更新时提示connection failed的解決方法
- react native 修改Picker样式Android
- Android查看jar包源码问题