14ed2deddSopenharmony_ci/* 24ed2deddSopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 34ed2deddSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 44ed2deddSopenharmony_ci * you may not use this file except in compliance with the License. 54ed2deddSopenharmony_ci * You may obtain a copy of the License at 64ed2deddSopenharmony_ci * 74ed2deddSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 84ed2deddSopenharmony_ci * 94ed2deddSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 104ed2deddSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 114ed2deddSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 124ed2deddSopenharmony_ci * See the License for the specific language governing permissions and 134ed2deddSopenharmony_ci * limitations under the License. 144ed2deddSopenharmony_ci */ 154ed2deddSopenharmony_ci 164ed2deddSopenharmony_ci#include "surface.h" 174ed2deddSopenharmony_ci#include "surface_impl.h" 184ed2deddSopenharmony_ci 194ed2deddSopenharmony_cinamespace OHOS { 204ed2deddSopenharmony_ciSurface* Surface::CreateSurface() 214ed2deddSopenharmony_ci{ 224ed2deddSopenharmony_ci SurfaceImpl* surface = new SurfaceImpl(); 234ed2deddSopenharmony_ci if (surface != nullptr) { 244ed2deddSopenharmony_ci if (surface->Init()) { 254ed2deddSopenharmony_ci return reinterpret_cast<Surface *>(surface); 264ed2deddSopenharmony_ci } else { 274ed2deddSopenharmony_ci GRAPHIC_LOGE("surface init failed"); 284ed2deddSopenharmony_ci delete surface; 294ed2deddSopenharmony_ci } 304ed2deddSopenharmony_ci } 314ed2deddSopenharmony_ci GRAPHIC_LOGE("Create surface failed"); 324ed2deddSopenharmony_ci return nullptr; 334ed2deddSopenharmony_ci} 344ed2deddSopenharmony_ci 354ed2deddSopenharmony_ciSurface::~Surface() 364ed2deddSopenharmony_ci{ 374ed2deddSopenharmony_ci} 384ed2deddSopenharmony_ci} // namespace OHOS 39