File: android_winsys.cpp

package info (click to toggle)
libva 1.0.15-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,532 kB
  • sloc: cpp: 29,576; ansic: 12,345; makefile: 310; sh: 78
file content (41 lines) | stat: -rw-r--r-- 2,286 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <ui/DisplayInfo.h>

namespace android {
    class Test {
        public:
                static const sp<ISurface>& getISurface(const sp<Surface>& s) {
                            return s->getISurface();
                }
    };
};

#define min(a,b) (a<b?a:b)
#define SURFACE_CREATE(client,surface_ctrl,android_surface, android_isurface, x, y, win_width, win_height) \
do {                                                                    \
    client = new SurfaceComposerClient();                               \
    android::DisplayInfo info;                                          \
    int w, h;                                                           \
                                                                        \
    client->getDisplayInfo(android::DisplayID(0), &info);               \
    /*w = min(win_width, info.w);*/                                     \
    /*h = min(win_height, info.h);*/                                    \
    w = win_width, h = win_height;                                      \
                                                                        \
    surface_ctrl = client->createSurface(getpid(), 0, w, h, PIXEL_FORMAT_RGB_565, ISurfaceComposer::ePushBuffers); \
    android_surface = surface_ctrl->getSurface();                       \
    android_isurface = Test::getISurface(android_surface);              \
                                                                        \
    client->openTransaction();                                          \
    surface_ctrl->setPosition(x, y);                                    \
    client->closeTransaction();                                         \
                                                                        \
    client->openTransaction();                                          \
    surface_ctrl->setSize(w, h);                                        \
    client->closeTransaction();                                         \
                                                                        \
    client->openTransaction();                                          \
    surface_ctrl->setLayer(0x100000);                                   \
    client->closeTransaction();                                         \
} while (0)