设为首页 加入收藏

TOP

探寻Android系统中的Old CRT OFF-Screen Animation(四)
2014-11-24 11:20:31 来源: 作者: 【 】 浏览:3
Tags:探寻 Android 系统 Old CRT OFF-Screen Animation
7] = y;


2132 }


2133 };


2134


2135 class h_stretch {


2136 const GLfloat hw_w, hw_h;


2137 public:


2138 h_stretch(uint32_t hw_w, uint32_t hw_h)


2139 : hw_w(hw_w), hw_h(hw_h) {


2140 }


2141 void operator()(GLfloat* vtx, float v) {


2142 const GLfloat w = hw_w - (hw_w * v);


2143 const GLfloat h = 1.0f;


2144 const GLfloat x = (hw_w - w) * 0.5f;


2145 const GLfloat y = (hw_h - h) * 0.5f;


2146 vtx[0] = x; vtx[1] = y;


2147 vtx[2] = x; vtx[3] = y + h;


2148 vtx[4] = x + w; vtx[5] = y + h;


2149 vtx[6] = x + w; vtx[7] = y;


2150 }


2151 };


2152


2153 // the full animation is 24 frames


2154 const int nbFrames = 12;


2155 s_curve_interpolator itr(nbFrames, 7.5f);


2156 s_curve_interpolator itg(nbFrames, 8.0f);


2157 s_curve_interpolator itb(nbFrames, 8.5f);


2158


2159 v_stretch vverts(hw_w, hw_h);


2160 glEnable(GL_BLEND);


2161 glBlendFunc(GL_ONE, GL_ONE);


2162 for (int i=0 ; i

2163 float x, y, w, h;


2164 const float vr = itr(i);


2165 const float vg = itg(i);


2166 const float vb = itb(i);


2167


2168 // clear screen


2169 glColorMask(1,1,1,1);


2170 glClear(GL_COLOR_BUFFER_BIT);


2171 glEnable(GL_TEXTURE_2D);


2172


2173 // draw the red plane


2174 vverts(vtx, vr);


2175 glColorMask(1,0,0,1);


2176 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);


2177


2178 // draw the green plane


2179 vverts(vtx, vg);


2180 glColorMask(0,1,0,1);


2181 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);


2182


2183 // draw the blue plane


2184 vverts(vtx, vb);


2185 glColorMask(0,0,1,1);


2186 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);


2187


2188 // draw the white highlight (we use the last vertices)


2189 glDisable(GL_TEXTURE_2D);


2190 glColorMask(1,1,1,1);


2191 glColor4f(vg, vg, vg, 1);


2192 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);


2193 hw.flip(screenBounds);


2194 }


2195


2196 h_stretch hverts(hw_w, hw_h);


2197 glDisable(GL_BLEND);


2198 glDisable(GL_TEXTURE_2D);


2199 glColorMask(1,1,1,1);


2200 for (int i=0 ; i

2201 const float v = itg(i);


2202 hverts(vtx, v);


2203 glClear(GL_COLOR_BUFFER_BIT);


2204 glColor4f(1-v, 1-v, 1-v, 1);


2205 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);


2206 hw.flip(screenBounds);


2207 }


2208


2209 glColorMask(1,1,1,1);


2210 glEnable(GL_SCISSOR_TEST);


2211 glDisableClientState(GL_TEXTURE_COORD_ARRAY);


2212 glDeleteTextures(1, &tname);


2213 return NO_ERROR;


2214 }


2215





OK,看完代码回来,首先是PowerManagerService.java中


mAnimationSetting如果标记为ANIM_SETTING_OFF,则打开旧CRT动画。



下面关屏动作run()中,因为我们将config_animateScreenLights置为false,因此mAnimateScreenLights为fasle


分支进入else,执行nativeStartSurfaceFlingerAnimation()函数。



nativeStartSurfaceFlingerAnimation()函数是一个JNI调用,在com_android_server_PowerManagerService.cpp文件中,


对应surfaceflinger的s->turnElectronBeamOff(mode)函数。



好的,现在跳入SurfaceFlinger.cpp函数,具体调用顺序是:


tu

首页 上一页 1 2 3 4 下一页 尾页 4/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇S3C6410的时钟和PLL 下一篇Android操作系统11种传感器介绍

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·如何从内核协议栈到 (2025-12-27 03:19:09)
·什么是网络协议?有哪 (2025-12-27 03:19:06)
·TCP/ IP协议有哪些 (2025-12-27 03:19:03)
·怎样用 Python 写一 (2025-12-27 02:49:19)
·如何学习python数据 (2025-12-27 02:49:16)