Commit graph

22726 commits

Author SHA1 Message Date
Sam Atkins 6b66e39df4 LibGUI+Userland: Stop returning Layout from Widget::(try_)set_layout()
Nobody uses this return value any more. It also lets us remove a whole
bunch of `(void)` casts. :^)
2023-02-18 16:56:56 +00:00
Sam Atkins 77ad0fdb07 Userland: Specify margins and spacing in the GUI::Layout constructor 2023-02-18 16:56:56 +00:00
Sam Atkins 9561ec15f4 Userland: Use Widget::add_spacer() everywhere 2023-02-18 16:56:56 +00:00
Sam Atkins 43dddafd16 LibGUI: Allow specifying Layout margins and spacing in the constructor
This is comfier than `my_widget->layout()->set_margins(...)`.
2023-02-18 16:56:56 +00:00
Sam Atkins ab6ef53247 LibGUI: Add Widget::add_spacer() wrapper
This just calls Layout::try_add_spacer(), but saves you having to access
the Widget's Layout directly.

We verify that the Widget has a Layout, since it would be a programming
error if we tried to do so without one.
2023-02-18 16:56:56 +00:00
MacDue 6ceb185865 LibGfx: Add ALWAYS_INLINE to Color::mixed_with()/interpolate()
I can see small speedup of about 6-7% with this for some gradient
painting, though Tim has been able to see an ~30% speedup in some
resizing cases so this seems like a worthwhile change.

Co-authored-by: Tim Ledbetter <timledbetter@gmail.com>
2023-02-18 17:10:04 +01:00
MacDue 3cc074c1b0 LibGfx: De-duplicate color interpolation code 2023-02-18 17:10:04 +01:00
MacDue e5a39d134b LibGfx: Move Color::mixed_with() inline
This seems to give a small speedup to gradient painting and removes
Color::mixed_with() (which was 10% of the time) from the profile.
2023-02-18 17:10:04 +01:00
Timothy Flynn 8a94c7a7f7 LibGUI: Skip over grapheme clusters on left/right arrow key presses
Currently, if you use the left/right arrow keys to move over a multi-
code point glyph, we will move through that glyph one code point at a
time. This means you can "pause" your movement in the middle of a glyph
and delete a subsection of a grapheme cluster. This now moves the cursor
across the entire cluster.

Visually, we will need to separately track physical and virtual cursor
positions. That is, when you move across a multi-code point glyph, the
visual cursor should only move one position at a time, while a physical
cursor stores the "real" position in terms of number of code points.

This also converts a couple of ints to auto - these are actually size_t,
and are being passed to functions that expect size_t, so let's not cast
them to ints.
2023-02-18 16:54:46 +01:00
Karol Kosek ba5df46a49 PixelPaint: Propagate errors from making filter settings widgets 2023-02-17 22:45:44 -07:00
Jelle Raaijmakers 8f015a18a5 LibJS: Dereference intrinsic accessor before deleting it
The iterator used to find an intrinsic accessor is used after calling
`HashMap.remove()` on it, which works for our current implementation but
will fall apart when you consider that modifications to the hash map
might invalidate all existing iterators that came from it, as many
implementations do.

Since we're aiming to replace our `HashTable` implementation with
something new, let's fix this first :^)
2023-02-17 22:29:51 -07:00
Ali Mohammad Pur 99d264afbe Shell: Correct the out-of-bounds expansion bailing condition
Also adds a couple (useful) debug prints which helped track down the
problem.
2023-02-18 06:55:46 +03:30
Ali Mohammad Pur d56fbaa7e8 Shell: Allow underscores in normal expansion names 2023-02-18 06:55:46 +03:30
Ali Mohammad Pur a6d77162f4 Shell: Correctly keep track of special parameter length
We were previously treating special expansions (e.g. $#) as zero-length
expansions, which made the shell repeat them literally after expanding
them.
2023-02-18 06:55:46 +03:30
Ali Mohammad Pur 6da438e992 Shell: Clear expansions after committing a word in the POSIX parser 2023-02-18 06:55:46 +03:30
Ali Mohammad Pur 2881bb4c3a Shell: Add support for heredocs to the POSIX parser 2023-02-18 06:55:46 +03:30
Ali Mohammad Pur a5e4bc4faf Shell: Add a '--posix' mode to the 'dump' builtin 2023-02-18 06:55:46 +03:30
Ali Mohammad Pur 4efc632e15 Shell: Allow the heredoc node to act as a redirection too
This will be used in a future commit to implement POSIX sh heredocs.
2023-02-18 06:55:46 +03:30
Nico Weber 7880e11690 icc: Add flags for writing and dumping profiles
This adds three flags to icc:

* --reencode-to=<file> re-serializes a profile to a given file,
  using Gfx::ICC::encode(). This is mainly useful for testing that
  code.

* --dump-to=<file> dumps the raw ICC profile bytes read from the
  input to disk. This is useful for extracting ICC profiles from
  images, and for comparing the raw profile bytes to the profile
  bytes written by --reencode-to=.

If either of these flags is passed, icc by default no longer dumps
the icc data to stdout. To force priting of the data even if either
of these flags is present, this also adds:

* --print, which forces printing ICC contents, even if either or
  both of the icc-data writing flags are present.
2023-02-17 20:05:50 -07:00
Nico Weber 8b8b7b232e LibGfx: Add start of an ICC profile writer
For now, this can write the profile header.

`icc` refuses to dump its contents since the required copyrightTag,
profileDescriptionTag, and required per-device-class tags are missing,
but it looks ok in a hex editor.
2023-02-17 20:05:50 -07:00
Nico Weber e8a2c17f8f LibGfx: Add an accessor for the raw ICC Version minor_and_bugfix byte
This is makes it easier to write this value back out.
2023-02-17 20:05:50 -07:00
Nico Weber 0ab3f45135 LibGfx: Add a XYZ->XYZNumber conversion constructor
This is useful for converting XYZs back to the on-disk format.
2023-02-17 20:05:50 -07:00
Nico Weber 0ca620a286 LibGfx: Move ICC ProfileFileSignature into a constant in BinaryFormat.h
...so that it can be used by ICC writing code too.
2023-02-17 20:05:50 -07:00
Nico Weber 78d849bce2 LibGfx: Make ICCHeader use RenderingIntent enum
No behavior change.
2023-02-17 20:05:50 -07:00
Nico Weber 429467f46c LibGfx: Move ICC on-disk structs to new BinaryFormat.h
Removes some existing code duplication and allows future files to use
these structs too.
2023-02-17 20:05:50 -07:00
Nico Weber 2a1cd84155 LibGfx: Minorly simplify BMPLoader's decode_bmp_dib()
header_size is already set to 0 if context.is_included_in_ico is true
and to bmp_header_size else, so we can remove some redundant checks
for context.is_included_in_ico.

No behavior change.
2023-02-18 01:45:12 +01:00
Jelle Raaijmakers 62285e0569 LibSoftGPU: Use multiplication instead of division for linear fog
Sampling profiling shows a reduction of nearly 60% for the linear fog
calculation case.
2023-02-18 01:45:00 +01:00
Jelle Raaijmakers f54d9c0a61 LibSoftGPU: Use AK::SIMD::exp_approximate instead of ::exp
The approximate version is properly vectorized and results in fewer
stalls than the `::exp` version.
2023-02-18 01:45:00 +01:00
Luke Wilde 3275d659bf LibWeb: Convert FormData to String and Vector storage
This makes use of the new [UseNewAKString] extended attribute. Using
Vector storage will make it easier to make this interface into an IDL
iterable. It seems the reason it didn't use Vector originally was due
to awkward DeprecatedString -> String conversions.
2023-02-18 01:23:36 +01:00
Kenneth Myhra 84c7af4dcb LibWeb: Make factory method of XHR::ProgressEvent fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 35622606c1 LibWeb: Make factory method of URL::URLSearchParams fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 71316614b8 LibWeb: Make factory method of SVG::SVGLength fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra bfc8cbcf3b LibWeb: Make factory method of HTML::ModuleScript fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 3e834636a6 LibWeb: Make factory method of HTML::Window fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra b41401bab2 LibWeb: Make factory method of HTML::Storage fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra d7ee378018 LibWeb: Make factory method of HTML::Navigator fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 2f4db60c08 LibWeb: Make factory method of HTML::History fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 3941e64fde LibWeb: Make factory method of HTML::PromiseRejectionEvent fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 193de231e0 LibWeb: Make factory method of HTML::WorkerNavigator fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 86b7f148b9 LibWeb: Make factory method of HTML::Path2D fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 2b391ea622 LibWeb: Make factory method of HTML::HTMLOptionsCollection fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra b604bbaf29 LibWeb: Make factory method of HTML::DOMStringMap fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 809206f50e LibWeb: Make factory method of HTML::SubmitEvent fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra c5de2c3348 LibWeb: Make factory method of HTML::TextMetrics fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra d9845bb24b LibWeb: Make factory method of HTML::PageTransitionEvent fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 97b5aa56da LibWeb: Make factory method of HTML::ErrorEvent fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 2ed7f64c73 LibWeb: Make factory method of HTML::CloseEvent fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra b7c488e51e LibWeb: Make factory method of HTML::CanvasRenderingContext2D fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 2506666991 LibWeb: Make factory methods of HTML::CanvasGradient fallible 2023-02-18 00:52:47 +01:00
Kenneth Myhra 63b69f3672 LibWeb: Make factory method of SVG::SVGAnimatedLength fallible 2023-02-18 00:52:47 +01:00