增加fontScale赋值时的pipelineContext判空

Signed-off-by: xiexiyun <xiexiyun@huawei.com>
Change-Id: I85cfbe126105e6dc2fbe2510375602887f1f3d49
This commit is contained in:
xiexiyun
2022-03-23 15:10:18 +08:00
parent 742c0a91a7
commit a7e45a771e
@@ -641,7 +641,10 @@ panda::Local<panda::JSValueRef> Fp2Px(panda::EcmaVM* vm, panda::Local<panda::JSV
return panda::JSValueRef::Undefined(vm);
}
auto pipelineContext = container->GetPipelineContext();
double fontScale = pipelineContext->GetFontScale();
double fontScale = 1.0;
if (pipelineContext) {
fontScale = pipelineContext->GetFontScale();
}
double pxValue = fpValue * density * fontScale;
return panda::NumberRef::New(vm, pxValue);
}