Added display scaling and updated flatpak info
This commit is contained in:
parent
ba75f394e8
commit
45fa4b2774
6 changed files with 47 additions and 15 deletions
|
|
@ -49,7 +49,8 @@
|
|||
<li>Place bookmarks on the canvas to jump to later</li>
|
||||
<li>Undo/Redo</li>
|
||||
<li>Screenshot to export parts of the canvas to a picture (can export to raster formats or SVG)</li>
|
||||
<li>Other tools such as: Textbox tool, Rectangle select tool, Lasso select tool, Color picker tool, Grid tool, Square and Ellipse tools</li>
|
||||
<li>Place text boxes with formatting</li>
|
||||
<li>Other tools such as: Rectangle select tool, Lasso select tool, Color picker tool, Grid tool, Square and Ellipse tools</li>
|
||||
<li>Copy and paste objects on the canvas, and between different canvases</li>
|
||||
<li>Insert images and files on the canvas</li>
|
||||
</ul>
|
||||
|
|
@ -58,6 +59,20 @@
|
|||
<launchable type="desktop-id">com.infinipaint.infinipaint.desktop</launchable>
|
||||
|
||||
<releases>
|
||||
<release version="0.3.0" date="2025-11-23">
|
||||
<description>
|
||||
<p>Major update:</p>
|
||||
<ul>
|
||||
<li>Unicode support across the entire app</li>
|
||||
<li>Text boxes now have many more formatting options</li>
|
||||
<li>UI theme changed</li>
|
||||
<li>Drag and drop direct URLs to images to download them onto the canvas</li>
|
||||
<li>Images/Resources that are being downloaded will show download progress</li>
|
||||
<li>Downloading resources won't completely stop other types of data from being sent</li>
|
||||
<li>VSync and display scaling options added</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="0.2.1" date="2025-10-29">
|
||||
<description>
|
||||
<p>Minor update:</p>
|
||||
|
|
|
|||
|
|
@ -74,8 +74,8 @@ modules:
|
|||
- '*'
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://github.com/google/skia/archive/f4ed99d2443962782cf5f8b4dd27179f131e7cbe.zip
|
||||
sha256: 2e00dcdb54942c1da7b2f6cfd9fef8c4899115206d940931f6c040bac08b6b79
|
||||
url: https://github.com/google/skia/archive/da51f0d60ea2b14e845a823dc11b405dbeef42d8.zip
|
||||
sha256: 1f5140d5908031d8cdd06429a633a1583b12fc43dc1c768374ed1e91ab9fa596
|
||||
- name: infinipaint-x86_64
|
||||
buildsystem: cmake-ninja
|
||||
builddir: true
|
||||
|
|
|
|||
|
|
@ -265,6 +265,15 @@ void MainProgram::set_vsync_value(int vsyncValue) {
|
|||
window.vsyncValue = vsyncValue;
|
||||
}
|
||||
|
||||
void MainProgram::update_scale_and_density() {
|
||||
window.scale = window.applyDisplayScale ? SDL_GetWindowDisplayScale(window.sdlWindow) : 1.0f;
|
||||
window.density = SDL_GetWindowPixelDensity(window.sdlWindow);
|
||||
}
|
||||
|
||||
float MainProgram::get_scale_and_density_factor_gui() {
|
||||
return window.scale * window.density;
|
||||
}
|
||||
|
||||
void MainProgram::draw(SkCanvas* canvas) {
|
||||
canvas->clear(transparentBackground ? SkColor4f{0.0f, 0.0f, 0.0f, 0.0f} : world->canvasTheme.backColor);
|
||||
world->draw(canvas);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,9 @@ class MainProgram {
|
|||
SkAlphaType defaultAlphaType;
|
||||
int vsyncValue = 1;
|
||||
|
||||
float density = 1.0f;
|
||||
float scale = 1.0f;
|
||||
bool applyDisplayScale = true;
|
||||
|
||||
int defaultMSAASampleCount = 0;
|
||||
SkSurfaceProps defaultMSAASurfaceProps;
|
||||
|
|
@ -94,6 +96,8 @@ class MainProgram {
|
|||
|
||||
void init_net_library();
|
||||
void set_vsync_value(int vsyncValue);
|
||||
void update_scale_and_density();
|
||||
float get_scale_and_density_factor_gui();
|
||||
|
||||
std::filesystem::path homePath;
|
||||
std::filesystem::path configPath;
|
||||
|
|
|
|||
|
|
@ -254,6 +254,7 @@ nlohmann::json Toolbar::get_config_json() {
|
|||
toRet["dragZoomSpeed"] = dragZoomSpeed;
|
||||
toRet["scrollZoomSpeed"] = scrollZoomSpeed;
|
||||
toRet["vsync"] = main.window.vsyncValue;
|
||||
toRet["applyDisplayScale"] = main.window.applyDisplayScale;
|
||||
toRet["showPerformance"] = showPerformance;
|
||||
toRet["displayName"] = main.displayName;
|
||||
toRet["useNativeFilePicker"] = useNativeFilePicker;
|
||||
|
|
@ -313,6 +314,7 @@ void Toolbar::set_config_json(const nlohmann::json& j, VersionNumber version) {
|
|||
catch(...) {
|
||||
main.set_vsync_value(1);
|
||||
}
|
||||
try{j.at("applyDisplayScale").get_to(main.window.applyDisplayScale);} catch(...) {}
|
||||
try{j.at("guiScale").get_to(guiScale);} catch(...) {}
|
||||
try{j.at("showPerformance").get_to(showPerformance);} catch(...) {}
|
||||
try{j.at("useNativeFilePicker").get_to(useNativeFilePicker);} catch(...) {}
|
||||
|
|
@ -1450,7 +1452,7 @@ void Toolbar::options_menu() {
|
|||
gui.checkbox_field("flip zoom tool direction", "Flip zoom tool direction", &flipZoomToolDirection);
|
||||
gui.input_scalar_field("jump transition time", "Jump transition time", &jumpTransitionTime, 0.01f, 1000.0f, 2);
|
||||
gui.checkbox_field("changebrushwidthwithspeed", "Change brush size with mouse speed", &velocityAffectsBrushWidth);
|
||||
gui.input_scalar_field("Max GUI Scale", "Max GUI Scale", &guiScale, 0.5f, 3.0f, 1);
|
||||
gui.input_scalar_field("Max GUI Scale", "Max GUI Scale", &guiScale, 0.5f, 5.0f, 1);
|
||||
|
||||
gui.text_label("VSync:");
|
||||
if(gui.radio_button_field("Vsync On", "On", main.window.vsyncValue == 1))
|
||||
|
|
@ -1460,6 +1462,8 @@ void Toolbar::options_menu() {
|
|||
if(gui.radio_button_field("Vsync Adaptive", "Adaptive", main.window.vsyncValue == -1))
|
||||
main.set_vsync_value(-1);
|
||||
|
||||
gui.checkbox_field("apply display scale", "Apply display scale", &main.window.applyDisplayScale);
|
||||
|
||||
gui.pop_id();
|
||||
break;
|
||||
}
|
||||
|
|
@ -1986,7 +1990,7 @@ void Toolbar::calculate_final_gui_scale() {
|
|||
}
|
||||
|
||||
float Toolbar::final_gui_scale_not_fit() {
|
||||
return guiScale * main.window.scale;
|
||||
return guiScale * main.get_scale_and_density_factor_gui();
|
||||
}
|
||||
|
||||
void Toolbar::end_gui() {
|
||||
|
|
|
|||
20
src/main.cpp
20
src/main.cpp
|
|
@ -438,7 +438,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
|
|||
mS.m->configPath = mS.configPath;
|
||||
mS.m->homePath = mS.homePath;
|
||||
mS.m->window.sdlWindow = mS.window;
|
||||
mS.m->window.scale = SDL_GetWindowPixelDensity(mS.window);
|
||||
mS.m->update_scale_and_density();
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_set_beforeunload_callback((void*)mSPtr, emscripten_before_unload);
|
||||
#else
|
||||
|
|
@ -554,7 +554,7 @@ SDL_AppResult SDL_AppIterate(void *appstate) {
|
|||
#ifdef NDEBUG
|
||||
try {
|
||||
#endif
|
||||
mS.m->window.scale = SDL_GetWindowPixelDensity(mS.window);
|
||||
mS.m->update_scale_and_density();
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
if(emscriptenFilesystemReadReady && !emscriptenFilesystemLoadConfigDone) {
|
||||
|
|
@ -655,12 +655,12 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
|
|||
mS.m->window.maximized = false;
|
||||
break;
|
||||
case SDL_EVENT_MOUSE_MOTION:
|
||||
mS.m->window.scale = SDL_GetWindowPixelDensity(mS.window);
|
||||
mS.m->update_scale_and_density();
|
||||
#ifdef _WIN32
|
||||
if(!mS.m->toolbar.tabletOptions.ignoreMouseMovementWhenPenInProximity || !mS.m->input.pen.inProximity)
|
||||
#endif
|
||||
{
|
||||
mS.m->input.mouse.set_pos({event->motion.x * mS.m->window.scale, event->motion.y * mS.m->window.scale});
|
||||
mS.m->input.mouse.set_pos({event->motion.x * mS.m->window.density, event->motion.y * mS.m->window.density});
|
||||
}
|
||||
break;
|
||||
case SDL_EVENT_MOUSE_BUTTON_UP:
|
||||
|
|
@ -700,16 +700,16 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
|
|||
mS.m->input.text.add_text_to_textbox(event->text.text);
|
||||
break;
|
||||
case SDL_EVENT_DROP_FILE:
|
||||
mS.m->window.scale = SDL_GetWindowPixelDensity(mS.window);
|
||||
mS.m->update_scale_and_density();
|
||||
mS.m->input.droppedItems.emplace_back(InputManager::DroppedItem{
|
||||
.pos = Vector2f{event->drop.x, event->drop.y} * mS.m->window.scale,
|
||||
.pos = Vector2f{event->drop.x, event->drop.y} * mS.m->window.density,
|
||||
.dataPath = std::u8string_view(reinterpret_cast<const char8_t*>(event->drop.data))
|
||||
});
|
||||
break;
|
||||
case SDL_EVENT_DROP_TEXT:
|
||||
mS.m->window.scale = SDL_GetWindowPixelDensity(mS.window);
|
||||
mS.m->update_scale_and_density();
|
||||
mS.m->input.droppedItems.emplace_back(InputManager::DroppedItem{
|
||||
.pos = Vector2f{event->drop.x, event->drop.y} * mS.m->window.scale,
|
||||
.pos = Vector2f{event->drop.x, event->drop.y} * mS.m->window.density,
|
||||
.dataText = event->drop.data
|
||||
});
|
||||
break;
|
||||
|
|
@ -722,9 +722,9 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
|
|||
break;
|
||||
}
|
||||
case SDL_EVENT_PEN_MOTION: {
|
||||
mS.m->window.scale = SDL_GetWindowPixelDensity(mS.window);
|
||||
mS.m->update_scale_and_density();
|
||||
mS.m->input.pen.isEraser = event->pmotion.pen_state & SDL_PEN_INPUT_ERASER_TIP;
|
||||
mS.m->input.mouse.set_pos({event->pmotion.x * mS.m->window.scale, event->pmotion.y * mS.m->window.scale});
|
||||
mS.m->input.mouse.set_pos({event->pmotion.x * mS.m->window.density, event->pmotion.y * mS.m->window.density});
|
||||
break;
|
||||
}
|
||||
case SDL_EVENT_PEN_DOWN: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue