forked from ClnViewer/Android-fast-screen-capture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathascreencap.h
56 lines (44 loc) · 1.38 KB
/
ascreencap.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <atomic>
#include <memory>
#include <vector>
#include <string>
#include <thread>
/// Debug only:
/// #include <iostream>
#if defined(_DEBUG)
# include <chrono>
typedef std::chrono::high_resolution_clock::time_point TimeWatch;
# define HClockNow() std::chrono::high_resolution_clock::now()
# define HClockDiff(A,B) std::chrono::duration_cast<std::chrono::milliseconds>(A - B).count()
#endif
#include <stdint.h>
#include <sys/types.h>
#include <system/graphics.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <binder/IBinder.h>
#include <gui/ISurfaceComposer.h>
#include <gui/SurfaceComposerClient.h>
#include <ui/PixelFormat.h>
#if defined(_DEBUG)
# define __LOG_PRINT(A, ...) \
__LOG_PRINT_(A, __func__, __LINE__, __VA_ARGS__)
# if defined(_ANDROID_LOG)
# define __LOG_PRINT_(A, B, C, ...) \
__android_log_print(ANDROID_LOG_DEBUG, "ASCREENCAP", "+ [%s:%d] " A, B, C, __VA_ARGS__)
# else
# define __LOG_PRINT_(A, B, C,...) \
{ fprintf(stderr, "+ [%s:%d] " A " | global: [%d][%s]\n", B, C, __VA_ARGS__, errno, strerror(errno)); errno = 0; }
# endif
#else
# define __LOG_PRINT(A,...)
#endif
#define __ERROR_THIS_SET \
_err = __LINE__;
#define __ERROR_BREAK_SET \
{ _err = __LINE__; break; }
#define __ERROR_BOOL_SET \
{ _err = __LINE__; return false; }
#define __NELE(a) (sizeof(a) / sizeof(a[0]))