mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-21 20:45:26 -04:00
!657 适配RSScreen的修改:把屏幕modeId的含义改为数组下标,以简化接口
Merge pull request !657 from 赵路/master
This commit is contained in:
@@ -37,13 +37,11 @@ AbstractScreen::~AbstractScreen()
|
||||
|
||||
sptr<SupportedScreenModes> AbstractScreen::GetActiveScreenMode() const
|
||||
{
|
||||
for (sptr<SupportedScreenModes> mode : modes_) {
|
||||
if (mode->modeId_ == activeIdx_) {
|
||||
return mode;
|
||||
}
|
||||
if (activeIdx_ < 0 || activeIdx_ >= modes_.size()) {
|
||||
WLOGE("active mode index is wrong: %{public}d", activeIdx_);
|
||||
return nullptr;
|
||||
}
|
||||
WLOGE("active mode index is wrong: %{public}d", activeIdx_);
|
||||
return nullptr;
|
||||
return modes_[activeIdx_];
|
||||
}
|
||||
|
||||
std::vector<sptr<SupportedScreenModes>> AbstractScreen::GetAbstractScreenModes() const
|
||||
|
||||
@@ -345,9 +345,9 @@ bool AbstractScreenController::FillAbstractScreen(sptr<AbstractScreen>& absScree
|
||||
info->width_ = static_cast<uint32_t>(rsScreenModeInfo.GetScreenWidth());
|
||||
info->height_ = static_cast<uint32_t>(rsScreenModeInfo.GetScreenHeight());
|
||||
info->refreshRate_ = rsScreenModeInfo.GetScreenRefreshRate();
|
||||
info->modeId_ = rsScreenModeInfo.GetScreenModeId();
|
||||
absScreen->modes_.push_back(info);
|
||||
WLOGD("fill screen mode%{public}d w/h:%{public}d/%{public}d", info->modeId_, info->width_, info->height_);
|
||||
WLOGD("fill screen idx:%{public}d w/h:%{public}d/%{public}d",
|
||||
rsScreenModeInfo.GetScreenModeId(), info->width_, info->height_);
|
||||
}
|
||||
int32_t activeModeId = rsInterface_.GetScreenActiveMode(rsScreenId).GetScreenModeId();
|
||||
WLOGD("fill screen activeModeId:%{public}d", activeModeId);
|
||||
|
||||
@@ -39,7 +39,6 @@ struct SupportedScreenModes : public RefBase {
|
||||
uint32_t width_;
|
||||
uint32_t height_;
|
||||
uint32_t refreshRate_;
|
||||
int32_t modeId_;
|
||||
};
|
||||
|
||||
struct VirtualScreenOption {
|
||||
|
||||
@@ -173,7 +173,6 @@ NativeValue* CreateJsScreenObject(NativeEngine& engine, sptr<Screen>& screen)
|
||||
std::unique_ptr<JsScreen> jsScreen = std::make_unique<JsScreen>(screen);
|
||||
object->SetNativePointer(jsScreen.release(), JsScreen::Finalizer, nullptr);
|
||||
|
||||
object->SetProperty("id", CreateJsValue(engine, static_cast<uint32_t>(screen->GetId())));
|
||||
object->SetProperty("parent", CreateJsValue(engine, static_cast<uint32_t>(screen->GetParentId())));
|
||||
object->SetProperty("orientation", CreateJsValue(engine, screen->GetOrientation()));
|
||||
object->SetProperty("activeModeIndex", CreateJsValue(engine, screen->GetModeId()));
|
||||
|
||||
Reference in New Issue
Block a user