1 /* 2 * Copyright (c) 2022 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 SURFACE_OHOS_GL_H 17 #define SURFACE_OHOS_GL_H 18 19 #include <surface.h> 20 #include "surface.h" 21 #include "surface_ohos.h" 22 #include "surface_frame_ohos_gl.h" 23 #include "window.h" 24 25 namespace OHOS { 26 namespace Rosen { 27 class SurfaceOhosGl : public SurfaceOhos { 28 public: 29 explicit SurfaceOhosGl(const sptr<Surface>& producer); 30 ~SurfaceOhosGl() override; 31 IsValid()32 bool IsValid() const override 33 { 34 return producer_ != nullptr; 35 } 36 37 std::unique_ptr<SurfaceFrame> RequestFrame(int32_t width, int32_t height) override; 38 std::unique_ptr<SurfaceFrame> NativeRequestFrame(int32_t width, int32_t height) override; 39 bool FlushFrame(std::unique_ptr<SurfaceFrame>& frame) override; 40 bool NativeFlushFrame(std::unique_ptr<SurfaceFrame>& frame) override; 41 SkCanvas* GetSkCanvas(std::unique_ptr<SurfaceFrame>& frame) override; 42 Drawing::Canvas* GetCanvas(std::unique_ptr<SurfaceFrame>& frame) override; 43 private: 44 std::unique_ptr<SurfaceFrameOhosGl> frame_; 45 }; 46 } // namespace Rosen 47 } // namespace OHOS 48 #endif 49