You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.5 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd. 2021-2023. All rights reserved.
* Description: Error code for all modules
* Author: Hisilicon
* Created: 2021.04.16
*/
#ifndef IMAGEKIT_IMAGE_ERR_H
#define IMAGEKIT_IMAGE_ERR_H
namespace PhoenixImage {
#define SUCCESS IMAGE_ERROR_NONE
#define FAILURE -1
typedef enum {
IMAGE_MAGIC = 0,
IMAGE_BUF,
IMAGE_TEXTURE,
IMAGE_TARGET,
IMAGE_CONTEXT,
IMAGE_RENDERER,
IMAGE_FILTER,
IMAGE_EGL,
IMAGE_WSI,
IMAGE_ALL
} IMAGE_MODULE_ID;
/**
* @name ImageMagic error types
* @brief The common error type for the ImageMagic
*/
typedef enum {
/**
* @brief Common errors for the ImageMagic
* IMAGE_ERROR_NONE is guaranteed to be 0.
* @{
*/
IMAGE_ERROR_NONE = 0,
IMAGE_ERROR_NULLPTR,
IMAGE_ERROR_OUT_OF_MEMORY,
IMAGE_ERROR_OUT_OF_RANGE,
IMAGE_ERROR_INVALID_VALUE,
IMAGE_ERROR_INVALID_CONTEXT,
IMAGE_ERROR_INVALID_PROGRAM,
} IMAGE_ERROR;
#define err_code(module, errno) ((0x1 << 31) | (module << 16) | errno)
#define magic_error(errno) err_code(IMAGE_MAGIC, errno)
#define buf_error(errno) err_code(IMAGE_BUF, errno)
#define texture_error(errno) err_code(IMAGE_TEXTURE, errno)
#define target_error(errno) err_code(IMAGE_TARGET, errno)
#define context_error(errno) err_code(IMAGE_CONTEXT, errno)
#define renderer_error(errno) err_code(IMAGE_RENDERER, errno)
#define filter_error(errno) err_code(IMAGE_FILTER, errno)
#define egl_error(errno) err_code(IMAGE_EGL, errno)
#define wsi_error(errno) err_code(IMAGE_WSI, errno)
}
#endif