mirror of
https://gitee.com/openharmony/multimedia_image_effect
synced 2024-10-06 21:44:25 +00:00
AI-REVIEWER告警清理
Signed-off-by: 秦川钞 <qinchuanchao@h-partners.com>
This commit is contained in:
parent
afa8feb9bc
commit
38761f38b8
@ -31,6 +31,7 @@ void PipelineCore::Init(EventReceiver *receiver)
|
||||
|
||||
ErrorCode PipelineCore::Prepare()
|
||||
{
|
||||
CHECK_AND_RETURN_RET_LOG(!filters_.empty(), ErrorCode::ERR_PARAM_INVALID, "PipelineCore Prepare filters is null!");
|
||||
state_ = FilterState::PREPARING;
|
||||
|
||||
// Set source buffer to source filter
|
||||
@ -44,6 +45,7 @@ ErrorCode PipelineCore::Prepare()
|
||||
|
||||
ErrorCode PipelineCore::Start()
|
||||
{
|
||||
CHECK_AND_RETURN_RET_LOG(!filters_.empty(), ErrorCode::ERR_PARAM_INVALID, "PipelineCore Start filters is null!");
|
||||
state_ = FilterState::RUNNING;
|
||||
auto sourceEffect = filters_[0];
|
||||
if (sourceEffect) {
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "graphic/render_program.h"
|
||||
#include <GLES3/gl3.h>
|
||||
#include <effect_log.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Media {
|
||||
@ -23,24 +24,38 @@ RenderProgram::RenderProgram(RenderContext *context) : program_(0), context_(con
|
||||
|
||||
void RenderProgram::SetUniform(const std::string &name, float value)
|
||||
{
|
||||
glUniform1f(glGetUniformLocation(program_, name.c_str()), value);
|
||||
CHECK_AND_RETURN_LOG(program_ != 0, "RenderProgram SetUniform failed!, name=%{public}s, program=%{public}d",
|
||||
name.c_str(), program_);
|
||||
GLint location = glGetUniformLocation(program_, name.c_str());
|
||||
CHECK_AND_RETURN_LOG(location != -1, "glGetUniformLocation failed!, name=%{public}s", name.c_str());
|
||||
glUniform1f(location, value);
|
||||
}
|
||||
|
||||
void RenderProgram::SetUniform(const std::string &name, int value)
|
||||
{
|
||||
glUniform1i(glGetUniformLocation(program_, name.c_str()), value);
|
||||
CHECK_AND_RETURN_LOG(program_ != 0, "RenderProgram SetUniform failed!, name=%{public}s, program=%{public}d",
|
||||
name.c_str(), program_);
|
||||
GLint location = glGetUniformLocation(program_, name.c_str());
|
||||
CHECK_AND_RETURN_LOG(location != -1, "glGetUniformLocation failed!, name=%{public}s", name.c_str());
|
||||
glUniform1i(location, value);
|
||||
}
|
||||
|
||||
void RenderProgram::SetUniform(const std::string &name, unsigned int value)
|
||||
{
|
||||
glUniform1ui(glGetUniformLocation(program_, name.c_str()), value);
|
||||
CHECK_AND_RETURN_LOG(program_ != 0, "RenderProgram SetUniform failed!, name=%{public}s, program=%{public}d",
|
||||
name.c_str(), program_);
|
||||
GLint location = glGetUniformLocation(program_, name.c_str());
|
||||
CHECK_AND_RETURN_LOG(location != -1, "glGetUniformLocation failed!, name=%{public}s", name.c_str());
|
||||
glUniform1ui(location, value);
|
||||
}
|
||||
|
||||
void RenderProgram::SetUniform(const std::string &name, const void *value)
|
||||
{
|
||||
glUniformMatrix4fv(glGetUniformLocation(program_, name.c_str()), 1, GL_FALSE,
|
||||
reinterpret_cast<const GLfloat *>(value));
|
||||
}
|
||||
CHECK_AND_RETURN_LOG(program_ != 0, "RenderProgram SetUniform failed!, name=%{public}s, program=%{public}d",
|
||||
name.c_str(), program_);
|
||||
GLint location = glGetUniformLocation(program_, name.c_str());
|
||||
CHECK_AND_RETURN_LOG(location != -1, "glGetUniformLocation failed!, name=%{public}s", name.c_str());
|
||||
glUniformMatrix4fv(location, 1, GL_FALSE, reinterpret_cast<const GLfloat *>(value));
|
||||
|
||||
void RenderProgram::Bind()
|
||||
{
|
||||
|
@ -40,6 +40,7 @@ RenderAttribute RenderSurface::GetAttrib()
|
||||
|
||||
bool RenderSurface::Create(void *window)
|
||||
{
|
||||
CHECK_AND_RETURN_RET_LOG(window != nullptr, false, "RenderSurface Create window is null!");
|
||||
EGLint retNum = 0;
|
||||
display_ = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
std::vector<int> attributeList = attribute_.ToEGLAttribList();
|
||||
|
@ -32,11 +32,11 @@ static const std::map<ErrorCode, const char*> g_ErrorTypeMap = {
|
||||
{ErrorCode::ERR_PERMISSION_DENIED, "ERROR_PERMISSION_DENIED"}
|
||||
};
|
||||
|
||||
const char *GetErrorName(ErrorCode code)
|
||||
std::string GetErrorName(ErrorCode code)
|
||||
{
|
||||
auto it = g_ErrorTypeMap.find(code);
|
||||
if (it != g_ErrorTypeMap.end()) {
|
||||
return it->second;
|
||||
return std::string(it->second);
|
||||
}
|
||||
return "Unknow error type";
|
||||
}
|
||||
|
@ -130,8 +130,8 @@ ErrorCode CheckConverterInfo(FormatConverterInfo &src, FormatConverterInfo &dst)
|
||||
BufferInfo &srcBuffInfo = src.bufferInfo;
|
||||
BufferInfo &dstBuffInfo = dst.bufferInfo;
|
||||
if (srcBuffInfo.width_ != dstBuffInfo.width_ || srcBuffInfo.height_ != dstBuffInfo.height_) {
|
||||
EFFECT_LOGW("CheckConverterInfo: diff size! srcW=%{public}d, srcH=%{public}d, dstW=%{public}d, dstW=%{public}d",
|
||||
srcBuffInfo.width_, dstBuffInfo.width_, srcBuffInfo.height_, dstBuffInfo.height_);
|
||||
EFFECT_LOGW("CheckConverterInfo: diff size! srcW=%{public}d, srcH=%{public}d, dstW=%{public}d, dstH=%{public}d",
|
||||
srcBuffInfo.width_, srcBuffInfo.height_, dstBuffInfo.width_, dstBuffInfo.height_);
|
||||
}
|
||||
|
||||
EFFECT_LOGD("CheckConverterInfo: src{w=%{public}d h=%{public}d format=%{public}d len=%{public}d stride=%{public}d},"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#define IMAGE_EFFECT_ERROR_CODE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Media {
|
||||
@ -118,7 +119,7 @@ enum struct ErrorCode : int32_t {
|
||||
ERR_GL_COPY_PIXELS_FAILED = ERR_UNKNOWN + 206,
|
||||
};
|
||||
|
||||
const char *GetErrorName(ErrorCode code);
|
||||
std::string GetErrorName(ErrorCode code);
|
||||
|
||||
#ifndef FALSE_RETURN_MSG_W
|
||||
#define FALSE_RETURN_MSG_W(exec, ret, fmt, args...) \
|
||||
@ -158,7 +159,7 @@ const char *GetErrorName(ErrorCode code);
|
||||
do { \
|
||||
ErrorCode returnValue = (exec); \
|
||||
if (returnValue != ErrorCode::SUCCESS) { \
|
||||
EFFECT_LOGE("FAIL_RETURN on ErrorCode(%{public}s).", GetErrorName(returnValue)); \
|
||||
EFFECT_LOGE("FAIL_RETURN on ErrorCode(%{public}s).", GetErrorName(returnValue).c_str()); \
|
||||
return returnValue; \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -347,8 +347,8 @@ HWTEST_F(TestUtils, NativeCommonUtils001, TestSize.Level1) {
|
||||
|
||||
HWTEST_F(TestUtils, ErrorCode001, TestSize.Level1) {
|
||||
ErrorCode code = ErrorCode::ERR_PERMISSION_DENIED;
|
||||
const char *expected = "ERROR_PERMISSION_DENIED";
|
||||
const char *actual = GetErrorName(code);
|
||||
std::string expected = "ERROR_PERMISSION_DENIED";
|
||||
std::string actual = GetErrorName(code);
|
||||
ASSERT_EQ(expected, actual);
|
||||
|
||||
code = ErrorCode::ERR_INPUT_NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user