1/*
2 * Copyright (c) 2020-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 GRAPHIC_LITE_BUFFER_COMMON_H
17#define GRAPHIC_LITE_BUFFER_COMMON_H
18
19#include "gfx_utils/graphic_log.h"
20
21namespace OHOS {
22#define RETURN_VAL_IF_FAIL(cond, val) { \
23    if (!(cond)) {                      \
24        GRAPHIC_LOGD("'%s' failed.", #cond);    \
25        return val;                     \
26    }                                   \
27}
28
29#define RETURN_IF_FAIL(cond) {          \
30    if (!(cond)) {                      \
31        GRAPHIC_LOGD("'%s' failed.", #cond);    \
32        return;                         \
33    }                                   \
34}
35
36enum BufferErrorCode {
37    SURFACE_ERROR_INVALID_PARAM = -10,
38    SURFACE_ERROR_INVALID_REQUEST,
39    SURFACE_ERROR_NOT_READY,
40    SURFACE_ERROR_SYSTEM_ERROR,
41    SURFACE_ERROR_BUFFER_NOT_EXISTED,
42    SURFACE_ERROR_OK = 0,
43};
44} // end namespace
45#endif
46