android surfaceflinger 代码,android surfaceflinger测试程序
frameworks/base/libs/surfaceflinger/tests/resize/resize.cpp 是個(gè)好地方。 但是我的測(cè)試應(yīng)用程序版本( 來(lái)自供應(yīng)商的Eclair ) 過(guò)時(shí)了,有些 Surface API已經(jīng)轉(zhuǎn)移到 SurfaceControl,你必須:
SurfaceComposerClient::createSurface() => SurfaceControl
SurfaceControl->getSurface() => Surface
第二使用 SurfaceComposerClient::openTransaction()/closeTransaction() 將所有事務(wù)綁定到SurfaceFlinger表面,例如:
Surface::lock()/unlockAndPost() 和 SurfaceControl::setLayer()/setSize()
下面是一些示例代碼( 希望編譯:p )sp client;
sp control;
sp surface;
SurfaceID sid = 0;
Surface::SurfaceInfo sinfo;
//set up the thread-pool, needed for Binder
sp proc(ProcessState::self());
ProcessState::self()->startThreadPool();
client = new SurfaceComposerClient();
control = client->createSurface(getpid(), sid, 160, 240, PIXEL_FORMAT_RGB_565);
surface = control->getSurface();
//global transaction sometimes cannot trigger a redraw
//client->openGlobalTransaction();
printf("setLayer...n");
client->openTransaction();
control->setLayer(100000);
client->closeTransaction();
printf("setLayer donen");
printf("memset 0xF800...n");
client->openTransaction();
surface->lock(&sinfo);
android_memset16((uint16_t*)sinfo.bits, 0xF800, sinfo.s*pfInfo.bytesPerPixel*sinfo.h);
surface->unlockAndPost();
client->closeTransaction();
printf("memset 0xF800 donen");
sleep(2);
printf("setSize...n");
client->openTransaction();
control->setSize(80, 120);
client->closeTransaction();
printf("setSize donen");
sleep(2);
printf("memset 0x07E0...n");
client->openTransaction();
surface->lock(&sinfo);
android_memset16((uint16_t*)sinfo.bits, 0x07E0, sinfo.s*pfInfo.bytesPerPixel*sinfo.h);
surface->unlockAndPost();
printf("memset 0x07E0 donen");
client->closeTransaction();
sleep(2);
printf("setPosition...n");
client->openTransaction();
control->setPosition(100, 100);
client->closeTransaction();
printf("setPosition donen");
sleep(2);
//global transaction sometimes cannot trigger a redraw
//client->closeGlobalTransaction();
printf("byen");
總結(jié)
以上是生活随笔為你收集整理的android surfaceflinger 代码,android surfaceflinger测试程序的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: microsoft.exe进程查询 mi
- 下一篇: 计算机编程是考研什么专业,程序员考研该不