Commit graph

36 commits

Author SHA1 Message Date
Olivier Goffart
36a89aeff8 Software renderer: fix drawing background of rotated screen
We need to draw the background over the rotated rectangle otherwise we
don't fill the whole background.

Regression from https://github.com/slint-ui/slint/pull/7685

(also cleanup a useless blend that was leftover from the same change)

Adapt the screenshot test to have at least one non-square "window" so
that we catch the problem in the future
2025-03-06 00:09:35 +01:00
Yuri Astrakhan
bcb2953f00 Auto-fixed clippy::unnecessary_map_or
This is a hacky approach, but does help a lot with the tedious fixes.

See https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_map_or

```
__CARGO_FIX_YOLO=1 cargo clippy --fix  --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::unnecessary_map_or

cargo fmt --all
```
2025-02-07 09:02:31 +01:00
Yuri Astrakhan
5356fdcf89 Fix clippy issues, plus a few manual cleanups
* Run `cargo clippy --fix`
*  `BackendSelector` is easier to instantiate with auto `Default`
2025-02-06 17:28:51 +01:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Tobias Hunger
2e3b00e38e janitor: Fix some clippy warnings pre-release
Nothing that should be controversial, but the
`internal/compiler/builtin_macros.rs` could point to a thinko in the original
commit.
2024-05-06 16:47:14 +02:00
Olivier Goffart
f45bab6a3f swrenderer: Support multiple rectangles for the dirty regions
This allow to be much faster in the case two small area of the screen
changes.
2024-04-26 14:45:23 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Olivier Goffart
424f046416 swrenderer: refactor image drawing algorithm
For tiling, we will need to know the actual source size in addition to
the scaling factor that can be different. So store the scaling factors
in the scene command, as well as an offset where to start.

This is more accurate in case of clipping and rotation.
For rotation that doesn't matter (appart from the fact that the testing
can now be more strict)
But for clipping this prevent glitches with partial rendering where it
would seem like the image are moving a bit by a pixel when it is redrawn
with a different clip
2024-02-15 18:25:47 +01:00
Olivier Goffart
b2143f6bce Fix border-image screenshot test
The test will test that things are rendered the same with a clip. But
that gives bad error when rendering images with high ferquencies because
a small difference in the initial condition of drawing may result in
being off by a pixel.
2024-02-13 14:46:27 +01:00
Simon Hausmann
367af4fdf4 Align rotation between software renderer and LinuxKMS backend
As discussed a few days ago, let's define rotation to be always
clockwise, as it is done in other graphics frameworks as well as our
own image rotation. This means changing the definition for the
software renderer. Also fixed docs for the enum in the linuxkms backend
that was wrong.
2024-02-07 11:21:59 +01:00
Simon Hausmann
95044c3a09
Rename WindowRotation to RenderingRotation in the software renderer (#4181)
Same term as we're going to use in the linuxkms backend.
2023-12-19 08:47:55 +01:00
J-P Nurmi
6f2fc9967a test-driver-screenshots: don't generate rotated screenshots 2023-10-10 10:39:13 +02:00
Olivier Goffart
b0bc14d8a4 Fix the screenshot tests for rotated gradients
Rotated gradients are not precise enough and have big differences when
rotated.
So add an option to ignore them
2023-10-09 18:07:23 +02:00
Olivier Goffart
b6636b2e94 swrender: Implement window rotation by 180° and 270°
(The tests are still failling)
2023-10-09 18:07:23 +02:00
Olivier Goffart
ec36d46740 WIP: experiment with screen rotation
TODO:
 - Polish the API
 - Most screenshot test are failling because the rotation don't draw the
   rounded rectangle exactly the same (that's because the border
   rectangle algo is not perfect), and also scaled image are not pixel
   perfect

The updated screenshot is because of a small change in the image
rendering algorithm that changes the rounding slightly.
2023-10-09 18:07:23 +02:00
Olivier Goffart
46ec7875ed Software renderer: partial rendering with winit and fix non-opaque background
Implement the partial rendering with winit and our software renderer.

When the background is not opaque, we must still initialize all the
pixel with 0 otherwise we blend over the previous frame.
(That wasn't visible before because the buffer was always empty)
2023-09-13 16:08:57 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Olivier Goffart
6eef589043 Fix panic in the software renderer with clipped text and scale factor
We ended rendering glyphs with empty or even negative size, causing
panics down the line.

I added a way in the screenshot tester to change the scale factor

CC: #2957
2023-07-07 13:12:33 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Olivier Goffart
4dd10f4a78 Make WindowAdaptor::request_redraw public 2023-06-13 20:29:52 +02:00
Olivier Goffart
23b910725f Rename WindowAdapterSealed to WindowAdapterInternal 2023-06-13 17:44:04 +02:00
Olivier Goffart
f4dba7bcfd Seal the Renderer trait
Because we need to make the Render trait public so one can re-implement
the WindowAdapter trait
2023-06-13 17:44:04 +02:00
Tobias Hunger
d9d99fa4de Fix compile fail with nightly
A new warning was added and we deny warnings.
2023-02-21 08:58:19 +01:00
Olivier Goffart
6889dfa5f5 Rust: Make new(), run() and show() report errors from the backend
Fixes #2198
2023-02-10 05:00:03 +01:00
Olivier Goffart
a19efc30db
Replace the MAX_BUFFER_AGE const generic with a runtime enum
Having a const generic for that didn't turn to be a good API.
Also made the C++ side more difficult

(Also renamed buffer_stride to pixel_stride)

Closes #2135
2023-02-08 14:44:01 +01:00
Olivier Goffart
7e56af7c6d screenshot test: Test gradients
Allow for a small differences as "roundeing error" while drawing gradients.
Note that when stops are involved, we still get artifacts and bigger difference
than tollerable when clipping
2023-02-02 15:54:07 +01:00
Simon Hausmann
8c807cb1da
Remove slint::Image::stride() (#2147)
cc #2138
2023-01-30 13:59:31 +01:00
Olivier Goffart
aafc9ceaaf Screenshot test: test partial rendering
Test what when we do a screenshot for a region of the image, it gives the right result.
(Otherwise we might see flickering arounf the clipped region)
2023-01-27 13:15:25 +01:00
Tobias Hunger
b7674918a3 janitor: Fix clippy errors
These are reported as errors by clippy (nothing major IMHO), but they
stop clippy from looking at all files, so let's get them out of the way.
2023-01-16 14:42:36 +01:00
Simon Hausmann
3e050b5d98 Add crossterm pixel diff output to the screenshot image comparison
Taken from https://github.com/slint-ui/slint/pull/2020
2023-01-09 14:12:33 +01:00
Simon Hausmann
2f14be54fa Improve the way the screenshots are saved in tests
Save them inside the testing framework, instead of at the call site, and only when the test fails. Also added
some more details on the failure reason.
2023-01-09 14:12:33 +01:00
Simon Hausmann
c8047d13d4 Print the maximum color difference when a screenshot test fails 2023-01-09 14:12:33 +01:00
Simon Hausmann
dce3a32407 Print how many pixels are different when a screenshot test fails 2023-01-09 14:12:33 +01:00
Florian Blasius
501c6af746
Add swr render test and driver (#1955)
* add test-driver-screenshots
* add screenshot based software renderer testing
* create reference screenshots for testing with  test-driver-screenshots
* add documentation to testing `README.md`
2022-12-12 11:23:27 +01:00