Commit | Line | Data |
---|---|---|
d42e7319 JB |
1 | /* |
2 | * Copyright (C) 2013 Simon Busch <morphis@gravedo.de> | |
3 | * | |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | ||
17 | #ifndef UI_COMPATIBILITY_LAYER_H_ | |
18 | #define UI_COMPATIBILITY_LAYER_H_ | |
19 | ||
20 | #include <stdbool.h> | |
21 | #include <stdint.h> | |
22 | #include <unistd.h> | |
23 | ||
24 | #ifdef __cplusplus | |
25 | extern "C" { | |
26 | #endif | |
27 | ||
28 | struct graphic_buffer; | |
29 | ||
30 | struct graphic_buffer* graphic_buffer_new(void); | |
31 | struct graphic_buffer* graphic_buffer_new_sized(uint32_t w, uint32_t h, | |
32 | int32_t format, uint32_t usage); | |
33 | struct graphic_buffer* graphic_buffer_new_existing(uint32_t w, uint32_t h, | |
34 | int32_t format, uint32_t usage, | |
35 | uint32_t stride, void *handle, | |
36 | bool keepOwnership); | |
37 | ||
38 | void graphic_buffer_free(struct graphic_buffer *buffer); | |
39 | ||
40 | uint32_t graphic_buffer_get_width(struct graphic_buffer *buffer); | |
41 | uint32_t graphic_buffer_get_height(struct graphic_buffer *buffer); | |
42 | uint32_t graphic_buffer_get_stride(struct graphic_buffer *buffer); | |
43 | uint32_t graphic_buffer_get_usage(struct graphic_buffer *buffer); | |
44 | int32_t graphic_buffer_get_pixel_format(struct graphic_buffer *buffer); | |
45 | ||
46 | uint32_t graphic_buffer_reallocate(struct graphic_buffer *buffer, uint32_t w, | |
47 | uint32_t h, int32_t f, uint32_t usage); | |
48 | uint32_t graphic_buffer_lock(struct graphic_buffer *buffer, uint32_t usage, void **vaddr); | |
49 | uint32_t graphic_buffer_unlock(struct graphic_buffer *buffer); | |
50 | ||
51 | void* graphic_buffer_get_native_buffer(struct graphic_buffer *buffer); | |
52 | ||
53 | void graphic_buffer_set_index(struct graphic_buffer *buffer, int index); | |
54 | int graphic_buffer_get_index(struct graphic_buffer *buffer); | |
55 | ||
56 | int graphic_buffer_init_check(struct graphic_buffer *buffer); | |
57 | ||
58 | #ifdef __cplusplus | |
59 | } | |
60 | #endif | |
61 | ||
62 | #endif // UI_COMPATIBILITY_LAYER_H_ |