Age | Commit message (Collapse) | Author |
|
This allows us to use TRY() in decoding helpers, leading to a nice
reduction in line count.
|
|
Now indexes by total bytes per glyph to account for changes made
to row's pointer type in 3ca00c8. Fixes glyphs not showing and
saving correctly in FontEditor.
|
|
|
|
MappedFile is strictly a userspace thing, so it doesn't belong in AK
(which is supposed to be user/kernel agnostic.)
|
|
|
|
|
|
|
|
This is a first step towards better error propagation from image codecs.
|
|
To encourage proper support for multi-frame images throughout the
system, get rid of the single-frame convenience bitmap() API.
|
|
This isn't a complete conversion to ErrorOr<void>, but a good chunk.
The end goal here is to propagate buffer allocation failures to the
caller, and allow the use of TRY() with formatting functions.
|
|
... and bring it back to try_load_from_file().
Prior to this change, changing the scaling option to x2 in the Display
Settings resulted in the following crash:
WindowServer(15:15): ASSERTION FAILED: bitmap->width() % scale_factor
== 0 ./Userland/Libraries/LibGfx/Bitmap.cpp:126
That was caused by two minor overlooked yaks:
- First, Bitmap::try_load_from_fd_and_close() tried to respect your
scale factor.
While requesting a bitmap from file can make a switcheroo to give you
a higher resolution bitmap, doing the same when you already have an fd
might violate the unveil agreement.
... but, it didn't do that.
It read bitmaps from requested fds, but also pretended all system
bitmaps in /res/ are the HiDPI ones when you enabled that mode.
- d85d741c59 used this function to deduplicate try_load_from_file().
It actually made this bug a lot easier to replicate!
Closes #10920
|
|
There are no more clients of these APIs, now that everyone has been made
to use ImageDecoderPlugin objects instead.
|
|
This was being transitively included from Deflate.h on SerenityOS builds
but not on Lagom builds.
|
|
|
|
Before this patch, both Bitmap and ImageDecoder had logic for guessing
which image codec to use for a chunk of data. Bitmap now defers to
ImageDecoder so that we only have to do this in one place.
There's room for improvement in the ImageDecoder heuristic, but that's
outside the scope of this change.
|
|
We had a bunch of old unused wrapper functions for each image codec that
would load a supported image with a given path. Nobody actually used
them, so let's just get rid of load_png(), load_gif(), etc.
|
|
|
|
|
|
Same as Vector, ByteBuffer now also signals allocation failure by
returning an ENOMEM Error instead of a bool, allowing us to use the
TRY() and MUST() patterns.
|
|
Preparation for using Error.h from Vector.h. This required moving some
things out of line.
|
|
|
|
Replace Result<T, E> with ErrorOr<T> and propagate the error to callers.
|
|
|
|
Another one that was used in a fajillion places.
|
|
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
|
|
|
|
This can share logic with try_load_from_fd_and_close(), we just need to
open the file first. :^)
|
|
This also allows us to get rid of the ShareableBitmap(Bitmap)
constructor which was easy to misuse. Everyone now uses Bitmap's
to_shareable_bitmap() helper instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I didn't notice this function existed the first time around. Oops!
|
|
This explicitly states whether a given theme is a dark theme, so that
applications not using the system palette colors can still attempt to
match the overall theme.
|
|
|
|
Specifically, this is to make it accessible to ThemeEditor, but there's
nothing about it that is especially window-specific.
|
|
|
|
This function implements CSS color syntax, which is case-insensitive in
HTML contexts. Making it insensitive here means not having to remember
to do it in every user, (many of the HTML elements do not do this,) and
means they don't have to produce a lowercase copy of the input string
before passing it.
|
|
|
|
It seemed odd to have this one color handled separately, when
`Color::from_string()` implements all other CSS colors.
|
|
Found by OSS Fuzz, long-standing issue
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34824
The discovered testcase attempts to clear the framebuffer of size
1056x32 from the previous image, which has size 16416x32.
|
|
This used to generate a warning about using a deprecated copy-assign,
default-generated by the compiler, and deprecated because we hand-
implement the copy-constructor. This warning is correct, since the
default-generated copy-assign may or may not be as efficient as memcpy.
This patch gets rid of the warning, and has either no performance impact
or a slightly positive one. If this turns out to be wrong, we should
probably also fix the copy-constructor.
|