Andreas Kling
47edd6ae89
LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers
...
There are no more clients of these APIs, now that everyone has been made
to use ImageDecoderPlugin objects instead.
2021-11-13 00:55:07 +01:00
Timothy Flynn
7cc50d614c
LibGfx: Include Vector.h in PNGLoader.cpp
...
This was being transitively included from Deflate.h on SerenityOS builds
but not on Lagom builds.
2021-11-11 12:46:48 +00:00
Andreas Kling
2bd0ef0c76
LibGfx: Remove now-unused load_gif_from_memory()
2021-11-11 11:45:32 +01:00
Andreas Kling
880fafd2c5
LibGfx: Use ImageDecoder in Bitmap::try_load_from_fd_and_close()
...
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.
2021-11-11 11:43:08 +01:00
Andreas Kling
10add3f4c2
LibGfx: Remove load_FORMAT() image codec wrappers
...
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.
2021-11-11 11:32:22 +01:00
Andreas Kling
80d4e830a0
Everywhere: Pass AK::ReadonlyBytes by value
2021-11-11 01:27:46 +01:00
Andreas Kling
8b1108e485
Everywhere: Pass AK::StringView by value
2021-11-11 01:27:46 +01:00
Andreas Kling
a15ed8743d
AK: Make ByteBuffer::try_* functions return ErrorOr<void>
...
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.
2021-11-10 21:58:58 +01:00
Andreas Kling
5f7d008791
AK+Everywhere: Stop including Vector.h from StringView.h
...
Preparation for using Error.h from Vector.h. This required moving some
things out of line.
2021-11-10 21:58:58 +01:00
Andreas Kling
a7f1f1c34b
LibCore: Use ErrorOr<T> for Core::File::open()
2021-11-08 00:35:27 +01:00
Andreas Kling
0f5477c721
AK: Use ErrorOr<T> for MappedFile factories
...
Replace Result<T, E> with ErrorOr<T> and propagate the error to callers.
2021-11-08 00:35:27 +01:00
Andreas Kling
6e255b262f
LibGfx: Use ErrorOr<T> for try_create_from_serialized_byte_buffer()
2021-11-08 00:35:27 +01:00
Andreas Kling
0de33b3d6c
LibGfx: Use ErrorOr<T> for Bitmap::try_create()
...
Another one that was used in a fajillion places.
2021-11-08 00:35:27 +01:00
Andreas Kling
235f39e449
LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
...
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-08 00:35:27 +01:00
Andreas Kling
16f064d9be
LibGfx: Convert Gfx::Bitmap to east const style
2021-11-08 00:35:27 +01:00
Andreas Kling
d85d741c59
LibGfx: Deduplicate code in Bitmap::try_load_from_file()
...
This can share logic with try_load_from_fd_and_close(), we just need to
open the file first. :^)
2021-11-08 00:35:27 +01:00
Andreas Kling
09cba7c780
LibGfx: Use ErrorOr<T> for Bitmap infrastructure used by ShareableBitmap
...
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.
2021-11-08 00:35:27 +01:00
Andreas Kling
8262bbf624
LibGfx: Use ErrorOr<T> for Bitmap::cropped()
2021-11-08 00:35:27 +01:00
Andreas Kling
5e41c70e83
LibGfx: Use ErrorOr<T> for Bitmap::scaled()
2021-11-08 00:35:27 +01:00
Andreas Kling
db90b4554e
LibGfx: Use ErrorOr<T> for Bitmap::flipped()
2021-11-08 00:35:27 +01:00
Andreas Kling
69c4614a94
LibGfx: Use ErrorOr<T> for Bitmap::rotated()
2021-11-08 00:35:27 +01:00
Andreas Kling
2da4cfcc80
LibGfx: Use ErrorOr<T> for Bitmap::clone()
2021-11-08 00:35:27 +01:00
Andreas Kling
c417820bff
LibGfx: Use ErrorOr<T> for Bitmap::try_create_shareable()
2021-11-08 00:35:27 +01:00
Andreas Kling
83d1460ee8
LibGfx: Use ErrorOr<T> for Bitmap::try_create_wrapper()
2021-11-08 00:35:27 +01:00
Andreas Kling
f23f99d51b
LibGfx: Use ErrorOr<T> for Bitmap::try_create_with_anonymous_buffer()
2021-11-08 00:35:27 +01:00
Andreas Kling
e5dde37e24
AK: Bring AK::Error into the global namespace
2021-11-08 00:35:27 +01:00
Andreas Kling
af562c857e
LibGfx: Use ErrorOr<T> for Gfx::Bitmap::allocate_backing_store()
2021-11-08 00:35:27 +01:00
Andreas Kling
e2eabb4132
LibCore: Use ErrorOr<T> in Core::AnonymousBuffer
2021-11-08 00:35:27 +01:00
Sam Atkins
f22043a225
LibGfx: Add FlagRole to GUI::Variant
2021-11-05 23:34:22 +01:00
Sam Atkins
d68268f791
LibGfx: Use read_bool_entry()
to read theme flags
...
I didn't notice this function existed the first time around. Oops!
2021-11-05 23:34:22 +01:00
Sam Atkins
4f42e4ba90
LibGfx: Add 'IsDark' flag to SystemTheme and Palette
...
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.
2021-10-31 18:39:13 +01:00
Sam Atkins
31ce4d04b6
LibGfx: Add to_string() functions for MetricRole and PathRole
2021-10-28 11:23:44 +02:00
Sam Atkins
885ca2f968
LibGfx+WindowServer: Move shadow-painting code to StylePainter
...
Specifically, this is to make it accessible to ThemeEditor, but there's
nothing about it that is especially window-specific.
2021-10-28 11:23:44 +02:00
Sam Atkins
cf188df86c
LibGfx: Make style painters use east const and virtual specifiers
2021-10-28 11:23:44 +02:00
Sam Atkins
094dc04695
LibGfx: Make Color::from_string() case-insensitive
...
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.
2021-10-24 22:12:35 +02:00
Sam Atkins
639c913e58
LibGfx: Make Color use east-const
2021-10-24 22:12:35 +02:00
Sam Atkins
21b65de1ec
LibGfx+LibWeb: Move "transparent" keyword into Color::from_string()
...
It seemed odd to have this one color handled separately, when
`Color::from_string()` implements all other CSS colors.
2021-10-23 18:53:17 +02:00
Ben Wiederhake
1bc4a0d822
LibGfx: Restrict cleared area to GIF framebuffer
...
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.
2021-10-22 20:37:27 +01:00
Ben Wiederhake
ee18912373
LibGfx: Implement copy-assign for Matrix
...
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.
2021-10-10 21:03:27 +01:00
Nico Weber
b8dc3661ac
Libraries: Fix -Wunreachable-code warnings from clang
2021-10-08 23:33:46 +02:00
Ben Wiederhake
9d2e06b039
LibGUI: Add missing headers
2021-10-06 23:52:40 +01:00
Tim Schumacher
7af7fc8c16
Everywhere: Fix more Copyright header inconsistencies
2021-10-04 11:10:09 +01:00
Gal Horowitz
aa180c821d
LibGFX: Draw the ends of lines with non-standard thickness
...
Lines are drawn using squares the size of the thickness, so if the
length of the line was not a multiple of the thickness, the end of the
line was not drawn correctly.
2021-10-02 20:54:47 +02:00
Nico Weber
de72332920
Libraries: Fix typos
2021-10-01 01:06:40 +01:00
Andreas Kling
73fe6c541a
LibGfx: Forward declare Gfx::FontMetrics as a struct
2021-09-24 19:03:46 +02:00
Andreas Kling
30979c1956
LibGfx: Remove debug spam about not having some font installed
2021-09-24 15:01:49 +02:00
Andreas Kling
d7586aff53
LibGfx: Add a simple Gfx::FontMetrics and Gfx::Font::metrics(code_point)
...
This is used to get a handy set of glyph metrics.
2021-09-24 15:01:49 +02:00
thankyouverycool
84ce923850
LibGfx: Make BitmapFont::variant() report a complete typeface
2021-09-24 14:59:39 +02:00
thankyouverycool
39484fc02c
LibGfx: Get weight from tables for TrueTypeFonts
...
First, try to find detailed weight metrics in the OS/2 table;
barring that, fall back to the font header table.
2021-09-24 14:59:39 +02:00
thankyouverycool
fff89ad769
LibGfx: Support italic BitmapFonts
...
BitmapFont header now contains a slope byte. Slope is used to
indicate slant style and is mapped in LibGfx/FontStyleMapping.h
2021-09-24 14:59:39 +02:00