mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-19 17:08:11 -04:00
!371 window支持广色域功能完善: 将调用逻辑从wms移到wm
Merge pull request !371 from YaoJian/feature_gamut_wms
This commit is contained in:
@@ -54,11 +54,6 @@ public:
|
||||
virtual void MinimizeAllAppWindows(DisplayId displayId);
|
||||
virtual WMError SetWindowLayoutMode(DisplayId displayId, WindowLayoutMode mode);
|
||||
|
||||
// colorspace, gamut
|
||||
virtual bool IsSupportWideGamut(uint32_t windowId);
|
||||
virtual void SetColorSpace(uint32_t windowId, ColorSpace colorSpace);
|
||||
virtual ColorSpace GetColorSpace(uint32_t windowId);
|
||||
|
||||
virtual void RegisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
const sptr<IWindowManagerAgent>& windowManagerAgent);
|
||||
virtual void UnregisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <key_event.h>
|
||||
#include <refbase.h>
|
||||
#include <ui_content.h>
|
||||
#include <ui/rs_surface_node.h>
|
||||
|
||||
#include "input_transfer_station.h"
|
||||
#include "vsync_station.h"
|
||||
@@ -170,6 +171,14 @@ private:
|
||||
bool IsPointerEventConsumed();
|
||||
void AdjustWindowAnimationFlag();
|
||||
void MapFloatingWindowToAppIfNeeded();
|
||||
// colorspace, gamut
|
||||
using ColorSpaceConvertMap = struct {
|
||||
ColorSpace colorSpace;
|
||||
SurfaceColorGamut sufaceColorGamut;
|
||||
};
|
||||
static const ColorSpaceConvertMap colorSpaceConvertMap[];
|
||||
static ColorSpace GetColorSpaceFromSurfaceGamut(SurfaceColorGamut surfaceColorGamut);
|
||||
static SurfaceColorGamut GetSurfaceGamutFromColorSpace(ColorSpace colorSpace);
|
||||
|
||||
std::shared_ptr<VsyncStation::VsyncCallback> callback_ =
|
||||
std::make_shared<VsyncStation::VsyncCallback>(VsyncStation::VsyncCallback());
|
||||
|
||||
@@ -166,31 +166,6 @@ void WindowAdapter::MinimizeAllAppWindows(DisplayId displayId)
|
||||
windowManagerServiceProxy_->MinimizeAllAppWindows(displayId);
|
||||
}
|
||||
|
||||
bool WindowAdapter::IsSupportWideGamut(uint32_t windowId)
|
||||
{
|
||||
if (!InitWMSProxy()) {
|
||||
return false;
|
||||
}
|
||||
return windowManagerServiceProxy_->IsSupportWideGamut(windowId);
|
||||
}
|
||||
|
||||
void WindowAdapter::SetColorSpace(uint32_t windowId, ColorSpace colorSpace)
|
||||
{
|
||||
if (!InitWMSProxy()) {
|
||||
return;
|
||||
}
|
||||
return windowManagerServiceProxy_->SetColorSpace(windowId, colorSpace);
|
||||
}
|
||||
|
||||
ColorSpace WindowAdapter::GetColorSpace(uint32_t windowId)
|
||||
{
|
||||
if (!InitWMSProxy()) {
|
||||
return ColorSpace::COLOR_SPACE_DEFAULT;
|
||||
}
|
||||
return windowManagerServiceProxy_->GetColorSpace(windowId);
|
||||
}
|
||||
|
||||
|
||||
bool WindowAdapter::InitWMSProxy()
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
|
||||
+30
-4
@@ -16,7 +16,6 @@
|
||||
#include "window_impl.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <ui/rs_surface_node.h>
|
||||
|
||||
#include "display_manager.h"
|
||||
#include "singleton_container.h"
|
||||
@@ -34,6 +33,11 @@ namespace {
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowImpl"};
|
||||
}
|
||||
|
||||
const WindowImpl::ColorSpaceConvertMap WindowImpl::colorSpaceConvertMap[] = {
|
||||
{ ColorSpace::COLOR_SPACE_DEFAULT, COLOR_GAMUT_SRGB },
|
||||
{ ColorSpace::COLOR_SPACE_WIDE_GAMUT, COLOR_GAMUT_DCI_P3 },
|
||||
};
|
||||
|
||||
std::map<std::string, std::pair<uint32_t, sptr<Window>>> WindowImpl::windowMap_;
|
||||
std::map<uint32_t, std::vector<sptr<Window>>> WindowImpl::subWindowMap_;
|
||||
std::map<uint32_t, std::vector<sptr<Window>>> WindowImpl::appFloatingWindowMap_;
|
||||
@@ -367,19 +371,41 @@ std::string WindowImpl::GetContentInfo()
|
||||
return uiContent_->GetContentInfo();
|
||||
}
|
||||
|
||||
ColorSpace WindowImpl::GetColorSpaceFromSurfaceGamut(SurfaceColorGamut surfaceColorGamut)
|
||||
{
|
||||
for (auto item: colorSpaceConvertMap) {
|
||||
if (item.sufaceColorGamut == surfaceColorGamut) {
|
||||
return item.colorSpace;
|
||||
}
|
||||
}
|
||||
return ColorSpace::COLOR_SPACE_DEFAULT;
|
||||
}
|
||||
|
||||
SurfaceColorGamut WindowImpl::GetSurfaceGamutFromColorSpace(ColorSpace colorSpace)
|
||||
{
|
||||
for (auto item: colorSpaceConvertMap) {
|
||||
if (item.colorSpace == colorSpace) {
|
||||
return item.sufaceColorGamut;
|
||||
}
|
||||
}
|
||||
return SurfaceColorGamut::COLOR_GAMUT_SRGB;
|
||||
}
|
||||
|
||||
bool WindowImpl::IsSupportWideGamut()
|
||||
{
|
||||
return SingletonContainer::Get<WindowAdapter>().IsSupportWideGamut(property_->GetWindowId());
|
||||
return true;
|
||||
}
|
||||
|
||||
void WindowImpl::SetColorSpace(ColorSpace colorSpace)
|
||||
{
|
||||
SingletonContainer::Get<WindowAdapter>().SetColorSpace(property_->GetWindowId(), colorSpace);
|
||||
auto surfaceGamut = GetSurfaceGamutFromColorSpace(colorSpace);
|
||||
surfaceNode_->SetColorSpace(surfaceGamut);
|
||||
}
|
||||
|
||||
ColorSpace WindowImpl::GetColorSpace()
|
||||
{
|
||||
return SingletonContainer::Get<WindowAdapter>().GetColorSpace(property_->GetWindowId());
|
||||
auto surfaceGamut = surfaceNode_->GetColorSpace();
|
||||
return GetColorSpaceFromSurfaceGamut(surfaceGamut);
|
||||
}
|
||||
|
||||
void WindowImpl::DumpInfo(const std::vector<std::string>& params, std::vector<std::string>& info)
|
||||
|
||||
@@ -33,9 +33,6 @@ public:
|
||||
MOCK_METHOD2(SetAlpha, WMError(uint32_t windowId, float alpha));
|
||||
MOCK_METHOD2(SaveAbilityToken, WMError(const sptr<IRemoteObject>& abilityToken, uint32_t windowId));
|
||||
MOCK_METHOD3(SetSystemBarProperty, WMError(uint32_t windowId, WindowType type, const SystemBarProperty& property));
|
||||
MOCK_METHOD1(IsSupportWideGamut, bool(uint32_t windowId));
|
||||
MOCK_METHOD2(SetColorSpace, void(uint32_t windowId, ColorSpace colorSpace));
|
||||
MOCK_METHOD1(GetColorSpace, ColorSpace(uint32_t windowId));
|
||||
};
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -732,7 +732,6 @@ HWTEST_F(WindowImplTest, IsSupportWideGamut01, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
EXPECT_CALL(m->Mock(), IsSupportWideGamut(_)).Times(1).WillOnce(Return(true));
|
||||
window->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
ASSERT_TRUE(window->IsSupportWideGamut());
|
||||
@@ -751,7 +750,6 @@ HWTEST_F(WindowImplTest, SetColorSpace01, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
EXPECT_CALL(m->Mock(), SetColorSpace(_, _)).Times(1).WillOnce(Return());
|
||||
window->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
window->SetColorSpace(ColorSpace::COLOR_SPACE_WIDE_GAMUT);
|
||||
@@ -770,9 +768,11 @@ HWTEST_F(WindowImplTest, GetColorSpace01, Function | SmallTest | Level3)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateWindow(_, _, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Create("");
|
||||
EXPECT_CALL(m->Mock(), GetColorSpace(_)).Times(1).WillOnce(Return(ColorSpace::COLOR_SPACE_WIDE_GAMUT));
|
||||
window->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
window->SetColorSpace(ColorSpace::COLOR_SPACE_DEFAULT);
|
||||
ASSERT_EQ(ColorSpace::COLOR_SPACE_DEFAULT, window->GetColorSpace());
|
||||
window->SetColorSpace(ColorSpace::COLOR_SPACE_WIDE_GAMUT);
|
||||
ASSERT_EQ(ColorSpace::COLOR_SPACE_WIDE_GAMUT, window->GetColorSpace());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,11 +52,6 @@ public:
|
||||
WMError SetWindowLayoutMode(DisplayId displayId, WindowLayoutMode mode);
|
||||
void NotifySystemBarTints();
|
||||
|
||||
// colorspace, gamut
|
||||
bool IsSupportWideGamut(uint32_t windowId) const;
|
||||
void SetColorSpace(uint32_t windowId, ColorSpace colorSpace);
|
||||
ColorSpace GetColorSpace(uint32_t windowId) const;
|
||||
|
||||
private:
|
||||
uint32_t GenWindowId();
|
||||
void FlushWindowInfo(uint32_t windowId);
|
||||
|
||||
@@ -48,9 +48,6 @@ public:
|
||||
TRANS_ID_GET_TOP_WINDOW_ID,
|
||||
TRANS_ID_PROCESS_WINDOW_TOUCHED_EVENT,
|
||||
TRANS_ID_MINIMIZE_ALL_APP_WINDOWS,
|
||||
TRANS_ID_IS_SUPPORT_WIDE_GAMUT, // wide gamut
|
||||
TRANS_ID_SET_COLOR_SPACE, // set color space
|
||||
TRANS_ID_GET_COLOR_SPACE, // get color space
|
||||
TRANS_ID_SET_BACKGROUND_BLUR,
|
||||
TRANS_ID_SET_APLPHA,
|
||||
TRANS_ID_UPDATE_LAYOUT_MODE,
|
||||
@@ -77,11 +74,6 @@ public:
|
||||
virtual void MinimizeAllAppWindows(DisplayId displayId) = 0;
|
||||
virtual WMError SetWindowLayoutMode(DisplayId displayId, WindowLayoutMode mode) = 0;
|
||||
|
||||
// colorspace, gamut
|
||||
virtual bool IsSupportWideGamut(uint32_t windowId) = 0;
|
||||
virtual void SetColorSpace(uint32_t windowId, ColorSpace colorSpace) = 0;
|
||||
virtual ColorSpace GetColorSpace(uint32_t windowId) = 0;
|
||||
|
||||
virtual void RegisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
const sptr<IWindowManagerAgent>& windowManagerAgent) = 0;
|
||||
virtual void UnregisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
|
||||
@@ -49,11 +49,6 @@ public:
|
||||
void MinimizeAllAppWindows(DisplayId displayId) override;
|
||||
WMError SetWindowLayoutMode(DisplayId displayId, WindowLayoutMode mode) override;
|
||||
|
||||
// colorspace, gamut
|
||||
virtual bool IsSupportWideGamut(uint32_t windowId) override;
|
||||
virtual void SetColorSpace(uint32_t windowId, ColorSpace colorSpace) override;
|
||||
virtual ColorSpace GetColorSpace(uint32_t windowId) override;
|
||||
|
||||
void RegisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
const sptr<IWindowManagerAgent>& windowManagerAgent) override;
|
||||
void UnregisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
|
||||
@@ -69,11 +69,6 @@ public:
|
||||
void MinimizeAllAppWindows(DisplayId displayId) override;
|
||||
WMError SetWindowLayoutMode(DisplayId displayId, WindowLayoutMode mode) override;
|
||||
|
||||
// colorspace, gamut
|
||||
virtual bool IsSupportWideGamut(uint32_t windowId) override;
|
||||
virtual void SetColorSpace(uint32_t windowId, ColorSpace colorSpace) override;
|
||||
virtual ColorSpace GetColorSpace(uint32_t windowId) override;
|
||||
|
||||
void RegisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
const sptr<IWindowManagerAgent>& windowManagerAgent) override;
|
||||
void UnregisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
|
||||
@@ -69,11 +69,6 @@ public:
|
||||
bool IsSplitMode() const;
|
||||
WindowSizeChangeReason GetWindowSizeChangeReason() const;
|
||||
|
||||
// colorspace, gamut
|
||||
bool IsSupportWideGamut() const;
|
||||
void SetColorSpace(ColorSpace colorSpace);
|
||||
ColorSpace GetColorSpace() const;
|
||||
|
||||
sptr<WindowNode> parent_;
|
||||
std::vector<sptr<WindowNode>> children_;
|
||||
std::shared_ptr<RSSurfaceNode> surfaceNode_;
|
||||
@@ -85,15 +80,6 @@ public:
|
||||
bool isCovered_ { true }; // initial value true to ensure notification when this window is shown
|
||||
|
||||
private:
|
||||
// colorspace, gamut
|
||||
using ColorSpaceConvertMap = struct {
|
||||
ColorSpace colorSpace;
|
||||
SurfaceColorGamut sufaceColorGamut;
|
||||
};
|
||||
static const ColorSpaceConvertMap colorSpaceConvertMap[];
|
||||
static ColorSpace GetColorSpaceFromSurfaceGamut(SurfaceColorGamut surfaceColorGamut);
|
||||
static SurfaceColorGamut GetSurfaceGamutFromColorSpace(ColorSpace colorSpace);
|
||||
|
||||
sptr<WindowProperty> property_;
|
||||
sptr<IWindow> windowToken_;
|
||||
Rect layoutRect_ { 0, 0, 0, 0 };
|
||||
|
||||
@@ -444,35 +444,5 @@ WMError WindowController::SetWindowLayoutMode(DisplayId displayId, WindowLayoutM
|
||||
FlushWindowInfoWithDisplayId(displayId);
|
||||
return res;
|
||||
}
|
||||
|
||||
bool WindowController::IsSupportWideGamut(uint32_t windowId) const
|
||||
{
|
||||
auto node = windowRoot_->GetWindowNode(windowId);
|
||||
if (node == nullptr) {
|
||||
WLOGFE("could not find window");
|
||||
return false;
|
||||
}
|
||||
return node->IsSupportWideGamut();
|
||||
}
|
||||
|
||||
void WindowController::SetColorSpace(uint32_t windowId, ColorSpace colorSpace)
|
||||
{
|
||||
auto node = windowRoot_->GetWindowNode(windowId);
|
||||
if (node == nullptr) {
|
||||
WLOGFE("could not find window");
|
||||
return;
|
||||
}
|
||||
node->SetColorSpace(colorSpace);
|
||||
}
|
||||
|
||||
ColorSpace WindowController::GetColorSpace(uint32_t windowId) const
|
||||
{
|
||||
auto node = windowRoot_->GetWindowNode(windowId);
|
||||
if (node == nullptr) {
|
||||
WLOGFE("could not find window");
|
||||
return ColorSpace::COLOR_SPACE_DEFAULT;
|
||||
}
|
||||
return node->GetColorSpace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -492,73 +492,6 @@ void WindowManagerProxy::MinimizeAllAppWindows(DisplayId displayId)
|
||||
}
|
||||
}
|
||||
|
||||
bool WindowManagerProxy::IsSupportWideGamut(uint32_t windowId)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
WLOGFE("WriteInterfaceToken failed");
|
||||
return false;
|
||||
}
|
||||
if (!data.WriteUint32(windowId)) {
|
||||
WLOGFE("Write windowId failed");
|
||||
return false;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_IS_SUPPORT_WIDE_GAMUT, data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t ret = reply.ReadUint32();
|
||||
return static_cast<bool>(ret);
|
||||
}
|
||||
|
||||
void WindowManagerProxy::SetColorSpace(uint32_t windowId, ColorSpace colorSpace)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
WLOGFE("WriteInterfaceToken failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteUint32(windowId)) {
|
||||
WLOGFE("Write windowId failed");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteUint32(static_cast<uint32_t>(colorSpace))) {
|
||||
WLOGFE("Write colorSpace failed");
|
||||
return;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_SET_COLOR_SPACE, data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ColorSpace WindowManagerProxy::GetColorSpace(uint32_t windowId)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
WLOGFE("WriteInterfaceToken failed");
|
||||
return ColorSpace::COLOR_SPACE_DEFAULT;
|
||||
}
|
||||
if (!data.WriteUint32(windowId)) {
|
||||
WLOGFE("Write windowId failed");
|
||||
return ColorSpace::COLOR_SPACE_DEFAULT;
|
||||
}
|
||||
if (Remote()->SendRequest(TRANS_ID_GET_COLOR_SPACE, data, reply, option) != ERR_NONE) {
|
||||
WLOGFE("SendRequest failed");
|
||||
return ColorSpace::COLOR_SPACE_DEFAULT;
|
||||
}
|
||||
|
||||
uint32_t ret = reply.ReadUint32();
|
||||
return static_cast<ColorSpace>(ret);
|
||||
}
|
||||
|
||||
WMError WindowManagerProxy::SetWindowLayoutMode(DisplayId displayId, WindowLayoutMode mode)
|
||||
{
|
||||
MessageParcel data;
|
||||
|
||||
@@ -301,32 +301,6 @@ void WindowManagerService::MinimizeAllAppWindows(DisplayId displayId)
|
||||
windowController_->MinimizeAllAppWindows(displayId);
|
||||
}
|
||||
|
||||
bool WindowManagerService::IsSupportWideGamut(uint32_t windowId)
|
||||
{
|
||||
WM_SCOPED_TRACE("wms:IsSupportWideGamut");
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
bool ret = windowController_->IsSupportWideGamut(windowId);
|
||||
WLOGFI("IsSupportWideGamut windowId %{public}u, ret %{public}d", windowId, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void WindowManagerService::SetColorSpace(uint32_t windowId, ColorSpace colorSpace)
|
||||
{
|
||||
WLOGFI("SetColorSpace windowId %{public}u, ColorSpace %{public}u", windowId, colorSpace);
|
||||
WM_SCOPED_TRACE("wms:SetColorSpace(%u)", colorSpace);
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
windowController_->SetColorSpace(windowId, colorSpace);
|
||||
}
|
||||
|
||||
ColorSpace WindowManagerService::GetColorSpace(uint32_t windowId)
|
||||
{
|
||||
WM_SCOPED_TRACE("wms:GetColorSpace");
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
ColorSpace colorSpace = windowController_->GetColorSpace(windowId);
|
||||
WLOGFI("GetColorSpace windowId %{public}u, ColorSpace %{public}u", windowId, colorSpace);
|
||||
return colorSpace;
|
||||
}
|
||||
|
||||
WMError WindowManagerService::GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId)
|
||||
{
|
||||
WM_SCOPED_TRACE("wms:GetTopWindowId(%d)", mainWinId);
|
||||
|
||||
@@ -173,24 +173,6 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M
|
||||
MinimizeAllAppWindows(data.ReadUint64());
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_IS_SUPPORT_WIDE_GAMUT: {
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
bool ret = IsSupportWideGamut(windowId);
|
||||
reply.WriteUint32(static_cast<uint32_t>(ret));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_SET_COLOR_SPACE: {
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
ColorSpace colorSpace = static_cast<ColorSpace>(data.ReadUint32());
|
||||
SetColorSpace(windowId, colorSpace);
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_GET_COLOR_SPACE: {
|
||||
uint32_t windowId = data.ReadUint32();
|
||||
ColorSpace colorSpace = GetColorSpace(windowId);
|
||||
reply.WriteUint32(static_cast<uint32_t>(colorSpace));
|
||||
break;
|
||||
}
|
||||
case TRANS_ID_UPDATE_LAYOUT_MODE: {
|
||||
DisplayId displayId = data.ReadUint64();
|
||||
WindowLayoutMode mode = static_cast<WindowLayoutMode>(data.ReadUint32());
|
||||
|
||||
@@ -23,11 +23,6 @@ namespace {
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, 0, "WindowNode"};
|
||||
}
|
||||
|
||||
const WindowNode::ColorSpaceConvertMap WindowNode::colorSpaceConvertMap[] = {
|
||||
{ ColorSpace::COLOR_SPACE_DEFAULT, COLOR_GAMUT_SRGB },
|
||||
{ ColorSpace::COLOR_SPACE_WIDE_GAMUT, COLOR_GAMUT_DCI_P3 },
|
||||
};
|
||||
|
||||
void WindowNode::SetDisplayId(DisplayId displayId)
|
||||
{
|
||||
property_->SetDisplayId(displayId);
|
||||
@@ -197,42 +192,5 @@ WindowSizeChangeReason WindowNode::GetWindowSizeChangeReason() const
|
||||
{
|
||||
return windowSizeChangeReason_;
|
||||
}
|
||||
|
||||
ColorSpace WindowNode::GetColorSpaceFromSurfaceGamut(SurfaceColorGamut surfaceColorGamut)
|
||||
{
|
||||
for (auto item: colorSpaceConvertMap) {
|
||||
if (item.sufaceColorGamut == surfaceColorGamut) {
|
||||
return item.colorSpace;
|
||||
}
|
||||
}
|
||||
return ColorSpace::COLOR_SPACE_DEFAULT;
|
||||
}
|
||||
|
||||
SurfaceColorGamut WindowNode::GetSurfaceGamutFromColorSpace(ColorSpace colorSpace)
|
||||
{
|
||||
for (auto item: colorSpaceConvertMap) {
|
||||
if (item.colorSpace == colorSpace) {
|
||||
return item.sufaceColorGamut;
|
||||
}
|
||||
}
|
||||
return SurfaceColorGamut::COLOR_GAMUT_SRGB;
|
||||
}
|
||||
|
||||
bool WindowNode::IsSupportWideGamut() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void WindowNode::SetColorSpace(ColorSpace colorSpace)
|
||||
{
|
||||
auto surfaceGamut = GetSurfaceGamutFromColorSpace(colorSpace);
|
||||
surfaceNode_->SetColorSpace(surfaceGamut);
|
||||
}
|
||||
|
||||
ColorSpace WindowNode::GetColorSpace() const
|
||||
{
|
||||
auto surfaceGamut = surfaceNode_->GetColorSpace();
|
||||
return GetColorSpaceFromSurfaceGamut(surfaceGamut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user