1 /* 2 * Copyright (c) 2021-2023 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 ROSENRENDER_ROSEN_WEBGL_RENDERING_CONTEXT 17 #define ROSENRENDER_ROSEN_WEBGL_RENDERING_CONTEXT 18 19 #include "webgl_rendering_context_base.h" 20 #include "webgl_rendering_context_overloads.h" 21 #include "webgl_rendering_context_base_impl.h" 22 #include "napi/n_exporter.h" 23 24 namespace OHOS { 25 namespace Rosen { 26 class WebGLRenderingContext : public WebGLRenderingContextBasicBase, public WebGLRenderingContextBase, 27 public WebGLRenderingContextOverloads, public NExporter { 28 public: 29 inline static const std::string className = "WebGLRenderingContext"; 30 31 bool Export(napi_env env, napi_value exports) override; 32 33 std::string GetClassName() override; 34 35 WebGLRenderingContext(napi_env env, napi_value exports); 36 WebGLRenderingContext()37 explicit WebGLRenderingContext() : WebGLRenderingContextBasicBase(), contextImpl_(0, this) {}; 38 39 virtual ~WebGLRenderingContext(); 40 GetWebGLRenderingContextImpl()41 Impl::WebGLRenderingContextBaseImpl &GetWebGLRenderingContextImpl() 42 { 43 return contextImpl_; 44 } 45 Init()46 void Init() override 47 { 48 WebGLRenderingContextBasicBase::Init(); 49 contextImpl_.Init(); 50 } 51 private: 52 Impl::WebGLRenderingContextBaseImpl contextImpl_; 53 }; 54 } // namespace Rosen 55 } // namespace OHOS 56 57 #endif // ROSENRENDER_ROSEN_WEBGL_RENDERING_CONTEXT 58