Commit graph

22416 commits

Author SHA1 Message Date
Julian Offenhäuser
ab5b61c3fe DisplaySettings: Capitalize fallback display mode when loading settings
This setting was capitalized a while ago, except for this place where
we fall back to "[C]center". This caused a crash in MonitorWidget.
2023-02-10 15:41:56 +01:00
Aliaksandr Kalenik
2649bc737f LibWeb: Use device pixels for transform rect of stacking context 2023-02-10 15:38:54 +01:00
Julian Offenhäuser
4f4bd3793f LibPDF: Fix glyph sizing bug that caused incorrect spacing
When loading OpenType fonts, either as a replacement for the standard
14 fonts or an embedded one, we previously passed the font size as the
_point_ size to the loader class. The difference is quite subtle, being
that Gfx::ScaledFont uses the optional dpi parameter to convert the
input from inches to pixels.

This meant that our glyphs were exactly 1.333% too large, causing them
to overlap in places.
2023-02-10 15:37:51 +01:00
Julian Offenhäuser
152a8c5c43 LibPDF: Use more appropriate standard 14 replacement fonts
The mapping of standard font to replacement now looks like this:

Times New Roman -> Liberation Serif
Courier -> Liberation Mono
Helvetica, Arial -> Liberation Sans
2023-02-10 15:37:51 +01:00
Nico Weber
b232281d15 LibGfx+icc: Read chromaticityTag
This isn't terribly useful. But some profiles, for example the ones at
https://vpifg.com/help/icc-profiles/, do contain this tag and it seems
nice to be able to dump it, just for completeness.

I haven't seen any files that contain a phosphor or colorant type
different from "Unknown", even for the Rec2020 profile on that page.
(It has x,y coordinates that match the values required for Rec2020,
but it doesn't set the phosphor or colorant type to that.)
2023-02-10 14:23:37 +00:00
Nico Weber
c61cfdd5ed LibGfx+icc: Read viewingConditionsType
Not terribly useful in practice either and also mostly for
completionism. But with this, we can dump all types present
in Lightroom Classic-exported jpegs :^)
2023-02-10 14:16:52 +00:00
Nico Weber
664946c543 LibGfx+icc: Read measurementType
Also not terribly useful in practice and mostly for completionism.
Lightroom Classic-exported jpegs contain this type in their ICC data.
2023-02-10 14:02:19 +00:00
Timothy Flynn
7955cb14fb LibWeb: Add missing GCPtr.h includes to Fetch headers
These are missing in most Fetch headers, and clangd is (rightfully) very
loud about it on a few of these.
2023-02-10 13:53:45 +00:00
Liav A
56b799c556 LibEDID: Return proper errno codes for kernel code 2023-02-10 09:14:20 +00:00
Timothy Flynn
604d5f5bca AK+Everywhere: Do not implicitly copy variables in TRY macros
For example, consider cases where we want to propagate errors only in
specific instances:

    auto result = read_data(); // something like ErrorOr<ByteBuffer>
    if (result.is_error() && result.error().code() != EINTR)
        continue;
    auto bytes = TRY(result);

The TRY invocation will currently copy the byte buffer when the
expression (in this case, just a local variable) is stored into
_temporary_result.

This patch binds the expression to a reference to prevent such copies.
In less trival invocations (such as TRY(some_function()), this will
incur only temporary lifetime extensions, i.e. no functional change.
2023-02-10 09:08:52 +00:00
Timothy Flynn
4a916cd379 Everywhere: Remove needless copies of Error / ErrorOr instances
Either take the underlying objects with release_* methods or move() the
instances around.
2023-02-10 09:08:52 +00:00
Timothy Flynn
142f327e63 LibGfx: Remove the optional Error member from QOI's decoder context 2023-02-10 09:08:52 +00:00
Tim Ledbetter
d32961777b Spreadsheet: Don't recalculate column sizes when no data has changed
Use the Model::UpdateFlag::DontResizeColumns option when performing a
model update where no data has been changed. This improves navigation
performance on large spreadsheets.
2023-02-10 05:12:06 +03:30
Tim Ledbetter
59855e49df LibGUI: Add a DontResizeColumns option to Model::UpdateFlag
This allows an application to signal that column sizes do not
need to be recalculated for a given model update.
2023-02-10 05:12:06 +03:30
Tim Ledbetter
99570cb0c4 LibGUI: Speed up Variant string conversion for string data
Add a fast path to Variant::to_deprecated_string() to return a copy
if the underlying data is of type DeprecatedString. This improves the
performance of models with a lot of string data.
2023-02-10 05:12:06 +03:30
Julian Offenhäuser
adb1c842c2 SoundPlayer: Fix logic bug in bars visualization
When calculating bar height, we clamp our values to the maximum
vertical height of the widget minus a margin. When the window was
resized such that the widget got smaller than this margin however,
our maximum height became negative. This caused a crash in clamp().
2023-02-09 19:41:54 +01:00
Timothy Flynn
c3abb1396c LibJS+LibWeb: Convert string view PrimitiveString instances to String
First, this adds an overload of PrimitiveString::create for StringView.
This overload will throw an OOM completion if creating a String fails.
This is not only a bit more convenient, but it also ensures at compile
time that all PrimitiveString::create(string_view) invocations will be
handled as String and OOM-aware.

Next, this wraps all invocations to PrimitiveString::create(string_view)
with MUST_OR_THROW_OOM.

A small PrimitiveString::create(DeprecatedFlyString) overload also had
to be added to disambiguate between the StringView and DeprecatedString
overloads.
2023-02-09 17:13:33 +00:00
Timothy Flynn
69a56a8e39 LibJS: Convert short string literal PrimitiveString instances to String 2023-02-09 17:13:33 +00:00
Timothy Flynn
49e8dcf0b2 LibJS+LibWeb: Convert empty PrimitiveString instances to String 2023-02-09 17:13:33 +00:00
Nico Weber
e99a4ba7c8 icc: Call video_full_range_flag_to_string() 2023-02-09 16:35:08 +00:00
Nico Weber
405efc5936 LibVideo: Add a video_full_range_flag_to_string() function 2023-02-09 16:35:08 +00:00
Nico Weber
89b98830f6 LibVideo: Rename "ColorRange" to "VideoFullRangeFlag"
That matches the terminology used in ITU-T Rec. H.273,
PNG's cICP chunk, and the ICC cicpTag.

Also change the enum values to match the values in the spec --
0 means "not full range" and 1 means "full range".

(For now, keep the "Unspecified" entry around, and give it value 2.
This value is not in the spec.)

No intended behavior change.
2023-02-09 16:35:08 +00:00
kleines Filmröllchen
e127c4acdc Piano: Show a progress window when exporting WAV
This exposes that the export is pretty slow, but it's much nicer than
having the GUI lock up for 20s :^)
2023-02-08 20:07:37 -05:00
Tim Ledbetter
392dac0818 LibGfx: Make checkerboard patterns static when panning
Previously checkerboard patterns were anchored to the top left of the
bitmap they were being drawn into.

This makes the transparency grid in PixelPaint static relative to the
canvas when panning.
2023-02-08 21:53:34 +01:00
Zaggy1024
b0db56cd39 VideoPlayer/LibVideo: Seek accurately when scrolling in the seek bar
Fast seeking does not work correctly when seeking in small increments,
so it is necessary to use accurate seeking when using certain actions.

The PlaybackManager has been changed to accept the seek mode as a
parameter to `seek_to_timestamp` to facilitate this. This now means
that it no longer has to track a seek mode preference.
2023-02-08 21:52:42 +01:00
Zaggy1024
1f650088a0 LibVideo/Matroska: Stop skipping a cue when seeking forward
This would cause seeks where the approximate starting cue index was one
cue before the optimal cue to not change the sample iterator position.
Fixing this issue improves accurate seek speeds significantly.
2023-02-08 21:52:42 +01:00
Zaggy1024
448d121304 LibVideo/Matroska: Add debug logging for seeking to cues 2023-02-08 21:52:42 +01:00
Zaggy1024
3bfef8bfe0 LibVideo: Pass the current sample to demuxers to lazily seek better
In cases where the PlaybackManager's earliest buffered or displayed
sample is closer to the seek target than the demuxer's chosen keyframe,
we don't want to seek at all. To enable this, demuxers now receive an
optional parameter with the earliest timestamp that the caller can
still access.

The demuxer in turn returns an optional to indicate when a seek was not
needed, which allows PlaybackManager to avoid clearing its queue and
re-decoding frames.
2023-02-08 21:52:42 +01:00
Zaggy1024
275d57eb6f LibVideo/PlaybackManager: Organize playback states into virtual classes
Storing playback states in virtual classes allows the behavior to be
much more clearly written. Each `PlaybackStateHandler` subclass can
implement some event-handling functions to model their behavior, and
has functions to change its parent PlaybackManager's state to any other
state.

This will allow expanding the functionality of playback in the future,
for example to allow skipping a single frame forward/backward.
2023-02-08 21:52:42 +01:00
Zaggy1024
a4c7672802 LibVideo: Rename Status -> State in PlaybackStatusChangeEvent class
A bit of a bikeshed, but status sounds more like a result of an action,
and state sounds more accurate to what the `PlaybackManager` does.

The previous and current state fields of the `PlaybackStateChangeEvent`
are now removed, since they were unused (for now).

This is a lead-up to the refactoring of VideoPlaybackManager to make
that diff more legible.
2023-02-08 21:52:42 +01:00
Nico Weber
2ff11bac3d LibGfx+icc: Implement half of lutAToBType and lutBToAType
These are among the permitted tag types of ATo0Tag and BToA0Tag,
which are among the required tags of most profiles. They are the
last permitted tag types for those profiles (the other are
lut8Type or lut16Type, which are already implemented).

They are pretty chonky types though, so this only implements
support for the E matrix and the CLUT. Support for the various
curves will be in a future PR.
2023-02-08 19:44:03 +00:00
Nico Weber
913119b492 LibGfx: Use size_t instead of unsigned in ICC loops 2023-02-08 19:44:03 +00:00
Tim Ledbetter
4b604f702e PixelPaint: Correct move tool alignment with the layer boundary
Previously, the move tool outline could "wobble" relative to the layer
boundary. This caused the layer boundary to appear and disappear when
zooming. With this commit, the layer boundary is always drawn behind
the move tool outline.
2023-02-08 20:29:48 +01:00
Tim Ledbetter
cc18d6fd25 PixelPaint: Use image coordinates for bucket tool bounds checking
Previously, layer coordinates were being used to check whether the
bucket tool was within the bounds of the current selection, rather
than image coordinates.
2023-02-08 20:28:55 +01:00
Tim Schumacher
e8d5e938de AK: Remove the deprecated Stream implementation :^) 2023-02-08 19:18:26 +00:00
MacDue
63b11030f0 Everywhere: Use ReadonlySpan<T> instead of Span<T const> 2023-02-08 19:15:45 +00:00
Julian Offenhäuser
463ab21305 LibC: Add strcasestr()
strcasestr() behaves exactly like strstr(), except it ignores case for
both inputs. This function is a nonstandard extension.
2023-02-08 19:06:42 +00:00
Zaggy1024
df313c3dc5 LibVideo/VP9: Clamp motion vectors again in find_mv_refs function
The clamping was previously removed apparently, which was unintended
and caused some files to fail to decode properly.
2023-02-08 18:56:42 +00:00
Zaggy1024
c18728989e LibVideo/VP9: Remove magic numbers for the uncompressed ref frames
This also adds a fixme to Symbols.h to group and rename the definitions
in the file.
2023-02-08 18:56:42 +00:00
Zaggy1024
24f3069129 LibVideo/VP9: Remove debug output from TreeParser 2023-02-08 18:56:42 +00:00
Tim Schumacher
a86184c997 AudioServer: Use AK::Stream to serialize mixed samples 2023-02-08 18:51:02 +00:00
Tim Schumacher
185787d29d TelnetServer: Use AK::Stream to serialize commands 2023-02-08 18:51:02 +00:00
Tim Schumacher
43f36d5e7f LibTLS: Use AK::Stream for serializing TLS packets
We are working with a MemoryStream, so our stream operations shouldn't
ever fail as long as we stay in-bounds, so `MUST` is fine.
2023-02-08 18:51:02 +00:00
Tim Schumacher
a6bcad551d LibCrypto: Use AK::Stream for pretty printing DER 2023-02-08 18:50:53 +00:00
Tim Schumacher
f5fb1396e8 LibCrypto: Use ErrorOr error handling for parsing DER
This replaces a mixture of `Result`, `Optional`, and a custom error enum
with our usual `ErrorOr`-based error handling.
2023-02-08 18:50:53 +00:00
Tim Schumacher
e80eb09fe5 LibGfx: Use AK::Stream to serialize and deserialize bitmaps 2023-02-08 18:50:43 +00:00
Tim Schumacher
6ea3c1659a LibGfx: Propagate errors from serializing bitmaps
We essentially just end up moving `release_value_but_fixme_...` one
layer down, but it makes adding more fallible operations in the
serialization function more comfortable.
2023-02-08 18:50:43 +00:00
Undefine
ccc871e608 LibCore: Propagate errors in SecretString 2023-02-08 19:49:48 +01:00
Rodrigo Tobar
e4a7606b81 LibPDF: Construct accented characters with Type1 seac command
The seac command provides the base and accented character that are
needed to create an accented character glyph. Storing these values is
all that was left to properly support these composed glyphs.
2023-02-08 19:47:15 +01:00
Rodrigo Tobar
3eaa27f53a LibPDF: Add infrastructure for accented character glyphs
Type1 accented character glyphs are composed of two other glyphs in the
same font: a base glyph and an accent glyph, given as char codes in the
standard encoding. These two glyphs are then composed together to form
the accented character.

This commit adds the data structures to hold the information for
accented characters, and also the routine that composes the final glyph
path out of the two individual components. All glyphs must have been
loaded by the time this composition takes place, and thus a new
protected consolidate_glyphs() routine has been added to perform this
calculation.
2023-02-08 19:47:15 +01:00