graphic_buffer_impl.h revision 1cc1c4153a26307948af9f1ee6d9cde7a7103b94
1/*
2 * Copyright (C) 2013 The Android Open Source Project
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// Provides the implementation of the GraphicBuffer interface in
18// renderer compostior
19
20#ifndef ANDROID_GRAPHIC_BUFFER_IMPL_H
21#define ANDROID_GRAPHIC_BUFFER_IMPL_H
22
23#include <ui/GraphicBuffer.h>
24
25#include "android_webview/public/browser/draw_gl.h"
26
27namespace android {
28
29class GraphicBufferImpl {
30 public:
31  ~GraphicBufferImpl();
32
33  static int Create(int w, int h);
34  static void Release(int buffer_id);
35  static int MapStatic(int buffer_id, AwMapMode mode, void** vaddr);
36  static int UnmapStatic(int buffer_id);
37  static void* GetNativeBufferStatic(int buffer_id);
38  static uint32_t GetStrideStatic(int buffer_id);
39
40 private:
41  status_t Map(AwMapMode mode, void** vaddr);
42  status_t Unmap();
43  status_t InitCheck() const;
44  void* GetNativeBuffer() const;
45  uint32_t GetStride() const;
46  GraphicBufferImpl(uint32_t w, uint32_t h);
47
48  sp<android::GraphicBuffer> mBuffer;
49};
50
51}  // namespace android
52
53#endif  // ANDROID_GRAPHIC_BUFFER_IMPL_H
54