Commit Graph

45699 Commits

Author SHA1 Message Date
Liav A
71f275b5ad Tests/LibGfx: Add tests for compressed TGA images 2023-01-15 12:43:03 +01:00
Liav A
2f2d808869 LibGfx: Add support for RLE compressed TGA images
RLE is an old technique being used for decades, as is known as
Run-Length-Encoding, which means that for repeating sequence of bytes,
we keep an indicator for the length of the sequence and only one sample
of it, to save storage space.

GIMP can generate lossless-compressed TGA images, with RLE compression
being used. It means that for a compressed image, the data is no longer
arranged in sequence of pixels, but a sequence of pixel packets.
There are two possible pixel packets:
- RLE packets, which are encoded with one byte for indicating the
  run-length and another one pixel (3 bytes for TrueColor pixel), so
  essentially in runtime, the TGA decoder will use the length to plot
  the same pixel in multiple pixels of the output pixel bitmap.
- Raw packets, which are encoded with one byte as indicator for the
  length of the whole pixel sequence and N-length pixel sequence
  afterwards.
  This is not used for any sort of compression by the TGA format, but
  still needed to be supported for full compatibility with TGA images
  that uses the RLE compression.
2023-01-15 12:43:03 +01:00
Liav A
6bf2460231 Tests/LibGfx: Add tests for top-left and bottom-left TGA images 2023-01-15 12:43:03 +01:00
Liav A
a46df41265 LibGfx: Handle tga images with top-left and bottom-left orientation
GIMP allows a user to export a TGA image with either of these possible
orientations, so we can easily support it by looking at the X origin and
Y origin values to determine where to put the pixels in the bitmap.
2023-01-15 12:43:03 +01:00
Tom Needham
761b89c28e Base: Add ImageViewer as the default app to open TGA files :^)
This patch allows .tga files to be opened by ImageViewer automatically
when selected in FileManager
2023-01-15 12:43:03 +01:00
Tom Needham
591bebe662 LibGfx: Add the TGA format into the list of bitmap formats :^) 2023-01-15 12:43:03 +01:00
Tom Needham
5bce58cd3e LibGfx: Plumb the TGALoader into ImageDecoder :^)
This patch plumbs the TGALoader into ImageDecoder
so TGA images can be decoded by the system
2023-01-15 12:43:03 +01:00
Tom Needham
21db070887 LibGfx: Add TGA Loader :^)
This patch adds a basic TGA Loader. Currently it can only handle
uncompressed files with a bit depth of 24 or 32 bits per pixel.
2023-01-15 12:43:03 +01:00
Arda Cinar
70da5f977b hexdump: Add an option to specify dump offset
This is very helpful when trying to make sense of large binary files :^)
2023-01-15 12:10:21 +01:00
Andreas Kling
db27499865 LibWeb: Make sure that fetch() response cookies get saved
We have to provide the Web::Page* in order for cookies to get saved.
2023-01-15 10:53:58 +00:00
Lucas CHOLLET
667ac961b5 Presenter: Use the non-deprecated API of LibFileSystemAccessClient
The patch is tiny as Presenter is only using `LibFSAC` for its file
picker. Using only `LibFSAC` in Presenter would be nice.
2023-01-15 11:37:21 +01:00
nipos
bfacbe1e0d LibCore: Enable file descriptor passing on OpenBSD 2023-01-15 01:11:46 +00:00
Agustin Gianni
4a816ed891 LibC: Fix incorrect limit for SSIZE_MAX and remove 32 bit definitions
The file `limits.h` had definitions for x86. This PR removes these
definitions and fixes the upper limit for the type ssize_t which was
defined to be 0x7fffffff.
2023-01-15 01:07:05 +00:00
Timothy Flynn
bb4c7b6a35 LibJS: Remove now-unused ThrowableFormat header
The one place this was used now uses the fallible String::formatted.
2023-01-15 01:00:20 +00:00
Timothy Flynn
9f78e8728a LibJS: Port (most of) String.prototype to String
The locations that haven't been ported have a much wider footprint than
just the String.prototype files, so they've been left alone for now.
2023-01-15 01:00:20 +00:00
Timothy Flynn
ceaec41726 LibJS: Port Value to-string methods to String 2023-01-15 01:00:20 +00:00
Timothy Flynn
46dd8c1c0b LibJS: Resolve all UTF-8 rope strings as a String 2023-01-15 01:00:20 +00:00
Timothy Flynn
58bc831750 LibUnicode: Return a String from Unicode normalization 2023-01-15 01:00:20 +00:00
Timothy Flynn
c9056b824e LibJS: Define Value::to_string to convert a Value to a String 2023-01-15 01:00:20 +00:00
Timothy Flynn
afeb7273cc LibJS+Everywhere: Rename Value::to_string to to_deprecated_string 2023-01-15 01:00:20 +00:00
Timothy Flynn
8f5bdce8e7 LibJS: Add initial support for creating PrimitiveStrings with AK::String
This will temporarily bloat the size of PrimitiveString as LibJS is
transitioned to use String throughout, but will make doing so piecemeal
much easier.
2023-01-15 01:00:20 +00:00
Timothy Flynn
0b58748156 LibJS: Define number_to_string to convert a double to a String 2023-01-15 01:00:20 +00:00
Timothy Flynn
8a88d4434f LibJS+LibWeb: Rename number_to_string to number_to_deprecated_string 2023-01-15 01:00:20 +00:00
Timothy Flynn
c79d20be58 LibJS: Define Utf16String::to_utf8 to convert Utf16String to String 2023-01-15 01:00:20 +00:00
Timothy Flynn
4eb5eb2080 LibJS: Rename Utf16String::to_utf8 to to_deprecated_string 2023-01-15 01:00:20 +00:00
Timothy Flynn
ca655f5e7d LibJS: Rename VM::string_cache to deprecated_string_cache
And rename the member variable from m_string_cache to
m_deprecated_string_cache to match.
2023-01-15 01:00:20 +00:00
Timothy Flynn
3a004e8f1a LibJS: Rename PrimitiveString::has_utf8_string to has_deprecated_string
And rename the member variable from m_utf8_string to m_deprecated_string
to match.
2023-01-15 01:00:20 +00:00
Timothy Flynn
79e81e8a15 LibJS: Add ThrowableStringBuilder::to_string to create a new String
This wraps around the base class method to throw an OOM completion.
2023-01-15 01:00:20 +00:00
Timothy Flynn
3ad1f250e7 LibCrypto: Define *BigInteger::to_base to convert big integers to String 2023-01-15 01:00:20 +00:00
Timothy Flynn
0ddc2e1f50 LibCrypto+Everywhere: Rename *BigInteger::to_base to to_base_deprecated 2023-01-15 01:00:20 +00:00
Timothy Flynn
63c814fa2f AK: Add String::to_number 2023-01-15 01:00:20 +00:00
Timothy Flynn
cf0899f440 AK: Add String::contains 2023-01-15 01:00:20 +00:00
Timothy Flynn
bd9b65e82f AK: Add String::is_one_of for variadic string comparison 2023-01-15 01:00:20 +00:00
Timothy Flynn
9db9b2f9be AK: Add a somewhat naive implementation of String::reverse
This will reverse the String's code points (i.e. not just its bytes),
but is not aware of grapheme clusters.
2023-01-15 01:00:20 +00:00
Andrew Kaster
f5d253dcfa Everywhere: Fully qualify IsLvalueReference in TRY() macros
If USING_AK_GLOBALLY is not defined, the name IsLvalueReference might
not be available in the global namespace. Follow the pattern established
in LibTest to fully qualify AK types in macros to avoid this problem.
2023-01-15 00:56:31 +00:00
Lucas CHOLLET
56512caa73 LibCore: Don't reject an empty buffer with ENOBUFS
Instead, we just return the empty buffer.
2023-01-14 16:20:30 -07:00
Lucas CHOLLET
4402720a15 LibCore: Don't rely on \n detection to populate the buffer
We don't need to call `can_read_line()` as the buffer will be populated
by `find_and_populate_until_any_of()`. The change is also beneficial as
the buffer will be populated until a candidate is found and not
necessarily a new line.
2023-01-14 16:20:30 -07:00
Lucas CHOLLET
8252436c18 LibCore: Resume search in find_and_populate_until_any_of
The search used to go through the buffer from the start, even if we just
appended a small number of bytes at the end. It now remembers the last
stop and resume the search from it.
2023-01-14 16:20:30 -07:00
Lucas CHOLLET
b21ea54af0 LibCore: Merge two search implementations in Stream::BufferedStream
`can_read_line()` and `read_until_any_of` used to have two different
implementations to search for a needle. This commit factorizes both
algorithms.
2023-01-14 16:20:30 -07:00
Lucas CHOLLET
9a7accddb7 AK: Add an optional starting offset to CircularBuffer::offset_of
This parameter allows to start searching after an offset. For example,
to resume a search.

It is unfortunately a breaking change in API so this patch also modifies
one user and one test.
2023-01-14 16:20:30 -07:00
Lucas CHOLLET
34922c0cc0 AK: Default move operators for CircularBuffer
The previously defined operator was swap-based. With the defaulted
implementation, both integers are now copied, but it doesn't matter as
only the `ByteBuffer` allocates memory (i.e. non-null integers values
won't affect the destruction).
2023-01-14 16:15:31 -07:00
Ben Wiederhake
23d111a459 LibWeb: Implement value_id_from_string by hash lookup
The old approach was basically a linear scan, which is slower than a
hash map for the currently 303 elements, as evidenced by the new
benchmark in TestCSSIDSpeed.

Before: Completed benchmark 'value_id_from_string' in 3238ms
After: Completed benchmark 'value_id_from_string' in 193ms
2023-01-14 15:43:27 -07:00
Ben Wiederhake
b3d2fdceb1 LibWeb+Tests: Demonstrate slowness of CSS::value_id_from_string 2023-01-14 15:43:27 -07:00
Ben Wiederhake
0687a75eaa LibWeb: Run tests in lagom if ENABLE_LAGOM_LIBWEB is set 2023-01-14 15:43:27 -07:00
Ben Wiederhake
79b9dd6248 AK+Tests: Make CaseInsensitiveStringViewTraits work with HashMap again 2023-01-14 15:43:27 -07:00
Timothy Flynn
822e32eb11 LibJS: Reword and reorder some steps of the Intl ResolveLocale AO
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/4c55823
2023-01-14 19:12:48 +00:00
Timothy Flynn
0ff4d8100f LibJS: Consistently use spaces / parentheses in NumberFormat operations
These are editorial changes in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/1508825
https://github.com/tc39/ecma402/commit/760f23a
2023-01-14 19:12:48 +00:00
Timothy Flynn
0ffad2a2d1 LibJS: Refer to String elements as code units rather than characters
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/d6b3435
2023-01-14 19:12:48 +00:00
Timothy Flynn
95cef87a9c LibJS: Update syntax for invoking the GetOption AO from Intl objects
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/0ac2e10
2023-01-14 19:12:48 +00:00
Timothy Flynn
2cca5d6676 LibJS: Fix assignment of "isNegative" in FormatNumericToString
These are normative changes in the Intl.NumberFormat v3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/5a2b1d1
https://github.com/tc39/proposal-intl-numberformat-v3/commit/cd48a3d
2023-01-14 19:12:48 +00:00