OLD | NEW |
(Empty) | |
| 1 #include <ui/DisplayInfo.h> |
| 2 |
| 3 namespace android { |
| 4 class Test { |
| 5 public: |
| 6 static const sp<ISurface>& getISurface(const sp<Surface>& s) { |
| 7 return s->getISurface(); |
| 8 } |
| 9 }; |
| 10 }; |
| 11 |
| 12 #define min(a,b) (a<b?a:b) |
| 13 #define SURFACE_CREATE(client,surface_ctrl,android_surface, android_isurface, x,
y, win_width, win_height) \ |
| 14 do { \ |
| 15 client = new SurfaceComposerClient(); \ |
| 16 android::DisplayInfo info; \ |
| 17 int w, h; \ |
| 18 \ |
| 19 client->getDisplayInfo(android::DisplayID(0), &info); \ |
| 20 /*w = min(win_width, info.w);*/ \ |
| 21 /*h = min(win_height, info.h);*/ \ |
| 22 w = win_width, h = win_height; \ |
| 23 \ |
| 24 surface_ctrl = client->createSurface(getpid(), 0, w, h, PIXEL_FORMAT_RGB_565
, ISurfaceComposer::ePushBuffers); \ |
| 25 android_surface = surface_ctrl->getSurface(); \ |
| 26 android_isurface = Test::getISurface(android_surface); \ |
| 27 \ |
| 28 client->openTransaction(); \ |
| 29 surface_ctrl->setPosition(x, y); \ |
| 30 client->closeTransaction(); \ |
| 31 \ |
| 32 client->openTransaction(); \ |
| 33 surface_ctrl->setSize(w, h); \ |
| 34 client->closeTransaction(); \ |
| 35 \ |
| 36 client->openTransaction(); \ |
| 37 surface_ctrl->setLayer(0x100000); \ |
| 38 client->closeTransaction(); \ |
| 39 } while (0) |
| 40 |
| 41 |
OLD | NEW |