Go to the documentation of this file.00001 #if !defined(HFILE_libui) && ANDROID_VER>=400
00002 #define HFILE_libui
00003
00004 #include "libutils.h"
00005
00006 namespace android {
00007
00008 class Rect {
00009 public:
00010 inline Rect() {
00011 left = 0;
00012 top = 0;
00013 right = 0;
00014 bottom = 0;
00015 }
00016 int32_t left;
00017 int32_t top;
00018 int32_t right;
00019 int32_t bottom;
00020 };
00021
00022 typedef int32_t PixelFormat;
00023
00024 ssize_t bytesPerPixel(PixelFormat format);
00025 ssize_t bitsPerPixel(PixelFormat format);
00026
00027 class Fence : public LightRefBase<Fence>
00028 #if (ANDROID_VER<440)
00029 , public Flattenable
00030 #endif
00031 {
00032 public:
00033 static const sp<Fence> NO_FENCE;
00034
00035 Fence();
00036 Fence(int fenceFd);
00037 bool isValid() const { return mFenceFd != -1; }
00038 int getFd() const { return mFenceFd; }
00039 status_t wait(unsigned int timeout);
00040
00041 #if (ANDROID_VER<440)
00042
00043 size_t getFlattenedSize() const;
00044 size_t getFdCount() const;
00045 status_t flatten(void* buffer, size_t size, int fds[], size_t count) const;
00046 status_t unflatten(void const* buffer, size_t size, int fds[], size_t count);
00047 #endif
00048
00049 private:
00050
00051 friend class LightRefBase<Fence>;
00052 ~Fence();
00053
00054
00055 Fence(const Fence& rhs);
00056 Fence& operator = (const Fence& rhs);
00057 const Fence& operator = (const Fence& rhs) const;
00058
00059 int mFenceFd;
00060 };
00061
00062 typedef struct android_native_base_t {
00063 int magic;
00064 int version;
00065 void* reserved[4];
00066 void (*incRef)(struct android_native_base_t* base);
00067 void (*decRef)(struct android_native_base_t* base);
00068 } android_native_base_t;
00069
00070 typedef struct ANativeWindowBuffer {
00071 struct android_native_base_t common;
00072 int width;
00073 int height;
00074 int stride;
00075 int format;
00076 int usage;
00077 void* reserved[2];
00078 void* handle;
00079 void* reserved_proc[8];
00080 } ANativeWindowBuffer_t;
00081
00082 struct GraphicBuffer {
00083 GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage);
00084 ~GraphicBuffer();
00085 ANativeWindowBuffer* getNativeBuffer() const;
00086 status_t lock(uint32_t usage, void** vaddr);
00087 status_t unlock();
00088 void incStrong(const void* id) const {
00089 #ifdef LOG
00090 LOG("unhandled GraphicBuffer::incStrong id=%p *********************************", id);
00091 #endif
00092 }
00093 void decStrong(const void* id) const {
00094 #ifdef LOG
00095 LOG("unhandled GraphicBuffer::decStrong id=%p ********-****-***-***-***********", id);
00096 #endif
00097 }
00098 private:
00099 char __data[sizeof(void*)*64+sizeof(ANativeWindowBuffer)];
00100 };
00101
00102 }
00103
00104 #endif //end of lib