mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-04 01:13:38 +00:00
Add option to disable GPU acceleration
This commit is contained in:
parent
7434dd053a
commit
03c0367827
@ -69,6 +69,7 @@
|
||||
<global>
|
||||
<section id="general">
|
||||
<option id="screen_scale" type="int" default="2" />
|
||||
<option id="gpu_acceleration" type="bool" default="true" />
|
||||
<option id="visible_timeline" type="bool" default="false" />
|
||||
<option id="autoshow_timeline" type="bool" default="true" migrate="Options.AutoShowTimeline" />
|
||||
<option id="rewind_on_stop" type="bool" default="false" />
|
||||
|
@ -37,6 +37,7 @@
|
||||
</combobox>
|
||||
</grid>
|
||||
</hbox>
|
||||
<check text="GPU acceleration" id="gpu_acceleration" tooltip="Check this option to enable hardware acceleration" />
|
||||
<check text="Expand menu bar items on mouseover" id="expand_menubar_on_mouseover" tooltip="Check this option to get this old menus behavior." />
|
||||
<hbox>
|
||||
<check text="Automatically save recovery data every" id="enable_data_recovery" tooltip="With this option you can recover your documents if the program finalizes unexpectedly." />
|
||||
|
@ -116,6 +116,14 @@ public:
|
||||
uiScale()->findItemIndexByValue(
|
||||
base::convert_to<std::string>(m_preferences.experimental.uiScale())));
|
||||
|
||||
if ((int(she::instance()->capabilities()) &
|
||||
int(she::Capabilities::GpuAccelerationSwitch)) == int(she::Capabilities::GpuAccelerationSwitch)) {
|
||||
gpuAcceleration()->setSelected(m_preferences.general.gpuAcceleration());
|
||||
}
|
||||
else {
|
||||
gpuAcceleration()->setVisible(false);
|
||||
}
|
||||
|
||||
// Right-click
|
||||
rightClickBehavior()->addItem("Paint with background color");
|
||||
rightClickBehavior()->addItem("Pick foreground color");
|
||||
@ -230,6 +238,12 @@ public:
|
||||
warnings += "<<- UI Elements Scale";
|
||||
}
|
||||
|
||||
bool newGpuAccel = gpuAcceleration()->isSelected();
|
||||
if (newGpuAccel != m_preferences.general.gpuAcceleration()) {
|
||||
m_preferences.general.gpuAcceleration(newGpuAccel);
|
||||
reset_screen = true;
|
||||
}
|
||||
|
||||
m_preferences.save();
|
||||
|
||||
if (!warnings.empty()) {
|
||||
@ -242,6 +256,7 @@ public:
|
||||
ui::Manager* manager = ui::Manager::getDefault();
|
||||
she::Display* display = manager->getDisplay();
|
||||
display->setScale(newScreenScale);
|
||||
she::instance()->setGpuAcceleration(newGpuAccel);
|
||||
manager->setDisplay(display);
|
||||
}
|
||||
}
|
||||
|
@ -155,6 +155,14 @@ public:
|
||||
return EventQueue::instance();
|
||||
}
|
||||
|
||||
bool gpuAcceleration() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
void setGpuAcceleration(bool state) override {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
Display* defaultDisplay() override {
|
||||
return unique_display;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ namespace she {
|
||||
MultipleDisplays = 1,
|
||||
CanResizeDisplay = 2,
|
||||
DisplayScale = 4,
|
||||
GpuAccelerationSwitch = 8,
|
||||
};
|
||||
|
||||
} // namespace she
|
||||
|
@ -33,7 +33,8 @@ EventQueueImpl g_queue;
|
||||
class SkiaSystem : public CommonSystem {
|
||||
public:
|
||||
SkiaSystem()
|
||||
: m_defaultDisplay(nullptr) {
|
||||
: m_defaultDisplay(nullptr)
|
||||
, m_gpuAcceleration(false) {
|
||||
}
|
||||
|
||||
~SkiaSystem() {
|
||||
@ -50,13 +51,22 @@ public:
|
||||
return Capabilities(
|
||||
int(Capabilities::MultipleDisplays) |
|
||||
int(Capabilities::CanResizeDisplay) |
|
||||
int(Capabilities::DisplayScale));
|
||||
int(Capabilities::DisplayScale) |
|
||||
int(Capabilities::GpuAccelerationSwitch));
|
||||
}
|
||||
|
||||
EventQueue* eventQueue() override {
|
||||
return &g_queue;
|
||||
}
|
||||
|
||||
bool gpuAcceleration() const override {
|
||||
return m_gpuAcceleration;
|
||||
}
|
||||
|
||||
void setGpuAcceleration(bool state) override {
|
||||
m_gpuAcceleration = state;
|
||||
}
|
||||
|
||||
Display* defaultDisplay() override {
|
||||
return m_defaultDisplay;
|
||||
}
|
||||
@ -109,6 +119,7 @@ public:
|
||||
|
||||
private:
|
||||
SkiaDisplay* m_defaultDisplay;
|
||||
bool m_gpuAcceleration;
|
||||
};
|
||||
|
||||
EventQueue* EventQueue::instance() {
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "she/event_queue.h"
|
||||
#include "she/skia/skia_display.h"
|
||||
#include "she/system.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
@ -229,14 +230,17 @@ void SkiaWindow::createRenderTarget(const gfx::Size& size)
|
||||
|
||||
void SkiaWindow::resizeImpl(const gfx::Size& size)
|
||||
{
|
||||
bool gpu = instance()->gpuAcceleration();
|
||||
(void)gpu;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#if SK_ANGLE
|
||||
if (attachANGLE()) {
|
||||
if (gpu && attachANGLE()) {
|
||||
m_backend = Backend::ANGLE;
|
||||
}
|
||||
else
|
||||
#endif // SK_ANGLE
|
||||
if (attachGL()) {
|
||||
if (gpu && attachGL()) {
|
||||
m_backend = Backend::GL;
|
||||
}
|
||||
else
|
||||
|
@ -36,6 +36,8 @@ namespace she {
|
||||
virtual Logger* logger() = 0;
|
||||
virtual NativeDialogs* nativeDialogs() = 0;
|
||||
virtual EventQueue* eventQueue() = 0;
|
||||
virtual bool gpuAcceleration() const = 0;
|
||||
virtual void setGpuAcceleration(bool state) = 0;
|
||||
virtual Display* defaultDisplay() = 0;
|
||||
virtual Display* createDisplay(int width, int height, int scale) = 0;
|
||||
virtual Surface* createSurface(int width, int height) = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user