• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2018 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 #include "AndroidWindowBuffer.h"
15 
16 #include <stdio.h>
17 
18 #define E(fmt,...) \
19     fprintf(stderr, "%s: " fmt "\n", __func__, ##__VA_ARGS__);
20 
21 namespace aemu {
22 
hook_incRef(struct android_native_base_t * common)23 static void hook_incRef(struct android_native_base_t* common) {
24     (void)common;
25     E("Not implemented");
26 }
27 
hook_decRef(struct android_native_base_t * common)28 static void hook_decRef(struct android_native_base_t* common) {
29     (void)common;
30     E("Not implemented");
31 }
32 
AndroidWindowBuffer(AndroidWindow * window,buffer_handle_t buffer,int usage,int format,int stride)33 AndroidWindowBuffer::AndroidWindowBuffer(AndroidWindow* window,
34                                          buffer_handle_t buffer,
35                                          int usage,
36                                          int format,
37                                          int stride)
38     : AndroidWindowBuffer(window->width,
39                           window->height,
40                           buffer,
41                           usage,
42                           format,
43                           stride) {}
44 
AndroidWindowBuffer(int _width,int _height,buffer_handle_t buffer,int usage,int format,int stride)45 AndroidWindowBuffer::AndroidWindowBuffer(int _width,
46                                          int _height,
47                                          buffer_handle_t buffer,
48                                          int usage,
49                                          int format,
50                                          int stride)
51     : ANativeWindowBuffer() {
52     this->width = _width;
53     this->height = _height;
54     this->stride = stride;
55     this->format = format;
56     this->usage_deprecated = usage;
57     this->usage = usage;
58 
59     this->handle = buffer;
60 
61     this->common.incRef = hook_incRef;
62     this->common.decRef = hook_decRef;
63 }
64 
65 } // namespace aemu