mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-23 15:11:51 +00:00
“codeCheck”
Signed-off-by: zhuxu <zhuxu43@huawei.com> Change-Id: I92a93e775f2ae8f36d26bea2ff432ace45170f86
This commit is contained in:
parent
da65b6590c
commit
2ef4a9abf8
@ -65,7 +65,7 @@ napi_value JsFontCollection::Constructor(napi_env env, napi_callback_info info)
|
||||
}
|
||||
|
||||
JsFontCollection* jsFontCollection = new(std::nothrow) JsFontCollection();
|
||||
if (jsFontCollection == nullptr){
|
||||
if (jsFontCollection == nullptr) {
|
||||
TEXT_LOGE("Failed to new font collection");
|
||||
return nullptr;
|
||||
}
|
||||
@ -392,7 +392,7 @@ napi_value JsFontCollection::OnLoadFont(napi_env env, napi_callback_info info)
|
||||
TEXT_LOGE("Failed to get argument, argc %{public}zu", argc);
|
||||
return nullptr;
|
||||
}
|
||||
if (argv[0] == nullptr){
|
||||
if (argv[0] == nullptr) {
|
||||
TEXT_LOGE("Argv[0] is invalid");
|
||||
return nullptr;
|
||||
}
|
||||
@ -403,7 +403,7 @@ napi_value JsFontCollection::OnLoadFont(napi_env env, napi_callback_info info)
|
||||
return nullptr;
|
||||
}
|
||||
napi_valuetype valueType = napi_undefined;
|
||||
if (argv[1] == nullptr){
|
||||
if (argv[1] == nullptr) {
|
||||
TEXT_LOGE("JsFontCollection::OnLoadFont Argv[1] is invalid");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ napi_value JsParagraph::OnPaint(napi_env env, napi_callback_info info)
|
||||
TEXT_LOGE("Failed to get parameter, argc %{public}zu, ret %{public}d", argc, status);
|
||||
return NapiThrowError(env, TextErrorCode::ERROR_INVALID_PARAM, "Invalid params.");
|
||||
}
|
||||
if (argv[0] == nullptr){
|
||||
if (argv[0] == nullptr) {
|
||||
TEXT_LOGE("Argv is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
@ -182,7 +182,7 @@ napi_value JsParagraph::OnPaint(napi_env env, napi_callback_info info)
|
||||
double y = 0.0;
|
||||
napi_unwrap(env, argv[0], reinterpret_cast<void **>(&jsCanvas));
|
||||
if (!jsCanvas || !jsCanvas->GetCanvas() ||
|
||||
!(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) &&
|
||||
!(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) &&
|
||||
argv[ARGC_TWO] != nullptr && ConvertFromJsValue(env, argv[ARGC_TWO], y))) {
|
||||
TEXT_LOGE("Failed to get paint parameter");
|
||||
return NapiGetUndefined(env);
|
||||
@ -385,19 +385,19 @@ napi_value JsParagraph::OnGetRectsForRange(napi_env env, napi_callback_info info
|
||||
TextRectWidthStyle wstyle;
|
||||
TextRectHeightStyle hstyle;
|
||||
napi_get_named_property(env, argv[0], "start", &tempValue);
|
||||
if (tempValue == nullptr){
|
||||
if (tempValue == nullptr) {
|
||||
TEXT_LOGE("Get start property failed");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
bool isStartOk = ConvertFromJsValue(env, tempValue, start);
|
||||
tempValue = nullptr;
|
||||
napi_get_named_property(env, argv[0], "end", &tempValue);
|
||||
if (tempValue == nullptr){
|
||||
if (tempValue == nullptr) {
|
||||
TEXT_LOGE("Get end property failed");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
bool isEndOk = ConvertFromJsValue(env, tempValue, end);
|
||||
if (!(isStartOk && isEndOk && argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], wstyle) &&
|
||||
if (!(isStartOk && isEndOk && argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], wstyle) &&
|
||||
argv[ARGC_TWO] != nullptr && ConvertFromJsValue(env, argv[ARGC_TWO], hstyle))) {
|
||||
TEXT_LOGE("Failed to convert, start ok:%{public}d, end ok:%{public}d", isStartOk, isEndOk);
|
||||
return NapiGetUndefined(env);
|
||||
@ -459,7 +459,7 @@ napi_value JsParagraph::OnGetGlyphPositionAtCoordinate(napi_env env, napi_callba
|
||||
}
|
||||
double dx = 0.0;
|
||||
double dy = 0.0;
|
||||
if (!(argv[0] != nullptr && ConvertFromJsValue(env, argv[0], dx) && argv[1] != nullptr &&
|
||||
if (!(argv[0] != nullptr && ConvertFromJsValue(env, argv[0], dx) && argv[1] != nullptr &&
|
||||
ConvertFromJsValue(env, argv[1], dy))) {
|
||||
TEXT_LOGE("Failed to convert");
|
||||
return NapiGetUndefined(env);
|
||||
@ -689,7 +689,7 @@ napi_value JsParagraph::OnGetFontMetricsByTextStyle(napi_env env, napi_callback_
|
||||
napi_value argv[ARGC_ONE] = {nullptr};
|
||||
napi_status status = napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
|
||||
if (status != napi_ok || argc < ARGC_ONE) {
|
||||
TEXT_LOGE("Argc is invalid: %{public}zu",argc);
|
||||
TEXT_LOGE("Argc is invalid: %{public}zu", argc);
|
||||
return NapiThrowError(env, TextErrorCode::ERROR_INVALID_PARAM, "Invalid params.");
|
||||
}
|
||||
TextStyle textStyle;
|
||||
@ -718,7 +718,7 @@ napi_value JsParagraph::OnGetLineFontMetrics(napi_env env, napi_callback_info in
|
||||
napi_value argv[ARGC_ONE] = {nullptr};
|
||||
napi_status status = napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr);
|
||||
if (status != napi_ok || argc < ARGC_ONE) {
|
||||
TEXT_LOGE("Argc is invalid: %{public}zu",argc);
|
||||
TEXT_LOGE("Argc is invalid: %{public}zu", argc);
|
||||
return NapiThrowError(env, TextErrorCode::ERROR_INVALID_PARAM, "Invalid params.");
|
||||
}
|
||||
int lineNumber = 0;
|
||||
|
@ -302,7 +302,7 @@ napi_value JsRun::OnPaint(napi_env env, napi_callback_info info)
|
||||
double y = 0.0;
|
||||
napi_unwrap(env, argv[0], reinterpret_cast<void **>(&jsCanvas));
|
||||
if (!jsCanvas || !jsCanvas->GetCanvas() ||
|
||||
!(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) &&
|
||||
!(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) &&
|
||||
argv[ARGC_TWO] != nullptr && ConvertFromJsValue(env, argv[ARGC_TWO], y))) {
|
||||
TEXT_LOGE("Failed to get paint parameter");
|
||||
return NapiGetUndefined(env);
|
||||
|
@ -282,7 +282,7 @@ napi_value JsTextLine::OnPaint(napi_env env, napi_callback_info info)
|
||||
}
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
if (!(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) &&
|
||||
if (!(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) &&
|
||||
argv[ARGC_TWO] != nullptr && ConvertFromJsValue(env, argv[ARGC_TWO], y))) {
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ bool GetParagraphStyleFromJS(napi_env env, napi_value argValue, TypographyStyle&
|
||||
if (tempValue != nullptr && napi_get_value_uint32(env, tempValue, &textDirection) == napi_ok) {
|
||||
pographyStyle.textDirection = TextDirection(textDirection);
|
||||
}
|
||||
SetAlignValueForParagraphStyle(env, argValue,pographyStyle);
|
||||
SetAlignValueForParagraphStyle(env, argValue, pographyStyle);
|
||||
tempValue = nullptr;
|
||||
napi_get_named_property(env, argValue, "wordBreak", &tempValue);
|
||||
uint32_t wordBreak = 0;
|
||||
|
@ -221,7 +221,7 @@ bool FontDescriptorCache::ProcessSystemFontType(const int32_t& systemFontType, i
|
||||
}
|
||||
|
||||
void FontDescriptorCache::GetSystemFontFullNamesByType(
|
||||
const int32_t &systemFontType,std::unordered_set<std::string> &fontList)
|
||||
const int32_t &systemFontType, std::unordered_set<std::string> &fontList)
|
||||
{
|
||||
int32_t fontType = 0;
|
||||
if (!ProcessSystemFontType(systemFontType, fontType)) {
|
||||
|
@ -109,7 +109,7 @@ void FontParser::SetNameString(FontParser::FontDescriptor& fontDescriptor, std::
|
||||
{
|
||||
bool willSet = field.empty();
|
||||
if (!willSet) {
|
||||
willSet = languageId == fontDescriptor.requestedLid ||
|
||||
willSet = languageId == fontDescriptor.requestedLid ||
|
||||
(fieldLid != fontDescriptor.requestedLid && languageId == LANGUAGE_DEFAULT);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ void Ranges::Dump() const
|
||||
for (const auto &[start, end, gid] : ranges_) {
|
||||
LOGSO_FUNC_LINE(INFO) << "0x" << std::uppercase << std::hex
|
||||
<< std::setw(4) << std::setfill('0') << start //4 means output width
|
||||
<< " ~ 0x" << std::uppercase << std::hex
|
||||
<< " ~ 0x" << std::uppercase << std::hex
|
||||
<< std::setw(4) << std::setfill('0') << end //4 means output width
|
||||
<< ": offset " << std::dec << end;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user