!46122 窗口异常density阈值适配

Merge pull request !46122 from 陈一阁/master
This commit is contained in:
openharmony_ci 2024-10-18 13:55:25 +00:00 committed by Gitee
commit 102fdb1320
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 3 additions and 3 deletions

View File

@ -384,7 +384,7 @@ public:
double GetWindowDensity() const double GetWindowDensity() const
{ {
if (!uiWindow_) { if (!uiWindow_) {
return 0.0; return 1.0;
} }
return static_cast<double>(uiWindow_->GetVirtualPixelRatio()); return static_cast<double>(uiWindow_->GetVirtualPixelRatio());
} }

View File

@ -129,7 +129,7 @@ double PipelineBase::GetCurrentDensity()
} }
CHECK_NULL_RETURN(pipelineContext, SystemProperties::GetDefaultResolution()); CHECK_NULL_RETURN(pipelineContext, SystemProperties::GetDefaultResolution());
double wmDensity = pipelineContext->GetWindowDensity(); double wmDensity = pipelineContext->GetWindowDensity();
if (GreatNotEqual(wmDensity, 0.0)) { if (GreatNotEqual(wmDensity, 1.0)) {
return wmDensity; return wmDensity;
} }
return pipelineContext->GetDensity(); return pipelineContext->GetDensity();

View File

@ -282,7 +282,7 @@ public:
if (windowDensityCallback_) { if (windowDensityCallback_) {
return windowDensityCallback_(); return windowDensityCallback_();
} }
return 0.0; return 1.0;
} }
int32_t RegisterDensityChangedCallback(std::function<void(double)>&& callback) int32_t RegisterDensityChangedCallback(std::function<void(double)>&& callback)