mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-23 15:11:51 +00:00
recording save bugfix && return null optimization
Signed-off-by: ustc-tianyu <dutianyu4@huawei.com>
This commit is contained in:
parent
41d3cf9ed3
commit
cf3e6d055f
@ -125,7 +125,7 @@ napi_value JsBrush::SetColor(napi_env env, napi_callback_info info)
|
||||
|
||||
Color color(Color::ColorQuadSetARGB(argb[ARGC_ZERO], argb[ARGC_ONE], argb[ARGC_TWO], argb[ARGC_THREE]));
|
||||
brush->SetColor(color);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsBrush::SetAntiAlias(napi_env env, napi_callback_info info)
|
||||
@ -152,7 +152,7 @@ napi_value JsBrush::SetAntiAlias(napi_env env, napi_callback_info info)
|
||||
}
|
||||
|
||||
brush->SetAntiAlias(aa);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsBrush::SetAlpha(napi_env env, napi_callback_info info)
|
||||
@ -178,7 +178,7 @@ napi_value JsBrush::SetAlpha(napi_env env, napi_callback_info info)
|
||||
}
|
||||
|
||||
brush->SetAlpha(alpha);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsBrush::SetColorFilter(napi_env env, napi_callback_info info)
|
||||
@ -195,19 +195,14 @@ napi_value JsBrush::SetColorFilter(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_value argv[ARGC_ONE] = {nullptr};
|
||||
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_ONE);
|
||||
CHECK_EACH_PARAM(ARGC_ZERO, napi_object);
|
||||
|
||||
JsColorFilter* jsColorFilter = nullptr;
|
||||
napi_unwrap(env, argv[0], reinterpret_cast<void **>(&jsColorFilter));
|
||||
if (jsColorFilter == nullptr) {
|
||||
ROSEN_LOGE("JsBrush::SetColorFilter jsColorFilter is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
Filter filter = brush->GetFilter();
|
||||
filter.SetColorFilter(jsColorFilter->GetColorFilter());
|
||||
filter.SetColorFilter(jsColorFilter ? jsColorFilter->GetColorFilter() : nullptr);
|
||||
brush->SetFilter(filter);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsBrush::SetMaskFilter(napi_env env, napi_callback_info info)
|
||||
@ -225,19 +220,14 @@ napi_value JsBrush::SetMaskFilter(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_value argv[ARGC_ONE] = {nullptr};
|
||||
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_ONE);
|
||||
CHECK_EACH_PARAM(ARGC_ZERO, napi_object);
|
||||
|
||||
JsMaskFilter* jsMaskFilter = nullptr;
|
||||
napi_unwrap(env, argv[ARGC_ZERO], reinterpret_cast<void **>(&jsMaskFilter));
|
||||
if (jsMaskFilter == nullptr) {
|
||||
ROSEN_LOGE("JsBrush::SetMaskFilter jsMaskFilter is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
Filter filter = brush->GetFilter();
|
||||
filter.SetMaskFilter(jsMaskFilter->GetMaskFilter());
|
||||
filter.SetMaskFilter(jsMaskFilter ? jsMaskFilter->GetMaskFilter() : nullptr);
|
||||
brush->SetFilter(filter);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsBrush::SetBlendMode(napi_env env, napi_callback_info info)
|
||||
@ -259,7 +249,7 @@ napi_value JsBrush::SetBlendMode(napi_env env, napi_callback_info info)
|
||||
GET_INT32_CHECK_GE_ZERO_PARAM(ARGC_ZERO, mode);
|
||||
|
||||
brush->SetBlendMode(static_cast<BlendMode>(mode));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsBrush::SetShadowLayer(napi_env env, napi_callback_info info)
|
||||
@ -277,16 +267,12 @@ napi_value JsBrush::SetShadowLayer(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_value argv[ARGC_ONE] = {nullptr};
|
||||
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_ONE);
|
||||
CHECK_EACH_PARAM(ARGC_ZERO, napi_object);
|
||||
|
||||
JsShadowLayer* jsShadowLayer = nullptr;
|
||||
napi_unwrap(env, argv[ARGC_ZERO], reinterpret_cast<void **>(&jsShadowLayer));
|
||||
if (jsShadowLayer == nullptr) {
|
||||
ROSEN_LOGE("JsBrush::SetShadowLayer jsShadowLayer is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
brush->SetLooper(jsShadowLayer->GetBlurDrawLooper());
|
||||
return NapiGetUndefined(env);
|
||||
|
||||
brush->SetLooper(jsShadowLayer ? jsShadowLayer->GetBlurDrawLooper() : nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Brush* JsBrush::GetBrush()
|
||||
|
@ -473,7 +473,7 @@ napi_value JsCanvas::OnDrawRect(napi_env env, napi_callback_info info)
|
||||
}
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_canvas->DrawRect(drawingRect));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::DrawCircle(napi_env env, napi_callback_info info)
|
||||
@ -501,7 +501,7 @@ napi_value JsCanvas::OnDrawCircle(napi_env env, napi_callback_info info)
|
||||
|
||||
Drawing::Point centerPt = Drawing::Point(x, y);
|
||||
JS_CALL_DRAWING_FUNC(m_canvas->DrawCircle(centerPt, radius));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::DrawImage(napi_env env, napi_callback_info info)
|
||||
@ -531,18 +531,18 @@ napi_value JsCanvas::OnDrawImage(napi_env env, napi_callback_info info)
|
||||
napi_unwrap(env, argv[0], reinterpret_cast<void**>(&pixelMapNapi));
|
||||
if (pixelMapNapi == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::OnDrawImage Argv is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (pixelMapNapi->GetPixelNapiInner() == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::OnDrawImage pixelmap GetPixelNapiInner is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<Drawing::Image> image = ExtractDrawingImage(pixelMapNapi->GetPixelNapiInner());
|
||||
if (image == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::OnDrawImage image is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (argc == ARGC_THREE) {
|
||||
@ -553,19 +553,19 @@ napi_value JsCanvas::OnDrawImage(napi_env env, napi_callback_info info)
|
||||
napi_unwrap(env, argv[ARGC_THREE], reinterpret_cast<void **>(&jsSamplingOptions));
|
||||
if (jsSamplingOptions == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::OnDrawImage jsSamplingOptions is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<SamplingOptions> samplingOptions = jsSamplingOptions->GetSamplingOptions();
|
||||
if (samplingOptions == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::OnDrawImage get samplingOptions is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
JS_CALL_DRAWING_FUNC(m_canvas->DrawImage(*image, px, py, *samplingOptions.get()));
|
||||
}
|
||||
|
||||
#endif
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::DrawColor(napi_env env, napi_callback_info info)
|
||||
@ -621,7 +621,7 @@ napi_value JsCanvas::OnDrawColor(napi_env env, napi_callback_info info)
|
||||
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Invalid params.");
|
||||
}
|
||||
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::DrawPoint(napi_env env, napi_callback_info info)
|
||||
@ -646,7 +646,7 @@ napi_value JsCanvas::OnDrawPoint(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_ONE, py);
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_canvas->DrawPoint(Point(px, py)));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::DrawPath(napi_env env, napi_callback_info info)
|
||||
@ -670,16 +670,16 @@ napi_value JsCanvas::OnDrawPath(napi_env env, napi_callback_info info)
|
||||
napi_unwrap(env, argv[0], reinterpret_cast<void**>(&jsPath));
|
||||
if (jsPath == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::OnDrawPath jsPath is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (jsPath->GetPath() == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::OnDrawPath path is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_canvas->DrawPath(*jsPath->GetPath()));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::DrawLine(napi_env env, napi_callback_info info)
|
||||
@ -708,7 +708,7 @@ napi_value JsCanvas::OnDrawLine(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_THREE, endPy);
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_canvas->DrawLine(Point(startPx, startPy), Point(endPx, endPy)));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::DrawText(napi_env env, napi_callback_info info)
|
||||
@ -732,7 +732,7 @@ napi_value JsCanvas::OnDrawText(napi_env env, napi_callback_info info)
|
||||
napi_unwrap(env, argv[ARGC_ZERO], reinterpret_cast<void **>(&jsTextBlob));
|
||||
if (jsTextBlob == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::OnDrawText Argv is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
double x = 0.0;
|
||||
GET_DOUBLE_PARAM(ARGC_ONE, x);
|
||||
@ -740,7 +740,7 @@ napi_value JsCanvas::OnDrawText(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_TWO, y);
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_canvas->DrawTextBlob(jsTextBlob->GetTextBlob().get(), x, y));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::DrawPixelMapMesh(napi_env env, napi_callback_info info)
|
||||
@ -807,7 +807,7 @@ napi_value JsCanvas::OnDrawPixelMapMesh(napi_env env, napi_callback_info info)
|
||||
if (!isVertexOk) {
|
||||
ROSEN_LOGE("JsCanvas::OnDrawPixelMapMesh vertex is invalid");
|
||||
delete []vertices;
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
vertices[i] = vertex;
|
||||
}
|
||||
@ -827,7 +827,7 @@ napi_value JsCanvas::OnDrawPixelMapMesh(napi_env env, napi_callback_info info)
|
||||
if (colorsSize == 0) {
|
||||
DrawingPixelMapMesh(pixelMap, column, row, verticesMesh, nullptr, m_canvas);
|
||||
delete []vertices;
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto colors = new uint32_t[colorsSize];
|
||||
@ -840,7 +840,7 @@ napi_value JsCanvas::OnDrawPixelMapMesh(napi_env env, napi_callback_info info)
|
||||
ROSEN_LOGE("JsCanvas::OnDrawPixelMapMesh color is invalid");
|
||||
delete []vertices;
|
||||
delete []colors;
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
colors[i] = color;
|
||||
}
|
||||
@ -849,7 +849,7 @@ napi_value JsCanvas::OnDrawPixelMapMesh(napi_env env, napi_callback_info info)
|
||||
DrawingPixelMapMesh(pixelMap, column, row, verticesMesh, colorsMesh, m_canvas);
|
||||
delete []vertices;
|
||||
delete []colors;
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
@ -875,14 +875,14 @@ napi_value JsCanvas::AttachPen(napi_env env, napi_callback_info info)
|
||||
napi_unwrap(env, argv[0], reinterpret_cast<void **>(&jsPen));
|
||||
if (jsPen == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::AttachPen jsPen is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
if (jsPen->GetPen() == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::AttachPen pen is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
JS_CALL_DRAWING_FUNC(canvas->AttachPen(*jsPen->GetPen()));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::AttachBrush(napi_env env, napi_callback_info info)
|
||||
@ -905,14 +905,14 @@ napi_value JsCanvas::AttachBrush(napi_env env, napi_callback_info info)
|
||||
napi_unwrap(env, argv[0], reinterpret_cast<void **>(&jsBrush));
|
||||
if (jsBrush == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::AttachBrush jsBrush is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
if (jsBrush->GetBrush() == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::AttachBrush brush is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
JS_CALL_DRAWING_FUNC(canvas->AttachBrush(*jsBrush->GetBrush()));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::DetachPen(napi_env env, napi_callback_info info)
|
||||
@ -927,7 +927,7 @@ napi_value JsCanvas::DetachPen(napi_env env, napi_callback_info info)
|
||||
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Invalid params.");
|
||||
}
|
||||
JS_CALL_DRAWING_FUNC(canvas->DetachPen());
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::DetachBrush(napi_env env, napi_callback_info info)
|
||||
@ -942,7 +942,7 @@ napi_value JsCanvas::DetachBrush(napi_env env, napi_callback_info info)
|
||||
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Invalid params.");
|
||||
}
|
||||
JS_CALL_DRAWING_FUNC(canvas->DetachBrush());
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::Skew(napi_env env, napi_callback_info info)
|
||||
@ -967,7 +967,7 @@ napi_value JsCanvas::OnSkew(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_ONE, sy);
|
||||
|
||||
m_canvas->Shear(sx, sy);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::Rotate(napi_env env, napi_callback_info info)
|
||||
@ -994,7 +994,7 @@ napi_value JsCanvas::OnRotate(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_TWO, sx);
|
||||
|
||||
m_canvas->Rotate(degree, sx, sy);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::GetSaveCount(napi_env env, napi_callback_info info)
|
||||
@ -1033,16 +1033,16 @@ napi_value JsCanvas::OnClipPath(napi_env env, napi_callback_info info)
|
||||
napi_unwrap(env, argv[ARGC_ZERO], reinterpret_cast<void **>(&jsPath));
|
||||
if (jsPath == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::OnClipPath jsPath is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
Path* path = jsPath->GetPath();
|
||||
if (path == nullptr) {
|
||||
ROSEN_LOGE("JsCanvas::OnClipPath path is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
if (argc == ARGC_ONE) {
|
||||
m_canvas->ClipPath(*path);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t jsClipOp = 0;
|
||||
@ -1050,16 +1050,16 @@ napi_value JsCanvas::OnClipPath(napi_env env, napi_callback_info info)
|
||||
|
||||
if (argc == ARGC_TWO) {
|
||||
m_canvas->ClipPath(*path, static_cast<ClipOp>(jsClipOp));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
CHECK_EACH_PARAM(ARGC_TWO, napi_boolean);
|
||||
bool jsDoAntiAlias = false;
|
||||
if (!ConvertFromJsValue(env, argv[ARGC_TWO], jsDoAntiAlias)) {
|
||||
ROSEN_LOGE("JsCanvas::OnClipPath argv[2] is error");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
m_canvas->ClipPath(*path, static_cast<ClipOp>(jsClipOp), jsDoAntiAlias);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::Translate(napi_env env, napi_callback_info info)
|
||||
@ -1084,7 +1084,7 @@ napi_value JsCanvas::OnTranslate(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_ONE, dy);
|
||||
|
||||
m_canvas->Translate(dx, dy);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::Save(napi_env env, napi_callback_info info)
|
||||
@ -1122,7 +1122,7 @@ napi_value JsCanvas::OnRestoreToCount(napi_env env, napi_callback_info info)
|
||||
GET_INT32_CHECK_GE_ZERO_PARAM(ARGC_ZERO, count);
|
||||
|
||||
m_canvas->RestoreToCount(count);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::Restore(napi_env env, napi_callback_info info)
|
||||
@ -1138,7 +1138,7 @@ napi_value JsCanvas::OnRestore(napi_env env, napi_callback_info info)
|
||||
return NapiThrowError(env, DrawingErrorCode::ERROR_INVALID_PARAM, "Invalid params.");
|
||||
}
|
||||
m_canvas->Restore();
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::ClipRect(napi_env env, napi_callback_info info)
|
||||
@ -1167,7 +1167,7 @@ napi_value JsCanvas::OnClipRect(napi_env env, napi_callback_info info)
|
||||
|
||||
if (argc == ARGC_ONE) {
|
||||
m_canvas->ClipRect(drawingRect);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t clipOpInt = 0;
|
||||
@ -1175,16 +1175,16 @@ napi_value JsCanvas::OnClipRect(napi_env env, napi_callback_info info)
|
||||
|
||||
if (argc == ARGC_TWO) {
|
||||
m_canvas->ClipRect(drawingRect, static_cast<ClipOp>(clipOpInt));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
CHECK_EACH_PARAM(ARGC_TWO, napi_boolean);
|
||||
bool doAntiAlias = false;
|
||||
if (!ConvertFromJsValue(env, argv[ARGC_TWO], doAntiAlias)) {
|
||||
ROSEN_LOGE("JsCanvas::OnClipRect argv[2] is error");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
m_canvas->ClipRect(drawingRect, static_cast<ClipOp>(clipOpInt), doAntiAlias);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsCanvas::Scale(napi_env env, napi_callback_info info)
|
||||
@ -1209,7 +1209,7 @@ napi_value JsCanvas::OnScale(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_ONE, sy);
|
||||
|
||||
m_canvas->Scale(sx, sy);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Canvas* JsCanvas::GetCanvas()
|
||||
|
@ -135,14 +135,14 @@ napi_value JsColorFilter::CreateComposeColorFilter(napi_env env, napi_callback_i
|
||||
napi_unwrap(env, argv[1], (void **)&jsColorFilter2);
|
||||
if (jsColorFilter1 == nullptr || jsColorFilter2 == nullptr) {
|
||||
ROSEN_LOGE("JsColorFilter::CreateComposeColorFilter argv is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<ColorFilter> colorFilter1 = jsColorFilter1->GetColorFilter();
|
||||
std::shared_ptr<ColorFilter> colorFilter2 = jsColorFilter2->GetColorFilter();
|
||||
if (colorFilter1 == nullptr || colorFilter2 == nullptr) {
|
||||
ROSEN_LOGE("JsColorFilter::CreateComposeColorFilter colorFilter is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<ColorFilter> colorFilter = ColorFilter::CreateComposeColorFilter(*colorFilter1, *colorFilter2);
|
||||
@ -173,7 +173,7 @@ napi_value JsColorFilter::Create(napi_env env, const std::shared_ptr<ColorFilter
|
||||
napi_create_object(env, &objValue);
|
||||
if (objValue == nullptr || colorFilter == nullptr) {
|
||||
ROSEN_LOGE("[NAPI]Object or JsColorFilter is null!");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<JsColorFilter> jsColorFilter = std::make_unique<JsColorFilter>(colorFilter);
|
||||
@ -181,7 +181,7 @@ napi_value JsColorFilter::Create(napi_env env, const std::shared_ptr<ColorFilter
|
||||
|
||||
if (objValue == nullptr) {
|
||||
ROSEN_LOGE("[NAPI]objValue is null!");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
return objValue;
|
||||
}
|
||||
|
@ -193,11 +193,11 @@ napi_value JsFont::OnEnableSubpixel(napi_env env, napi_callback_info info)
|
||||
bool isSubpixel = false;
|
||||
if (!ConvertFromJsValue(env, argv[0], isSubpixel)) {
|
||||
ROSEN_LOGE("JsFont::OnEnableSubpixel Argv[0] is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_font->SetSubpixel(isSubpixel);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsFont::OnEnableEmbolden(napi_env env, napi_callback_info info)
|
||||
@ -214,11 +214,11 @@ napi_value JsFont::OnEnableEmbolden(napi_env env, napi_callback_info info)
|
||||
bool isEmbolden = false;
|
||||
if (!ConvertFromJsValue(env, argv[0], isEmbolden)) {
|
||||
ROSEN_LOGE("JsFont::OnEnableEmbolden Argv[0] is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_font->SetEmbolden(isEmbolden);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsFont::OnEnableLinearMetrics(napi_env env, napi_callback_info info)
|
||||
@ -235,11 +235,11 @@ napi_value JsFont::OnEnableLinearMetrics(napi_env env, napi_callback_info info)
|
||||
bool isLinearMetrics = false;
|
||||
if (!ConvertFromJsValue(env, argv[0], isLinearMetrics)) {
|
||||
ROSEN_LOGE("JsFont::OnEnableLinearMetrics Argv[0] is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_font->SetLinearMetrics(isLinearMetrics);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsFont::OnSetSize(napi_env env, napi_callback_info info)
|
||||
@ -256,7 +256,7 @@ napi_value JsFont::OnSetSize(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_ZERO, textSize);
|
||||
|
||||
m_font->SetSize((float)textSize);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsFont::OnGetSize(napi_env env, napi_callback_info info)
|
||||
@ -296,11 +296,11 @@ napi_value JsFont::OnSetTypeface(napi_env env, napi_callback_info info)
|
||||
napi_unwrap(env, argv[0], (void **)&jsTypeface);
|
||||
if (jsTypeface == nullptr) {
|
||||
ROSEN_LOGE("JsFont::OnSetTypeface jsTypeface is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_font->SetTypeface(jsTypeface->GetTypeface());
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsFont::OnGetTypeface(napi_env env, napi_callback_info info)
|
||||
@ -328,13 +328,13 @@ napi_value JsFont::OnMeasureText(napi_env env, napi_callback_info info)
|
||||
std::string text = "";
|
||||
if (!ConvertFromJsValue(env, argv[0], text)) {
|
||||
ROSEN_LOGE("JsFont::OnMeasureText Argv[0] is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TextEncoding TextEncoding = TextEncoding::UTF8;
|
||||
if (!ConvertFromJsTextEncoding(env, TextEncoding, argv[1])) {
|
||||
ROSEN_LOGE("JsFont::OnMeasureText ConvertFromJsTextEncoding failed");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
double textSize = m_font->MeasureText(text.c_str(), text.length(), TextEncoding);
|
||||
|
@ -82,7 +82,7 @@ bool ConvertFromJsTextEncoding(napi_env env, TextEncoding& textEncoding, napi_va
|
||||
napi_value NapiThrowError(napi_env env, DrawingErrorCode err, const std::string& message)
|
||||
{
|
||||
napi_throw(env, CreateJsError(env, static_cast<int32_t>(err), message));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static const char* ARGB_STRING[4] = {"alpha", "red", "green", "blue"};
|
||||
|
@ -118,7 +118,7 @@ napi_value JsMaskFilter::Create(napi_env env, std::shared_ptr<MaskFilter> maskFi
|
||||
napi_create_object(env, &objValue);
|
||||
if (objValue == nullptr || maskFilter == nullptr) {
|
||||
ROSEN_LOGE("JsMaskFilter::Create object is null!");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<JsMaskFilter> jsMaskFilter = std::make_unique<JsMaskFilter>(maskFilter);
|
||||
@ -126,7 +126,7 @@ napi_value JsMaskFilter::Create(napi_env env, std::shared_ptr<MaskFilter> maskFi
|
||||
|
||||
if (objValue == nullptr) {
|
||||
ROSEN_LOGE("JsMaskFilter::Create object value is null!");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
return objValue;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ napi_value JsPathEffect::CreateDashPathEffect(napi_env env, napi_callback_info i
|
||||
napi_has_element(env, argv[ARGC_ZERO], i, &hasElement);
|
||||
if (!hasElement) {
|
||||
ROSEN_LOGE("JsPathEffect::CreateDashPathEffect parameter check error");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value element = nullptr;
|
||||
@ -139,7 +139,7 @@ napi_value JsPathEffect::Create(napi_env env, std::shared_ptr<PathEffect> pathEf
|
||||
napi_create_object(env, &objValue);
|
||||
if (objValue == nullptr || pathEffect == nullptr) {
|
||||
ROSEN_LOGE("JsPathEffect::Create object is null");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<JsPathEffect> jsPathEffect = std::make_unique<JsPathEffect>(pathEffect);
|
||||
@ -147,7 +147,7 @@ napi_value JsPathEffect::Create(napi_env env, std::shared_ptr<PathEffect> pathEf
|
||||
|
||||
if (objValue == nullptr) {
|
||||
ROSEN_LOGE("JsPathEffect::Create objValue is null");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
return objValue;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ napi_value JsPath::OnMoveTo(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_ONE, y);
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_path->MoveTo(x, y));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPath::OnLineTo(napi_env env, napi_callback_info info)
|
||||
@ -175,7 +175,7 @@ napi_value JsPath::OnLineTo(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_ONE, y);
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_path->LineTo(x, y));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPath::OnArcTo(napi_env env, napi_callback_info info)
|
||||
@ -202,7 +202,7 @@ napi_value JsPath::OnArcTo(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_FIVE, sweepDeg);
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_path->ArcTo(x1, y1, x2, y2, startDeg, sweepDeg));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPath::OnQuadTo(napi_env env, napi_callback_info info)
|
||||
@ -225,7 +225,7 @@ napi_value JsPath::OnQuadTo(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_THREE, endPtY);
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_path->QuadTo(ctrlPtX, ctrlPtY, endPtX, endPtY));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPath::OnCubicTo(napi_env env, napi_callback_info info)
|
||||
@ -252,7 +252,7 @@ napi_value JsPath::OnCubicTo(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_FIVE, py3);
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_path->CubicTo(Point(px1, py1), Point(px2, py2), Point(px3, py3)));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPath::OnClose(napi_env env, napi_callback_info info)
|
||||
@ -263,7 +263,7 @@ napi_value JsPath::OnClose(napi_env env, napi_callback_info info)
|
||||
}
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_path->Close());
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPath::OnReset(napi_env env, napi_callback_info info)
|
||||
@ -274,7 +274,7 @@ napi_value JsPath::OnReset(napi_env env, napi_callback_info info)
|
||||
}
|
||||
|
||||
JS_CALL_DRAWING_FUNC(m_path->Reset());
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Path* JsPath::GetPath()
|
||||
|
@ -135,7 +135,7 @@ napi_value JsPen::SetColor(napi_env env, napi_callback_info info)
|
||||
|
||||
Color color(Color::ColorQuadSetARGB(argb[ARGC_ZERO], argb[ARGC_ONE], argb[ARGC_TWO], argb[ARGC_THREE]));
|
||||
pen->SetColor(color);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPen::SetStrokeWidth(napi_env env, napi_callback_info info)
|
||||
@ -157,7 +157,7 @@ napi_value JsPen::SetStrokeWidth(napi_env env, napi_callback_info info)
|
||||
GET_DOUBLE_PARAM(ARGC_ZERO, width);
|
||||
|
||||
pen->SetWidth(static_cast<float>(width));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -180,11 +180,11 @@ napi_value JsPen::SetAntiAlias(napi_env env, napi_callback_info info)
|
||||
bool aa = true;
|
||||
if (!ConvertFromJsValue(env, argv[0], aa)) {
|
||||
ROSEN_LOGE("JsPen::SetAntiAlias Argv[0] is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pen->SetAntiAlias(aa);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPen::SetAlpha(napi_env env, napi_callback_info info)
|
||||
@ -205,11 +205,11 @@ napi_value JsPen::SetAlpha(napi_env env, napi_callback_info info)
|
||||
int32_t alpha = 0;
|
||||
if (!ConvertFromJsNumber(env, argv[ARGC_ZERO], alpha, 0, Color::RGB_MAX)) {
|
||||
ROSEN_LOGE("JsPen::SetAlpha Argv[0] is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pen->SetAlpha(alpha);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPen::SetBlendMode(napi_env env, napi_callback_info info)
|
||||
@ -231,7 +231,7 @@ napi_value JsPen::SetBlendMode(napi_env env, napi_callback_info info)
|
||||
GET_INT32_CHECK_GE_ZERO_PARAM(ARGC_ZERO, mode);
|
||||
|
||||
pen->SetBlendMode(static_cast<BlendMode>(mode));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPen::SetColorFilter(napi_env env, napi_callback_info info)
|
||||
@ -248,19 +248,14 @@ napi_value JsPen::SetColorFilter(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_value argv[ARGC_ONE] = {nullptr};
|
||||
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_ONE);
|
||||
CHECK_EACH_PARAM(ARGC_ZERO, napi_object);
|
||||
|
||||
JsColorFilter* jsColorFilter = nullptr;
|
||||
napi_unwrap(env, argv[0], reinterpret_cast<void **>(&jsColorFilter));
|
||||
if (jsColorFilter == nullptr) {
|
||||
ROSEN_LOGE("JsPen::SetColorFilter jsColorFilter is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
Filter filter = pen->GetFilter();
|
||||
filter.SetColorFilter(jsColorFilter->GetColorFilter());
|
||||
filter.SetColorFilter(jsColorFilter ? jsColorFilter->GetColorFilter() : nullptr);
|
||||
pen->SetFilter(filter);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPen::SetMaskFilter(napi_env env, napi_callback_info info)
|
||||
@ -278,19 +273,14 @@ napi_value JsPen::SetMaskFilter(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_value argv[ARGC_ONE] = {nullptr};
|
||||
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_ONE);
|
||||
CHECK_EACH_PARAM(ARGC_ZERO, napi_object);
|
||||
|
||||
JsMaskFilter* jsMaskFilter = nullptr;
|
||||
napi_unwrap(env, argv[ARGC_ZERO], reinterpret_cast<void **>(&jsMaskFilter));
|
||||
if (jsMaskFilter == nullptr) {
|
||||
ROSEN_LOGE("JsPen::SetMaskFilter jsMaskFilter is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
Filter filter = pen->GetFilter();
|
||||
filter.SetMaskFilter(jsMaskFilter->GetMaskFilter());
|
||||
filter.SetMaskFilter(jsMaskFilter ? jsMaskFilter->GetMaskFilter() : nullptr);
|
||||
pen->SetFilter(filter);
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPen::SetDither(napi_env env, napi_callback_info info)
|
||||
@ -302,10 +292,9 @@ napi_value JsPen::SetDither(napi_env env, napi_callback_info info)
|
||||
bool dither = false;
|
||||
if (!ConvertFromJsValue(env, argv[0], dither)) {
|
||||
ROSEN_LOGE("JsPen::SetDither Argv[0] is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPen::SetJoinStyle(napi_env env, napi_callback_info info)
|
||||
@ -328,7 +317,7 @@ napi_value JsPen::SetJoinStyle(napi_env env, napi_callback_info info)
|
||||
GET_INT32_PARAM(ARGC_ZERO, joinStyle);
|
||||
|
||||
pen->SetJoinStyle(static_cast<Pen::JoinStyle>(joinStyle));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPen::GetJoinStyle(napi_env env, napi_callback_info info)
|
||||
@ -366,7 +355,7 @@ napi_value JsPen::SetCapStyle(napi_env env, napi_callback_info info)
|
||||
GET_INT32_PARAM(ARGC_ZERO, capStyle);
|
||||
|
||||
pen->SetCapStyle(static_cast<Pen::CapStyle>(capStyle));
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPen::GetCapStyle(napi_env env, napi_callback_info info)
|
||||
@ -400,17 +389,12 @@ napi_value JsPen::SetPathEffect(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_value argv[ARGC_ONE] = {nullptr};
|
||||
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_ONE);
|
||||
CHECK_EACH_PARAM(ARGC_ZERO, napi_object);
|
||||
|
||||
JsPathEffect* jsPathEffect = nullptr;
|
||||
napi_unwrap(env, argv[ARGC_ZERO], reinterpret_cast<void **>(&jsPathEffect));
|
||||
if (jsPathEffect == nullptr) {
|
||||
ROSEN_LOGE("JsPen::SetPathEffect jsPathEffect is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
|
||||
pen->SetPathEffect(jsPathEffect->GetPathEffect());
|
||||
return NapiGetUndefined(env);
|
||||
pen->SetPathEffect(jsPathEffect ? jsPathEffect->GetPathEffect() : nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
napi_value JsPen::SetShadowLayer(napi_env env, napi_callback_info info)
|
||||
@ -428,16 +412,12 @@ napi_value JsPen::SetShadowLayer(napi_env env, napi_callback_info info)
|
||||
|
||||
napi_value argv[ARGC_ONE] = {nullptr};
|
||||
CHECK_PARAM_NUMBER_WITHOUT_OPTIONAL_PARAMS(argv, ARGC_ONE);
|
||||
CHECK_EACH_PARAM(ARGC_ZERO, napi_object);
|
||||
|
||||
JsShadowLayer* jsShadowLayer = nullptr;
|
||||
napi_unwrap(env, argv[ARGC_ZERO], reinterpret_cast<void **>(&jsShadowLayer));
|
||||
if (jsShadowLayer == nullptr) {
|
||||
ROSEN_LOGE("JsPen::SetShadowLayer jsShadowLayer is nullptr");
|
||||
return NapiGetUndefined(env);
|
||||
}
|
||||
pen->SetLooper(jsShadowLayer->GetBlurDrawLooper());
|
||||
return NapiGetUndefined(env);
|
||||
|
||||
pen->SetLooper(jsShadowLayer ? jsShadowLayer->GetBlurDrawLooper() : nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Pen* JsPen::GetPen()
|
||||
|
@ -69,7 +69,7 @@ napi_value JsSamplingOptions::Constructor(napi_env env, napi_callback_info info)
|
||||
uint32_t jsFilterMode = 0;
|
||||
if (!ConvertFromJsValue(env, argv[ARGC_ZERO], jsFilterMode)) {
|
||||
ROSEN_LOGE("JsSamplingOptions::Constructor argv[0] is invalid");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
samplingOptions = std::make_shared<SamplingOptions>(FilterMode(jsFilterMode));
|
||||
jsSamplingOptions = new(std::nothrow) JsSamplingOptions(samplingOptions);
|
||||
|
@ -120,7 +120,7 @@ napi_value JsShadowLayer::CreateLooper(napi_env env, const std::shared_ptr<BlurD
|
||||
napi_create_object(env, &objValue);
|
||||
if (objValue == nullptr || blurDrawLooper == nullptr) {
|
||||
ROSEN_LOGE("JsShadowLayer::CreateLooper object is null!");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<JsShadowLayer> jsShadowLayer = std::make_unique<JsShadowLayer>(blurDrawLooper);
|
||||
@ -128,7 +128,7 @@ napi_value JsShadowLayer::CreateLooper(napi_env env, const std::shared_ptr<BlurD
|
||||
|
||||
if (objValue == nullptr) {
|
||||
ROSEN_LOGE("JsShadowLayer::CreateLooper objValue is null!");
|
||||
return NapiGetUndefined(env);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return objValue;
|
||||
|
@ -113,7 +113,7 @@ bool OH_Drawing_RegionContains(OH_Drawing_Region* region, int32_t x, int32_t y);
|
||||
bool OH_Drawing_RegionOp(OH_Drawing_Region* region, const OH_Drawing_Region* dst, OH_Drawing_RegionOpMode op);
|
||||
|
||||
/**
|
||||
* @brief Destroys an <b>OH_Drawing_Region</b> object and reclaims the memory occupied by the object.
|
||||
* @brief Set the region to the specified rect.
|
||||
*
|
||||
* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
|
||||
* @param OH_Drawing_Region Indicates the pointer to an <b>OH_Drawing_Region</b> object.
|
||||
|
@ -561,7 +561,7 @@ uint32_t RecordingCanvas::Save()
|
||||
{
|
||||
uint32_t ret = static_cast<uint32_t>(saveOpStateStack_.size());
|
||||
saveOpStateStack_.push(LazySaveOp);
|
||||
return ret;
|
||||
return ret + 1; // The minimum value for non-recording types is 1
|
||||
}
|
||||
|
||||
void RecordingCanvas::SaveLayer(const SaveLayerOps& saveLayerOps)
|
||||
@ -610,7 +610,7 @@ void RecordingCanvas::Restore()
|
||||
|
||||
uint32_t RecordingCanvas::GetSaveCount() const
|
||||
{
|
||||
return static_cast<uint32_t>(saveOpStateStack_.size());
|
||||
return static_cast<uint32_t>(saveOpStateStack_.size()) + 1; // The minimum value for non-recording types is 1
|
||||
}
|
||||
|
||||
void RecordingCanvas::Discard()
|
||||
|
Loading…
Reference in New Issue
Block a user