14ed2deddSopenharmony_ci/* 24ed2deddSopenharmony_ci * Copyright (c) 2020-2022 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#ifndef GRAPHIC_LITE_BUFFER_COMMON_H 174ed2deddSopenharmony_ci#define GRAPHIC_LITE_BUFFER_COMMON_H 184ed2deddSopenharmony_ci 194ed2deddSopenharmony_ci#include "gfx_utils/graphic_log.h" 204ed2deddSopenharmony_ci 214ed2deddSopenharmony_cinamespace OHOS { 224ed2deddSopenharmony_ci#define RETURN_VAL_IF_FAIL(cond, val) { \ 234ed2deddSopenharmony_ci if (!(cond)) { \ 244ed2deddSopenharmony_ci GRAPHIC_LOGD("'%s' failed.", #cond); \ 254ed2deddSopenharmony_ci return val; \ 264ed2deddSopenharmony_ci } \ 274ed2deddSopenharmony_ci} 284ed2deddSopenharmony_ci 294ed2deddSopenharmony_ci#define RETURN_IF_FAIL(cond) { \ 304ed2deddSopenharmony_ci if (!(cond)) { \ 314ed2deddSopenharmony_ci GRAPHIC_LOGD("'%s' failed.", #cond); \ 324ed2deddSopenharmony_ci return; \ 334ed2deddSopenharmony_ci } \ 344ed2deddSopenharmony_ci} 354ed2deddSopenharmony_ci 364ed2deddSopenharmony_cienum BufferErrorCode { 374ed2deddSopenharmony_ci SURFACE_ERROR_INVALID_PARAM = -10, 384ed2deddSopenharmony_ci SURFACE_ERROR_INVALID_REQUEST, 394ed2deddSopenharmony_ci SURFACE_ERROR_NOT_READY, 404ed2deddSopenharmony_ci SURFACE_ERROR_SYSTEM_ERROR, 414ed2deddSopenharmony_ci SURFACE_ERROR_BUFFER_NOT_EXISTED, 424ed2deddSopenharmony_ci SURFACE_ERROR_OK = 0, 434ed2deddSopenharmony_ci}; 444ed2deddSopenharmony_ci} // end namespace 454ed2deddSopenharmony_ci#endif 46