mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-18 11:42:47 +00:00
Fix setting color space of all os::Windows
This commit is contained in:
parent
fd7d31ddc2
commit
e7f0832ff3
2
laf
2
laf
@ -1 +1 @@
|
|||||||
Subproject commit 2d4fe8dfc0184405c22e0dec9d1f5a8e6e7f0f14
|
Subproject commit a9caf030323b64673f5440103841c09e5e9c5c5a
|
@ -646,7 +646,6 @@ public:
|
|||||||
|
|
||||||
if (j == winCs) {
|
if (j == winCs) {
|
||||||
name = gfxCs->name();
|
name = gfxCs->name();
|
||||||
os::instance()->setWindowsColorSpace(cs);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++j;
|
++j;
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include "os/surface.h"
|
#include "os/surface.h"
|
||||||
#include "os/system.h"
|
#include "os/system.h"
|
||||||
#include "os/window.h"
|
#include "os/window.h"
|
||||||
|
#include "os/window.h"
|
||||||
#include "ui/intern.h"
|
#include "ui/intern.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
@ -257,13 +258,14 @@ void update_windows_color_profile_from_preferences()
|
|||||||
else
|
else
|
||||||
windowProfile = gen::WindowColorProfile::SRGB;
|
windowProfile = gen::WindowColorProfile::SRGB;
|
||||||
|
|
||||||
|
os::ColorSpaceRef osCS = nullptr;
|
||||||
|
|
||||||
switch (windowProfile) {
|
switch (windowProfile) {
|
||||||
case gen::WindowColorProfile::MONITOR:
|
case gen::WindowColorProfile::MONITOR:
|
||||||
system->setWindowsColorSpace(nullptr);
|
osCS = nullptr;
|
||||||
break;
|
break;
|
||||||
case gen::WindowColorProfile::SRGB:
|
case gen::WindowColorProfile::SRGB:
|
||||||
system->setWindowsColorSpace(
|
osCS = system->makeColorSpace(gfx::ColorSpace::MakeSRGB());
|
||||||
system->makeColorSpace(gfx::ColorSpace::MakeSRGB()));
|
|
||||||
break;
|
break;
|
||||||
case gen::WindowColorProfile::SPECIFIC: {
|
case gen::WindowColorProfile::SPECIFIC: {
|
||||||
std::string name =
|
std::string name =
|
||||||
@ -276,13 +278,27 @@ void update_windows_color_profile_from_preferences()
|
|||||||
auto gfxCs = cs->gfxColorSpace();
|
auto gfxCs = cs->gfxColorSpace();
|
||||||
if (gfxCs->type() == gfx::ColorSpace::ICC &&
|
if (gfxCs->type() == gfx::ColorSpace::ICC &&
|
||||||
gfxCs->name() == name) {
|
gfxCs->name() == name) {
|
||||||
system->setWindowsColorSpace(cs);
|
osCS = cs;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the default color space for all windows (osCS can be nullptr
|
||||||
|
// which means that each window should use its monitor color space)
|
||||||
|
system->setWindowsColorSpace(osCS);
|
||||||
|
|
||||||
|
// Set the color space of all windows
|
||||||
|
for (ui::Widget* widget : manager->children()) {
|
||||||
|
ASSERT(widget->type() == ui::kWindowWidget);
|
||||||
|
auto window = static_cast<ui::Window*>(widget);
|
||||||
|
if (window->ownDisplay()) {
|
||||||
|
if (auto display = window->display())
|
||||||
|
display->nativeWindow()->setColorSpace(osCS);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_gui_config(os::WindowSpec& spec, bool& maximized)
|
static void load_gui_config(os::WindowSpec& spec, bool& maximized)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user