delete useless empty judge and correct format issues

Signed-off-by: 肖邵安 <xiaoshaoan@huawei.com>
This commit is contained in:
肖邵安 2024-10-11 19:04:09 +08:00
parent 7b5434af3e
commit 66a7790d6d
7 changed files with 9 additions and 28 deletions

View File

@ -104,7 +104,6 @@ public:
napi_async_work& work)
{
napi_value resource = nullptr;
status = napi_create_string_utf8(env, workName, NAPI_AUTO_LENGTH, &resource);
if (status == napi_ok) {
status = napi_create_async_work(
@ -117,7 +116,7 @@ public:
return status;
};
private:
EffectKitNapiUtils() {};
EffectKitNapiUtils() {}
};
} // namespace Rosen
} // namespace OHOS

View File

@ -63,6 +63,10 @@ static napi_value BuildJsColor(napi_env env, ColorManager::Color color);
static void CommonCallbackRoutine(napi_env env, ColorPickerAsyncContext* &asyncContext, const napi_value &valueParam)
{
if (asyncContext == nullptr) {
EFFECT_LOG_E("CommonCallback asyncContext is nullptr");
return;
}
napi_value result[NUM_2] = {0};
napi_value retVal;
napi_value callback = nullptr;
@ -70,10 +74,6 @@ static void CommonCallbackRoutine(napi_env env, ColorPickerAsyncContext* &asyncC
napi_get_undefined(env, &result[NUM_0]);
napi_get_undefined(env, &result[NUM_1]);
if (asyncContext == nullptr) {
EFFECT_LOG_E("CommonCallback asyncContext is nullptr");
return;
}
if (asyncContext->status == SUCCESS) {
result[NUM_1] = valueParam;
} else if (asyncContext->errorMsg != nullptr) {
@ -345,11 +345,6 @@ std::unique_ptr<ColorPickerAsyncContext> ColorPickerNapi::InitializeAsyncContext
napi_env env, napi_status& status, napi_value* argValue, size_t argCount)
{
auto asyncContext = std::make_unique<ColorPickerAsyncContext>();
if (asyncContext == nullptr) {
EFFECT_LOG_E("ColorPickerNapi::CreateColorPicker asyncContext is nullptr");
return nullptr;
}
if (argCount >= NUM_1) {
ImageType imgType = ParserArgumentType(env, argValue[NUM_1 - 1]);
if (imgType == ImageType::TYPE_PIXEL_MAP) {

View File

@ -427,7 +427,7 @@ napi_value FilterNapi::GetPixelMapAsync(napi_env env, napi_callback_info info)
if (ctx->callback == nullptr) {
napi_create_promise(env, &(ctx->deferred), &result);
}
{
std::unique_lock<std::shared_mutex> lock(filterNapiManagerMutex);
filterNapiManager[ctx->filterNapi].store(false);

View File

@ -57,7 +57,7 @@ public:
// Specified number of extracted theme colors, default value is 10;
int specifiedFeatureColorNum_ = 10;
std::vector<uint32_t> hist_;
std::vector<uint32_t> hist_;
int distinctColorCount_ = 0;
std::vector<uint32_t> colors_;

View File

@ -77,13 +77,6 @@ std::shared_ptr<ColorPicker> ColorPicker::CreateColorPicker(const std::shared_pt
return nullptr;
}
std::shared_ptr<ColorPicker> colorPicker = std::make_shared<ColorPicker>(scaledPixelMap);
if (colorPicker == nullptr) {
EFFECT_LOG_I("[ColorPicker]failed to create ColorPicker with pixmap.");
errorCode = ERR_EFFECT_INVALID_VALUE;
return nullptr;
}
errorCode = SUCCESS;
return colorPicker;
}
@ -99,13 +92,6 @@ std::shared_ptr<ColorPicker> ColorPicker::CreateColorPicker(const std::shared_pt
std::shared_ptr<Media::PixelMap> scaledPixelMap = CreateScaledPixelMap(pixmap);
std::shared_ptr<ColorPicker> colorPicker = std::make_shared<ColorPicker>(scaledPixelMap, coordinates);
if (colorPicker == nullptr) {
EFFECT_LOG_I("[ColorPicker]failed to create ColorPicker with pixmap.");
errorCode = ERR_EFFECT_INVALID_VALUE;
return nullptr;
}
errorCode = SUCCESS;
return colorPicker;
}

View File

@ -35,7 +35,7 @@ public:
std::string GetFragmentShader() override;
private:
void DoProcess(ProcessData& data) override;
void LoadFilterParams() override{};
void LoadFilterParams() override {}
std::unique_ptr<ScaleFilter> upSampleFilter_ = nullptr;
std::unique_ptr<ScaleFilter> downSampleFilter_ = nullptr;
std::unique_ptr<HorizontalBlurFilter> horizontalBlurFilter_ = nullptr;

View File

@ -50,6 +50,7 @@ SKImageChain::~SKImageChain()
cpuSurface_ = nullptr;
image_ = nullptr;
}
void SKImageChain::InitWithoutCanvas()
{
if (srcPixelMap_ == nullptr) {