mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-19 17:08:11 -04:00
Move 'VirtualPixelRatio' from client to server
Signed-off-by: lu <zhaolu2@huawei.com> Change-Id: Id7f1959bd1ee1a23baba887d1eeb53fcca43b884
This commit is contained in:
+2
-8
@@ -21,7 +21,6 @@
|
||||
namespace OHOS::Rosen {
|
||||
namespace {
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_DISPLAY, "Display"};
|
||||
constexpr int32_t LARGE_SCREEN_WIDTH = 2160;
|
||||
}
|
||||
class Display::Impl : public RefBase {
|
||||
public:
|
||||
@@ -108,12 +107,7 @@ void Display::UpdateDisplayInfo() const
|
||||
|
||||
float Display::GetVirtualPixelRatio() const
|
||||
{
|
||||
// Should get from DMS
|
||||
if ((pImpl_->GetDisplayInfo()->GetWidth() >= LARGE_SCREEN_WIDTH)
|
||||
|| (pImpl_->GetDisplayInfo()->GetHeight() >= LARGE_SCREEN_WIDTH)) {
|
||||
return 2.0f;
|
||||
} else {
|
||||
return 1.0f;
|
||||
}
|
||||
UpdateDisplayInfo();
|
||||
return pImpl_->GetDisplayInfo()->GetVirtualPixelRatio();
|
||||
}
|
||||
} // namespace OHOS::Rosen
|
||||
|
||||
@@ -164,6 +164,7 @@ sptr<DisplayInfo> AbstractDisplay::ConvertToDisplayInfo() const
|
||||
displayInfo->id_ = id_;
|
||||
displayInfo->refreshRate_ = refreshRate_;
|
||||
displayInfo->screenId_ = screenId_;
|
||||
displayInfo->virtualPixelRatio_ = virtualPixelRatio_;
|
||||
displayInfo->rotation_ = rotation_;
|
||||
displayInfo->orientation_ = orientation_;
|
||||
return displayInfo;
|
||||
|
||||
@@ -54,15 +54,6 @@ void AbstractDisplayController::Init(sptr<AbstractScreenController> abstractScre
|
||||
std::placeholders::_2);
|
||||
abstractScreenController_->ScreenConnectionInDisplayInit(abstractScreenCallback_);
|
||||
abstractScreenController->RegisterAbstractScreenCallback(abstractScreenCallback_);
|
||||
|
||||
// Active the code after "rsDisplayNode_->SetScreenId(rsScreenId)" is provided.
|
||||
/*std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
if (dummyDisplay_ == nullptr) {
|
||||
sptr<AbstractDisplay> display = new AbstractDisplay(this, displayCount_.fetch_add(1), SCREEN_ID_INVALID,
|
||||
AbstractDisplay::DEFAULT_WIDTH, AbstractDisplay::DEFAULT_HIGHT, AbstractDisplay::DEFAULT_FRESH_RATE);
|
||||
abstractDisplayMap_.insert((std::make_pair(display->GetId(), display)));
|
||||
dummyDisplay_ = display;
|
||||
}*/
|
||||
}
|
||||
|
||||
ScreenId AbstractDisplayController::GetDefaultScreenId()
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
DEFINE_VAR_DEFAULT_FUNC_GET(uint32_t, FreshRate, freshRate, 0);
|
||||
DEFINE_VAR_DEFAULT_FUNC_GET(uint32_t, RefreshRate, refreshRate, 0);
|
||||
DEFINE_VAR_DEFAULT_FUNC_GET(ScreenId, ScreenId, screenId, SCREEN_ID_INVALID);
|
||||
DEFINE_VAR_DEFAULT_FUNC_GET(float, VirtualPixelRatio, virtualPixelRatio, 1.0f);
|
||||
DEFINE_VAR_DEFAULT_FUNC_GET(float, XDpi, xDpi, 0.0f);
|
||||
DEFINE_VAR_DEFAULT_FUNC_GET(float, YDpi, yDpi, 0.0f);
|
||||
DEFINE_VAR_DEFAULT_FUNC_GET(Rotation, Rotation, rotation, Rotation::ROTATION_0);
|
||||
|
||||
@@ -21,7 +21,7 @@ bool DisplayInfo::Marshalling(Parcel &parcel) const
|
||||
return parcel.WriteUint64(id_) && parcel.WriteUint32(type_) &&
|
||||
parcel.WriteInt32(width_) && parcel.WriteInt32(height_) &&
|
||||
parcel.WriteUint32(freshRate_) && parcel.WriteUint32(refreshRate_) && parcel.WriteUint64(screenId_) &&
|
||||
parcel.WriteFloat(xDpi_) && parcel.WriteFloat(yDpi_) &&
|
||||
parcel.WriteFloat(virtualPixelRatio_) && parcel.WriteFloat(xDpi_) && parcel.WriteFloat(yDpi_) &&
|
||||
parcel.WriteUint32(static_cast<uint32_t>(rotation_)) &&
|
||||
parcel.WriteUint32(static_cast<uint32_t>(orientation_));
|
||||
}
|
||||
@@ -36,6 +36,7 @@ DisplayInfo *DisplayInfo::Unmarshalling(Parcel &parcel)
|
||||
parcel.ReadInt32(displayInfo->width_) && parcel.ReadInt32(displayInfo->height_) &&
|
||||
parcel.ReadUint32(displayInfo->freshRate_) &&
|
||||
parcel.ReadUint32(displayInfo->refreshRate_) && parcel.ReadUint64(displayInfo->screenId_) &&
|
||||
parcel.ReadFloat(displayInfo->virtualPixelRatio_) &&
|
||||
parcel.ReadFloat(displayInfo->xDpi_) && parcel.ReadFloat(displayInfo->yDpi_) &&
|
||||
parcel.ReadUint32(rotation) && parcel.ReadUint32(orientation);
|
||||
if (!res) {
|
||||
|
||||
Reference in New Issue
Block a user