mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-05 09:40:02 +00:00
Don't reset Screen Scale when the main window cannot be created
Should fix #860
This commit is contained in:
parent
55f60be79a
commit
30672ba144
@ -67,7 +67,7 @@
|
|||||||
|
|
||||||
<global>
|
<global>
|
||||||
<section id="general">
|
<section id="general">
|
||||||
<option id="screen_scale" type="int" default="2" />
|
<option id="screen_scale" type="int" default="0" />
|
||||||
<option id="gpu_acceleration" type="bool" default="false" />
|
<option id="gpu_acceleration" type="bool" default="false" />
|
||||||
<option id="visible_timeline" type="bool" default="false" />
|
<option id="visible_timeline" type="bool" default="false" />
|
||||||
<option id="autoshow_timeline" type="bool" default="true" migrate="Options.AutoShowTimeline" />
|
<option id="autoshow_timeline" type="bool" default="true" migrate="Options.AutoShowTimeline" />
|
||||||
|
@ -94,27 +94,25 @@ static void load_gui_config(int& w, int& h, bool& maximized,
|
|||||||
std::string& windowLayout);
|
std::string& windowLayout);
|
||||||
static void save_gui_config();
|
static void save_gui_config();
|
||||||
|
|
||||||
static int get_screen_scale()
|
|
||||||
{
|
|
||||||
int scale = Preferences::instance().general.screenScale();
|
|
||||||
scale = MID(1, scale, 4);
|
|
||||||
return scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool create_main_display(bool gpuAccel,
|
static bool create_main_display(bool gpuAccel,
|
||||||
bool& maximized,
|
bool& maximized,
|
||||||
std::string& lastError)
|
std::string& lastError)
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
int scale = get_screen_scale();
|
|
||||||
std::string windowLayout;
|
std::string windowLayout;
|
||||||
load_gui_config(w, h, maximized, windowLayout);
|
load_gui_config(w, h, maximized, windowLayout);
|
||||||
|
|
||||||
|
// Scale is equal to 0 when it's the first time the program is
|
||||||
|
// executed.
|
||||||
|
int scale = Preferences::instance().general.screenScale();
|
||||||
|
|
||||||
she::instance()->setGpuAcceleration(gpuAccel);
|
she::instance()->setGpuAcceleration(gpuAccel);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (w > 0 && h > 0)
|
if (w > 0 && h > 0) {
|
||||||
main_display = she::instance()->createDisplay(w, h, scale);
|
main_display = she::instance()->createDisplay(
|
||||||
|
w, h, (scale == 0 ? 2: MID(1, scale, 4)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (const she::DisplayCreationException& e) {
|
catch (const she::DisplayCreationException& e) {
|
||||||
lastError = e.what();
|
lastError = e.what();
|
||||||
@ -124,12 +122,10 @@ static bool create_main_display(bool gpuAccel,
|
|||||||
for (int c=0; try_resolutions[c].width; ++c) {
|
for (int c=0; try_resolutions[c].width; ++c) {
|
||||||
try {
|
try {
|
||||||
main_display =
|
main_display =
|
||||||
she::instance()->createDisplay(try_resolutions[c].width,
|
she::instance()->createDisplay(
|
||||||
try_resolutions[c].height,
|
try_resolutions[c].width,
|
||||||
try_resolutions[c].scale);
|
try_resolutions[c].height,
|
||||||
|
(scale == 0 ? try_resolutions[c].scale: scale));
|
||||||
scale = try_resolutions[c].scale;
|
|
||||||
Preferences::instance().general.screenScale(scale);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
catch (const she::DisplayCreationException& e) {
|
catch (const she::DisplayCreationException& e) {
|
||||||
@ -139,6 +135,11 @@ static bool create_main_display(bool gpuAccel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (main_display && !windowLayout.empty()) {
|
if (main_display && !windowLayout.empty()) {
|
||||||
|
// Change the scale value only in the first run (this will be
|
||||||
|
// saved when the program is closed).
|
||||||
|
if (scale == 0)
|
||||||
|
Preferences::instance().general.screenScale(main_display->scale());
|
||||||
|
|
||||||
main_display->setLayout(windowLayout);
|
main_display->setLayout(windowLayout);
|
||||||
if (main_display->isMinimized())
|
if (main_display->isMinimized())
|
||||||
main_display->maximize();
|
main_display->maximize();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user