mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Add experimental option to disable shaders for color selectors (#960)
This commit is contained in:
parent
1781ee0f15
commit
6ce205e0db
@ -213,6 +213,7 @@
|
||||
<option id="new_blend" type="bool" default="true" />
|
||||
<option id="use_native_clipboard" type="bool" default="true" />
|
||||
<option id="use_native_file_dialog" type="bool" default="false" />
|
||||
<option id="use_shaders_for_color_selectors" type="bool" default="true" />
|
||||
<option id="one_finger_as_mouse_movement" type="bool" default="true" />
|
||||
<option id="load_wintab_driver" type="bool" default="false" />
|
||||
<option id="flash_layer" type="bool" default="false" />
|
||||
|
@ -1302,6 +1302,7 @@ new_blend = New layer blending method
|
||||
new_render_engine = New render engine for sprite editor
|
||||
native_clipboard = Use native clipboard
|
||||
native_file_dialog = Use native file dialog
|
||||
shaders_for_color_selectors = Use shaders for color selectors
|
||||
one_finger_as_mouse_movement = Interpret one finger as mouse movement
|
||||
one_finger_as_mouse_movement_tooltip = <<<END
|
||||
Only for Windows 8/10 Pointer API: Interprets one finger as mouse movement
|
||||
|
@ -511,6 +511,12 @@
|
||||
</hbox>
|
||||
<check id="native_clipboard" text="@.native_clipboard" />
|
||||
<check id="native_file_dialog" text="@.native_file_dialog" />
|
||||
<hbox>
|
||||
<check id="shaders_for_color_selectors"
|
||||
text="@.shaders_for_color_selectors"
|
||||
pref="experimental.use_shaders_for_color_selectors" />
|
||||
<link text="(#960)" url="https://github.com/aseprite/aseprite/issues/960" />
|
||||
</hbox>
|
||||
<hbox id="load_wintab_driver_box">
|
||||
<check id="load_wintab_driver2"
|
||||
text="@.load_wintab_driver"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "app/color_spaces.h"
|
||||
#include "app/color_utils.h"
|
||||
#include "app/modules/gfx.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/ui/skin/skin_theme.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/util/shader_helpers.h"
|
||||
@ -441,8 +442,7 @@ void ColorSelector::onPaint(ui::PaintEvent& ev)
|
||||
os::Surface* painterSurface = nullptr;
|
||||
|
||||
#if SK_ENABLE_SKSL // Paint with shaders
|
||||
buildEffects();
|
||||
if (m_mainEffect && m_bottomEffect && m_alphaEffect) {
|
||||
if (buildEffects()) {
|
||||
SkCanvas* canvas;
|
||||
bool isSRGB;
|
||||
// TODO compare both color spaces
|
||||
@ -648,8 +648,11 @@ half4 main(vec2 fragcoord) {
|
||||
)";
|
||||
}
|
||||
|
||||
void ColorSelector::buildEffects()
|
||||
bool ColorSelector::buildEffects()
|
||||
{
|
||||
if (!Preferences::instance().experimental.useShadersForColorSelectors())
|
||||
return false;
|
||||
|
||||
if (!m_mainEffect) {
|
||||
if (const char* code = getMainAreaShader())
|
||||
m_mainEffect = buildEffect(code);
|
||||
@ -664,6 +667,8 @@ void ColorSelector::buildEffects()
|
||||
if (const char* code = getAlphaBarShader())
|
||||
m_alphaEffect = buildEffect(code);
|
||||
}
|
||||
|
||||
return (m_mainEffect && m_bottomEffect && m_alphaEffect);
|
||||
}
|
||||
|
||||
sk_sp<SkRuntimeEffect> ColorSelector::buildEffect(const char* code)
|
||||
|
@ -115,7 +115,7 @@ namespace app {
|
||||
|
||||
#if SK_ENABLE_SKSL
|
||||
static const char* getAlphaBarShader();
|
||||
void buildEffects();
|
||||
bool buildEffects();
|
||||
sk_sp<SkRuntimeEffect> buildEffect(const char* code);
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user