1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 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 */ 15 16 #ifndef OHOS_NATIVE_BUFFER_ADAPTER_IMPL_H 17 #define OHOS_NATIVE_BUFFER_ADAPTER_IMPL_H 18 19 #include "ohos_native_buffer_adapter.h" 20 21 #include "foundation/graphic/graphic_surface/interfaces/inner_api/surface/external_window.h" 22 #include "foundation/graphic/graphic_surface/interfaces/inner_api/surface/native_buffer.h" 23 #include "foundation/graphic/graphic_surface/interfaces/inner_api/surface/native_buffer_inner.h" 24 #include "foundation/graphic/graphic_surface/interfaces/inner_api/surface/surface_buffer.h" 25 #include "foundation/graphic/graphic_surface/interfaces/inner_api/surface/window.h" 26 27 namespace OHOS::NWeb { 28 29 class OhosNativeBufferAdapterImpl : public OhosNativeBufferAdapter { 30 public: 31 static OhosNativeBufferAdapter& GetInstance(); 32 33 OhosNativeBufferAdapterImpl(); 34 35 ~OhosNativeBufferAdapterImpl() override; 36 37 void AcquireBuffer(void* buffer) override; 38 39 void Release(void* buffer) override; 40 41 int GetEGLBuffer(void* buffer, void** eglBuffer) override; 42 43 int FreeEGLBuffer(void* eglBuffer) override; 44 45 int NativeBufferFromNativeWindowBuffer(void* nativeWindowBuffer, void** nativeBuffer) override; 46 47 uint32_t GetSeqNum(void* nativeBuffer) override; 48 }; 49 50 } // namespace OHOS::NWeb 51 52 #endif // OHOS_NATIVE_BUFFER_ADAPTER_IMPL_H 53