Commit graph

47472 commits

Author SHA1 Message Date
Luke Wilde 57cc2bab4b Ports: Add Mednafen 2023-02-28 08:42:45 +00:00
Tim Ledbetter 3112a6b44f PixelPaint: Fix clicking on the layer menu with no image loaded
Previously, clicking on the layer menu with no image loaded would
cause a crash.
2023-02-28 08:37:10 +00:00
Tim Ledbetter ef54a3c0d2 PixelPaint: Disable levels dialog action when no image is loaded
Previously, clicking on the levels dialog with no image loaded would
cause a crash.
2023-02-28 08:37:10 +00:00
Lucas CHOLLET a139c77c71 LibGfx: Bubble up allocation failure instead of panicking 2023-02-28 08:33:01 +00:00
Luke Wilde fc538bc00b LibJS: Add [[nodiscard]] to ThrowCompletionOr<void> 2023-02-27 23:57:08 +00:00
Luke Wilde 8f4bec2b4a LibJS: Add missing TRY in StringIteratorPrototype::next 2023-02-27 23:57:08 +00:00
Luke Wilde 53852452b2 LibJS: Propagate errors from Intrinsics initialization 2023-02-27 23:57:08 +00:00
Luke Wilde af118f2a67 LibJS: Add missing error propagation to global object initializations 2023-02-27 23:57:08 +00:00
Luke Wilde fb7aaeff3e LibJS/Bytecode: Return ThrowCompletionOr<void> from CreateVariable op 2023-02-27 23:57:08 +00:00
Luke Wilde f4be95af69 LibJS: Don't discard ThrowCompletionOr<void> from declaration iteration 2023-02-27 23:57:08 +00:00
Luke Wilde a964ebc255 LibWeb: Implement Path2D#addPath
Required by Ruffle.
2023-02-27 20:55:09 +01:00
Luke Wilde 1f97adbee8 LibGfx: Add a function that adds two paths together
This will be used by Path2D#addPath in LibWeb.
2023-02-27 20:55:09 +01:00
Luke Wilde a90667e79c LibWeb: Add initial implementation of DOMMatrix(ReadOnly)
This is currently missing a lot of functions and initialisation from a
<transform-list> string, but is enough for Ruffle.
2023-02-27 20:55:09 +01:00
Luke Wilde e3a9ed0c26 LibWeb: Make [UseNewAKString] work for enums and stringifiers 2023-02-27 20:55:09 +01:00
Luke Wilde dec09333a3 LibGfx: Add method to Matrix that determines if the matrix is invertible 2023-02-27 20:55:09 +01:00
Luke Wilde fcd3b16d63 LibWeb: Visit CallbackType's stored EnvironmentSettingsObject reference 2023-02-27 20:49:00 +01:00
Tim Schumacher 8331d7cd82 LibAudio: Use the proper functions to read WAV samples
Turns out that, if we don't use functions that ensure reading until the
very end of the buffer, we only end up getting the very beginning of
samples and fill the rest with uninitialized data.

While at it, make sure that we read the data that is little endian as a
LittleEndian.
2023-02-27 18:28:12 +01:00
Timothy Flynn 4edd8e8c5e LibGUI: Ensure the "End" key sets the cursor to the visual line end
We are currently setting the physical mouse position to the visual
cursor content location. In a line containing only a multi-code point
emoji, this would set the cursor to column 1 rather than however many
code points there are.
2023-02-27 09:36:37 -05:00
Nico Weber a81e1a8c4f file: Use StringView instead of DeprecatedString for paths 2023-02-27 15:18:55 +01:00
Nico Weber 4193e53f62 file: Use StringView instead of DeprecatedString for description 2023-02-27 15:18:55 +01:00
Nico Weber f989d2bb1f file: Use StringView instead of DeprecatedString for mime types 2023-02-27 15:18:55 +01:00
Nico Weber 9f5343e29e file: Remove unnecessary DeprecatedString ctor call
path is already a DeprecatedString.
2023-02-27 15:18:55 +01:00
Patryk Pilipczuk b87b1472e1 HexEditor: Add BE decoding for UTF16String column in ValueInspector 2023-02-27 13:39:40 +01:00
Lucas CHOLLET 8c1a409263 Tests: Add a test for SOF0 images with several scans
This type of image isn't common, and you can probably only find one by
generating it yourself. It can be done using `cjpeg` with the -scan
argument.

This image has been generated with the following scan file:
0: 0 63 0 0;
1: 0 63 0 0;
2: 0 63 0 0;
2023-02-27 13:39:22 +01:00
Lucas CHOLLET a40c7354c1 Tests: Rename "test_jpg" to "test_jpeg_sof0_one_scan" 2023-02-27 13:39:22 +01:00
Lucas CHOLLET f70a7b763f LibGfx: Don't return after the first scan
Finally, it brings support for SOF0 images with several scans.
2023-02-27 13:39:22 +01:00
Lucas CHOLLET 2c98eff558 LibGfx: Consider component interleaving when reading a scan
Scan with only one component are by definition not interleaved, meaning
that each value is linearly ordered in the stream. Grayscale images
were supported thanks to a hack, by forcing the subsampling to 1.

Now we properly support grayscale image with other subsampling (even if
it doesn't make sense) and more generally scans with only one component
and any sampling factors.

While this solution is more general than the last one it also feels a
bit hackish. We should probably refactor the way we iterate over
components and macroblocks. But that's work for latter, especially when
we will add support for other subsampling than 4-2-2.
2023-02-27 13:39:22 +01:00
Lucas CHOLLET 893659c6aa LibGfx: Move HuffmanStream from the context to the Scan object
Huffman streams are encountered in the scan segment. They have nothing
to do outside this segment, hence they shouldn't outlive the scan.

Please note that this patch changes behavior. The stream is now reset
after each scan.
2023-02-27 13:39:22 +01:00
Lucas CHOLLET ae124c19ef LibGfx: Don't assume that a scan include all components for the image
A scan can contain fewer components that the full image. However, if
there is multiple components, they have to follow the ordering of the
frame header. It means that we can loop over components of the image
and skip those that doesn't correspond.
2023-02-27 13:39:22 +01:00
Lucas CHOLLET 947698f29f LibGfx: Consider EOI as a supported marker
For now, we exit after the first scan without needing to parse `EOI`.
However, to read scans in a loop we will need to properly detect and
parse `EOI`.
2023-02-27 13:39:22 +01:00
Lucas CHOLLET 698605444b LibGfx: Remove restrictive checks
These checks are only valid for mono-scan SOF0 images, with tables
defined before the start of frame segment.
2023-02-27 13:39:22 +01:00
Lucas CHOLLET d3231ca323 LibGfx: Log spectral information 2023-02-27 13:39:22 +01:00
Lucas CHOLLET 3719f94c63 LibGfx: Log image dimensions only once 2023-02-27 13:39:22 +01:00
Lucas CHOLLET f98668f8b2 LibGfx: Only iterate components of the current scan
A scan can have fewer components than what the final image contains.
2023-02-27 13:39:22 +01:00
Lucas CHOLLET 9fa375b844 LibGfx: Differentiate scan-level and frame-level data for components
This patch brings us closer to the spec point of view. And while it
makes no functional changes, it reduces the number of places where you
can misuse scan-specific data and improve support for multiple scans.
2023-02-27 13:39:22 +01:00
Lucas CHOLLET 508ae37c6e LibGfx: Move scan-related information to its own struct
Putting them directly in the context isn't good for neither readability,
comprehension nor spec compliance.
2023-02-27 13:39:22 +01:00
Tim Ledbetter cc4184cb47 LibGUI: Don't show non-visible actions in CommandPalette 2023-02-27 13:37:24 +01:00
Nico Weber 5d5f9f52a0 Utilities: Make file print more information for animated images 2023-02-27 13:29:57 +01:00
Nico Weber a83f4ec186 WebServer: Remove a call to String::from_deprecated_string
guess_mime_type_based_on_filename() returns a StringView, so no
need to bring DeprecatedString's (implicit) ctor into this.

No behavior change.
2023-02-26 21:01:58 -05:00
Hendiadyoin1 8e5ebb04f4 LibJS: Use a pseudo top-level UnwindFrame in GenerateCFG
Previously we assumed that there is always one such frame, now there is.
2023-02-26 23:09:37 +01:00
kleines Filmröllchen bd1cecb991 Meta: Lower QEMU DirectSound driver timer period to 2ms
10ms (the default) is ridiculous and causes all kinds of glitches if we
actually want to have a low-latency queue.
<https://gitlab.com/qemu-project/qemu/-/issues/1076#note_996636777>
suggests 2ms (and no lower than 1ms). This improves audio glitch
resistance at our current 512 sample buffer size, but going lower is
still not possible.
2023-02-26 22:27:42 +01:00
MacDue 6cf8eeb7a4 LibGfx: Return bool not ErrorOr<bool> from ImageDecoderPlugin::sniff()
Nobody made use of the ErrorOr return value and it just added more
chance of confusion, since it was not clear if failing to sniff an
image should return an error or false. The answer was false, if you
returned Error you'd crash the ImageDecoder.
2023-02-26 19:43:17 +01:00
MacDue 8d9cb538d6 LibGfx: Don't return an error for webp sniff failures
The correct thing to do here is return false, returing an error
crashes the ImageDecoder.
2023-02-26 19:43:17 +01:00
Hendiadyoin1 c696654294 LibJS: Add a missing include to FunctionKind.h 2023-02-26 19:40:09 +01:00
Hendiadyoin1 4c2b4c1a27 LibJS: Overhaul AsyncFunctionDriverWrapper to make it actually work
This object is responsible for handling async functions in bytecode,
and this commit fully rewrites it, now it does:
* creates and keeps alive a top level promise, which callers can attach
  their `then` clauses
* creates and clear a handle to itself, to assure that it does not get
  garbage collected
* properly handles all possible ways a async function could halt and
  when possible continues the execution immediately
2023-02-26 19:40:09 +01:00
Hendiadyoin1 de514f29ad LibJS: Align codegen AwaitExpressions to YieldExpressions
We use generators in bytecode to approximate async functions, but the
code generated by AwaitExpressions did not have the value processing
paths that Yield requires, eg the `generator.throw()` path, which is
used by AsyncFunctionDriverWrapper to signal Promise rejections.
2023-02-26 19:40:09 +01:00
Hendiadyoin1 1f6a0ef6e0 LibJS: Don't enter finally blocks upon yield in bytecode mode 2023-02-26 19:40:09 +01:00
Hendiadyoin1 088dc1b24b LibJS: Simplify Generator::perform_needed_unwinds
This does not need to cater to the needs of `break` and `continue
anymore, which allows us to simplify it a bit.
2023-02-26 19:40:09 +01:00
Hendiadyoin1 d65488b80c LibJS: Generate unwind chains for continue in Bytecode
This works similar to `break`
The `try-finally-continue` still do not pass with this, likely because
of binding issues.
2023-02-26 19:40:09 +01:00
Hendiadyoin1 f5376cb282 LibJS: Generate unwind chains for break in Bytecode
This uses a newly added instruction `ScheduleJump`
This instruction tells the finally proceeding it, that instead of
jumping to it's next block it should jump to the designated block.
2023-02-26 19:40:09 +01:00