Clean codestyle issue. Add and modify *refreshRate var/api to replace *freshRate

Signed-off-by: shiyueeee <nieshiyue@huawei.com>
Change-Id: I8acc9c8fac0e9f08551476d200f23ed8f52beb05
This commit is contained in:
shiyueeee
2022-03-03 12:59:06 +08:00
parent 286f8bdc81
commit 8bc3f0831b
17 changed files with 47 additions and 36 deletions
+7 -1
View File
@@ -64,7 +64,13 @@ int32_t Display::GetHeight() const
uint32_t Display::GetFreshRate() const
{
UpdateDisplayInfo();
return pImpl_->GetDisplayInfo()->GetFreshRate();
return pImpl_->GetDisplayInfo()->GetRefreshRate();
}
uint32_t Display::GetRefreshRate() const
{
UpdateDisplayInfo();
return pImpl_->GetDisplayInfo()->GetRefreshRate();
}
ScreenId Display::GetScreenId() const
@@ -137,6 +137,10 @@ bool DisplayChangeTest::ScreenSizeEqual(const sptr<Screen> screen, const sptr<Su
bool DisplayChangeTest::DisplaySizeEqual(const sptr<Display> display, const sptr<SupportedScreenModes> curInfo)
{
if (display == nullptr || curInfo == nullptr) {
WLOGFI("param is nullptr");
return false;
}
uint32_t dWidth = static_cast<uint32_t>(display->GetWidth());
uint32_t dHeight = static_cast<uint32_t>(display->GetHeight());
WLOGI("DisplaySizeEqual:: DisplaySize: %{public}u %{public}u, ActiveModeInfoSize: %{public}u %{public}u",
+2 -3
View File
@@ -50,10 +50,9 @@ void ScreenshotCmdTest::SetUpTestCase()
if (display == nullptr) {
WLOGFE("GetDefaultDisplay: failed!\n");
return;
} else {
WLOGFI("GetDefaultDisplay: id %llu, w %d, h %d, fps %u\n", display->GetId(), display->GetWidth(),
display->GetHeight(), display->GetFreshRate());
}
WLOGFI("GetDefaultDisplay: id %llu, w %d, h %d, fps %u\n", display->GetId(), display->GetWidth(),
display->GetHeight(), display->GetRefreshRate());
defaultId_ = display->GetId();
}
+2 -3
View File
@@ -51,10 +51,9 @@ void ScreenshotTest::SetUpTestCase()
if (display == nullptr) {
WLOGFE("GetDefaultDisplay: failed!\n");
return;
} else {
WLOGFI("GetDefaultDisplay: id %llu, w %d, h %d, fps %u\n", display->GetId(), display->GetWidth(),
display->GetHeight(), display->GetFreshRate());
}
WLOGFI("GetDefaultDisplay: id %llu, w %d, h %d, fps %u\n", display->GetId(), display->GetWidth(),
display->GetHeight(), display->GetRefreshRate());
defaultId_ = display->GetId();
defaultScreen_ = {0, 0, display->GetWidth(), display->GetHeight()};
+4 -4
View File
@@ -29,7 +29,7 @@ public:
constexpr static float DEFAULT_VIRTUAL_PIXEL_RATIO = 1.0;
constexpr static uint32_t DEFAULT_FRESH_RATE = 60;
AbstractDisplay(const DisplayInfo* info);
AbstractDisplay(DisplayId id, ScreenId screenId, int32_t width, int32_t height, uint32_t freshRate);
AbstractDisplay(DisplayId id, ScreenId screenId, int32_t width, int32_t height, uint32_t refreshRate);
~AbstractDisplay() = default;
static inline bool IsVertical(Rotation rotation)
{
@@ -38,7 +38,7 @@ public:
DisplayId GetId() const;
int32_t GetWidth() const;
int32_t GetHeight() const;
uint32_t GetFreshRate() const;
uint32_t GetRefreshRate() const;
float GetVirtualPixelRatio() const;
ScreenId GetAbstractScreenId() const;
bool BindAbstractScreen(ScreenId dmsScreenId);
@@ -48,7 +48,7 @@ public:
void SetId(DisplayId displayId);
void SetWidth(int32_t width);
void SetHeight(int32_t height);
void SetFreshRate(uint32_t freshRate);
void SetRefreshRate(uint32_t refreshRate);
void SetVirtualPixelRatio(float virtualPixelRatio);
void SetOrientation(Orientation orientation);
bool RequestRotation(Rotation rotation);
@@ -59,7 +59,7 @@ private:
ScreenId screenId_ { SCREEN_ID_INVALID };
int32_t width_ { 0 };
int32_t height_ { 0 };
uint32_t freshRate_ { 0 };
uint32_t refreshRate_ { 0 };
float virtualPixelRatio_ { 1.0 };
Rotation rotation_ { Rotation::ROTATION_0 };
Orientation orientation_ { Orientation::UNSPECIFIED };
+9 -9
View File
@@ -33,15 +33,15 @@ AbstractDisplay::AbstractDisplay(const DisplayInfo* info)
id_ = info->GetDisplayId();
width_ = info->GetWidth();
height_ = info->GetHeight();
freshRate_ = info->GetFreshRate();
refreshRate_ = info->GetRefreshRate();
}
AbstractDisplay::AbstractDisplay(DisplayId id, ScreenId screenId, int32_t width, int32_t height, uint32_t freshRate)
AbstractDisplay::AbstractDisplay(DisplayId id, ScreenId screenId, int32_t width, int32_t height, uint32_t refreshRate)
: id_(id),
screenId_(screenId),
width_(width),
height_(height),
freshRate_(freshRate)
refreshRate_(refreshRate)
{
}
@@ -60,9 +60,9 @@ int32_t AbstractDisplay::GetHeight() const
return height_;
}
uint32_t AbstractDisplay::GetFreshRate() const
uint32_t AbstractDisplay::GetRefreshRate() const
{
return freshRate_;
return refreshRate_;
}
float AbstractDisplay::GetVirtualPixelRatio() const
@@ -80,9 +80,9 @@ void AbstractDisplay::SetHeight(int32_t height)
height_ = height;
}
void AbstractDisplay::SetFreshRate(uint32_t freshRate)
void AbstractDisplay::SetRefreshRate(uint32_t refreshRate)
{
freshRate_ = freshRate;
refreshRate_ = refreshRate;
}
void AbstractDisplay::SetVirtualPixelRatio(float virtualPixelRatio)
@@ -141,7 +141,7 @@ bool AbstractDisplay::BindAbstractScreen(sptr<AbstractScreen> abstractScreen)
}
width_ = static_cast<int32_t>(info->width_);
height_ = static_cast<int32_t>(info->height_);
freshRate_ = info->freshRate_;
refreshRate_ = info->refreshRate_;
screenId_ = dmsScreenId;
WLOGD("display bound to screen. display:%{public}" PRIu64", screen:%{public}" PRIu64"", id_, dmsScreenId);
return true;
@@ -158,7 +158,7 @@ sptr<DisplayInfo> AbstractDisplay::ConvertToDisplayInfo() const
displayInfo->width_ = width_;
displayInfo->height_ = height_;
displayInfo->id_ = id_;
displayInfo->freshRate_ = freshRate_;
displayInfo->refreshRate_ = refreshRate_;
displayInfo->screenId_ = screenId_;
displayInfo->rotation_ = rotation_;
displayInfo->orientation_ = orientation_;
+2 -2
View File
@@ -352,7 +352,7 @@ void AbstractDisplayController::BindAloneScreenLocked(sptr<AbstractScreen> realA
return;
}
sptr<AbstractDisplay> display = new AbstractDisplay(displayCount_.fetch_add(1),
realAbsScreen->dmsId_, info->width_, info->height_, info->freshRate_);
realAbsScreen->dmsId_, info->width_, info->height_, info->refreshRate_);
abstractDisplayMap_.insert((std::make_pair(display->GetId(), display)));
WLOGI("create display for new screen. screen:%{public}" PRIu64", display:%{public}" PRIu64"",
realAbsScreen->dmsId_, display->GetId());
@@ -395,7 +395,7 @@ void AbstractDisplayController::AddScreenToExpandLocked(sptr<AbstractScreen> abs
return;
}
sptr<AbstractDisplay> display = new AbstractDisplay(displayCount_.fetch_add(1),
absScreen->dmsId_, info->width_, info->height_, info->freshRate_);
absScreen->dmsId_, info->width_, info->height_, info->refreshRate_);
abstractDisplayMap_.insert((std::make_pair(display->GetId(), display)));
WLOGI("create display for new screen. screen:%{public}" PRIu64", display:%{public}" PRIu64"",
absScreen->dmsId_, display->GetId());
+2 -2
View File
@@ -300,7 +300,7 @@ bool AbstractScreenController::FillAbstractScreen(sptr<AbstractScreen>& absScree
sptr<SupportedScreenModes> info = new SupportedScreenModes();
info->width_ = static_cast<uint32_t>(rsScreenModeInfo.GetScreenWidth());
info->height_ = static_cast<uint32_t>(rsScreenModeInfo.GetScreenHeight());
info->freshRate_ = rsScreenModeInfo.GetScreenFreshRate();
info->refreshRate_ = rsScreenModeInfo.GetScreenFreshRate();
absScreen->modes_.push_back(info);
WLOGD("fill screen w/h:%{public}d/%{public}d", info->width_, info->height_);
}
@@ -449,7 +449,7 @@ ScreenId AbstractScreenController::CreateVirtualScreen(VirtualScreenOption optio
info->height_ = option.height_;
auto defaultScreen = GetAbstractScreen(GetDefaultAbstractScreenId());
if (defaultScreen != nullptr && defaultScreen->GetActiveScreenMode() != nullptr) {
info->freshRate_ = defaultScreen->GetActiveScreenMode()->freshRate_;
info->refreshRate_ = defaultScreen->GetActiveScreenMode()->refreshRate_;
}
absScreen->modes_.push_back(info);
absScreen->activeIdx_ = 0;
+2 -2
View File
@@ -748,8 +748,8 @@ sptr<ScreenInfo> DisplayManagerProxy::GetScreenInfoById(ScreenId screenId)
return nullptr;
}
for (auto& mode : info->GetModes()) {
WLOGFI("info modes is width: %{public}u, height: %{public}u, freshRate: %{public}u",
mode->width_, mode->height_, mode->freshRate_);
WLOGFI("info modes is width: %{public}u, height: %{public}u, refreshRate: %{public}u",
mode->width_, mode->height_, mode->refreshRate_);
}
return info;
}
+2 -2
View File
@@ -181,8 +181,8 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
ScreenId screenId = static_cast<ScreenId>(data.ReadUint64());
auto screenInfo = GetScreenInfoById(screenId);
for (auto& mode : screenInfo->GetModes()) {
WLOGFI("info modes is width: %{public}u, height: %{public}u, freshRate: %{public}u",
mode->width_, mode->height_, mode->freshRate_);
WLOGFI("info modes is width: %{public}u, height: %{public}u, refreshRate: %{public}u",
mode->width_, mode->height_, mode->refreshRate_);
}
reply.WriteStrongParcelable(screenInfo);
break;
+1
View File
@@ -38,6 +38,7 @@ public:
int32_t GetWidth() const;
int32_t GetHeight() const;
uint32_t GetFreshRate() const;
uint32_t GetRefreshRate() const;
ScreenId GetScreenId() const;
float GetVirtualPixelRatio() const;
Rotation GetRotation() const;
+1 -1
View File
@@ -37,7 +37,7 @@ struct Point {
struct SupportedScreenModes : public RefBase {
uint32_t width_;
uint32_t height_;
uint32_t freshRate_;
uint32_t refreshRate_;
};
struct VirtualScreenOption {
@@ -211,10 +211,10 @@ NativeValue* CreateJsScreenModeObject(NativeEngine& engine, sptr<SupportedScreen
}
uint32_t width = mode->width_;
uint32_t height = mode->height_;
uint32_t freshRate = mode->freshRate_;
uint32_t refreshRate = mode->refreshRate_;
optionObject->SetProperty("width", CreateJsValue(engine, width));
optionObject->SetProperty("height", CreateJsValue(engine, height));
optionObject->SetProperty("freshRate", CreateJsValue(engine, freshRate));
optionObject->SetProperty("freshRate", CreateJsValue(engine, refreshRate));
return objValue;
}
} // namespace Rosen
+1
View File
@@ -40,6 +40,7 @@ public:
DEFINE_VAR_DEFAULT_FUNC_GET(int32_t, Width, width, 0);
DEFINE_VAR_DEFAULT_FUNC_GET(int32_t, Height, height, 0);
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, XDpi, xDpi, 0.0f);
DEFINE_VAR_DEFAULT_FUNC_GET(float, YDpi, yDpi, 0.0f);
+3 -2
View File
@@ -20,7 +20,7 @@ bool DisplayInfo::Marshalling(Parcel &parcel) const
{
return parcel.WriteUint64(id_) && parcel.WriteUint32(type_) &&
parcel.WriteInt32(width_) && parcel.WriteInt32(height_) &&
parcel.WriteUint32(freshRate_) && parcel.WriteUint64(screenId_) &&
parcel.WriteUint32(freshRate_) && parcel.WriteUint32(refreshRate_) && parcel.WriteUint64(screenId_) &&
parcel.WriteFloat(xDpi_) && parcel.WriteFloat(yDpi_) &&
parcel.WriteUint32(static_cast<uint32_t>(rotation_)) &&
parcel.WriteUint32(static_cast<uint32_t>(orientation_));
@@ -34,7 +34,8 @@ DisplayInfo *DisplayInfo::Unmarshalling(Parcel &parcel)
uint32_t orientation;
bool res = parcel.ReadUint64(displayInfo->id_) && parcel.ReadUint32(type) &&
parcel.ReadInt32(displayInfo->width_) && parcel.ReadInt32(displayInfo->height_) &&
parcel.ReadUint32(displayInfo->freshRate_) && parcel.ReadUint64(displayInfo->screenId_) &&
parcel.ReadUint32(displayInfo->freshRate_) &&
parcel.ReadUint32(displayInfo->refreshRate_) && parcel.ReadUint64(displayInfo->screenId_) &&
parcel.ReadFloat(displayInfo->xDpi_) && parcel.ReadFloat(displayInfo->yDpi_) &&
parcel.ReadUint32(rotation) && parcel.ReadUint32(orientation);
if (!res) {
+2 -2
View File
@@ -31,7 +31,7 @@ bool ScreenInfo::Marshalling(Parcel &parcel) const
for (uint32_t modeIndex = 0; modeIndex < modes_.size(); modeIndex++) {
if (parcel.WriteUint32(modes_[modeIndex]->height_) &&
parcel.WriteUint32(modes_[modeIndex]->width_) &&
parcel.WriteUint32(modes_[modeIndex]->freshRate_)) {
parcel.WriteUint32(modes_[modeIndex]->refreshRate_)) {
continue;
}
return false;
@@ -71,7 +71,7 @@ bool ScreenInfo::InnerUnmarshalling(Parcel& parcel)
sptr<SupportedScreenModes> mode = new SupportedScreenModes();
if (parcel.ReadUint32(mode->height_) &&
parcel.ReadUint32(mode->width_) &&
parcel.ReadUint32(mode->freshRate_)) {
parcel.ReadUint32(mode->refreshRate_)) {
modes_.push_back(mode);
} else {
return false;
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at