1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 09:57:35 +00:00
serenity/Userland/Libraries/LibGfx
Karol Kosek c3256a51cb LibGfx: Remove scale factor option from try_load_from_fd_and_close()
... 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
2021-11-16 01:07:37 +00:00
..
Filters AK+Everywhere: Stop including Vector.h from StringView.h 2021-11-10 21:58:58 +01:00
TrueTypeFont Everywhere: Pass AK::ReadonlyBytes by value 2021-11-11 01:27:46 +01:00
AffineTransform.cpp Everywhere: Don't promote float to double where not needed 2021-07-08 10:11:00 +02:00
AffineTransform.h LibGfx: Add some helper methods to AffineTransform 2021-05-02 22:48:06 +02:00
AntiAliasingPainter.cpp LibGfx: Implement cubic bezier curves by splitting them to subcurves 2021-09-18 02:12:38 +04:30
AntiAliasingPainter.h LibGfx: Implement cubic bezier curves by splitting them to subcurves 2021-09-18 02:12:38 +04:30
Bitmap.cpp LibGfx: Remove scale factor option from try_load_from_fd_and_close() 2021-11-16 01:07:37 +00:00
Bitmap.h LibGfx: Remove scale factor option from try_load_from_fd_and_close() 2021-11-16 01:07:37 +00:00
BitmapFont.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
BitmapFont.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
BMPLoader.cpp LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
BMPLoader.h LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
BMPWriter.cpp AK: Make ByteBuffer::try_* functions return ErrorOr<void> 2021-11-10 21:58:58 +01:00
BMPWriter.h LibGfx/BMPWriter: Add support for V3 & V4 DIB headers 2021-07-05 00:43:00 +02:00
CharacterBitmap.cpp AK: Rename adopt() to adopt_ref() 2021-04-23 16:46:57 +02:00
CharacterBitmap.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ClassicStylePainter.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
ClassicStylePainter.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
ClassicWindowTheme.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
ClassicWindowTheme.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
CMakeLists.txt LibGfx: Start a very basic anti-aliased Painter implementation 2021-09-18 02:12:38 +04:30
Color.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Color.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
CursorParams.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
CursorParams.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
DDSLoader.cpp LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
DDSLoader.h LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
DisjointRectSet.cpp LibGfx: Unify Rect, Point, and Size 2021-05-02 22:48:06 +02:00
DisjointRectSet.h WindowServer: Add basic virtual desktop support 2021-07-03 12:27:23 +02:00
Emoji.cpp LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file() 2021-11-08 00:35:27 +01:00
Emoji.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
FillPathImplementation.h LibWeb: Use Gfx::AntiAliasingPainter to draw SVG paths 2021-09-18 02:12:38 +04:30
Font.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
FontDatabase.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
FontDatabase.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
FontStyleMapping.h LibGUI: Add missing headers 2021-10-06 23:52:40 +01:00
Forward.h LibGfx: Forward declare Gfx::FontMetrics as a struct 2021-09-24 19:03:46 +02:00
Gamma.h LibGfx: Remove ancient unused NO_FPU macros 2021-08-18 11:35:51 +02:00
GIFLoader.cpp LibGfx: Remove now-unused load_gif_from_memory() 2021-11-11 11:45:32 +01:00
GIFLoader.h LibGfx: Remove now-unused load_gif_from_memory() 2021-11-11 11:45:32 +01:00
ICOLoader.cpp LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
ICOLoader.h LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
ImageDecoder.cpp LibGfx: Remove Gfx::ImageDecoder::bitmap() in favor of frame(index) 2021-07-27 01:29:50 +02:00
ImageDecoder.h LibGfx: Remove Gfx::ImageDecoder::bitmap() in favor of frame(index) 2021-07-27 01:29:50 +02:00
JPGLoader.cpp LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
JPGLoader.h LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
Line.h LibGUI: Add missing headers 2021-10-06 23:52:40 +01:00
Matrix.h LibGfx: Implement copy-assign for Matrix 2021-10-10 21:03:27 +01:00
Matrix4x4.h Everywhere: Use AK/Math.h if applicable 2021-07-19 16:34:21 +04:30
Orientation.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Painter.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Painter.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Palette.cpp LibCore: Use ErrorOr<T> in Core::AnonymousBuffer 2021-11-08 00:35:27 +01:00
Palette.h LibGfx: Add 'IsDark' flag to SystemTheme and Palette 2021-10-31 18:39:13 +01:00
Path.cpp LibGfx: Implement cubic bezier curves by splitting them to subcurves 2021-09-18 02:12:38 +04:30
Path.h LibGfx: Implement cubic bezier curves by splitting them to subcurves 2021-09-18 02:12:38 +04:30
PBMLoader.cpp LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
PBMLoader.h LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
PGMLoader.cpp LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
PGMLoader.h LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
PNGLoader.cpp LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
PNGLoader.h LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
PNGWriter.cpp Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
PNGWriter.h LibGfx: Store the size of the chunk from start in PNGWriter 2021-07-14 13:37:18 +02:00
Point.cpp LibGfx+PixelPaint: Add Point::end_point_for_aspect_ratio method 2021-09-17 11:54:13 +02:00
Point.h LibGfx: Add Point<T>::to_rounded<U>() 2021-09-18 12:21:42 +02:00
PortableImageLoaderCommon.h LibGfx: Remove load_FORMAT() image codec wrappers 2021-11-11 11:32:22 +01:00
PPMLoader.cpp LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
PPMLoader.h LibGfx: Remove all load_FORMAT_from_memory() decoder wrappers 2021-11-13 00:55:07 +01:00
Rect.cpp LibGfx: Add a Line class and a Rect<T>::RelativeLocation class 2021-06-20 14:57:26 +02:00
Rect.h LibGfx: Add rounded_int_rect() function for Rects 2021-09-21 16:53:46 +02:00
ShareableBitmap.cpp LibGfx: Use ErrorOr<T> for Bitmap infrastructure used by ShareableBitmap 2021-11-08 00:35:27 +01:00
ShareableBitmap.h LibGfx: Use ErrorOr<T> for Bitmap infrastructure used by ShareableBitmap 2021-11-08 00:35:27 +01:00
Size.cpp LibGfx: Add a bunch of [[nodiscard]] to Size 2021-06-16 21:53:10 +02:00
Size.h LibGfx: Add a bunch of [[nodiscard]] to Size 2021-06-16 21:53:10 +02:00
StandardCursor.h Cursors: Add new Magnifying glass cursor 2021-09-04 03:35:23 +02:00
Streamer.h Everywhere: Fix more Copyright header inconsistencies 2021-10-04 11:10:09 +01:00
StylePainter.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
StylePainter.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
SystemTheme.cpp LibCore: Use ErrorOr<T> in Core::AnonymousBuffer 2021-11-08 00:35:27 +01:00
SystemTheme.h LibGfx: Add FlagRole to GUI::Variant 2021-11-05 23:34:22 +01:00
TextAlignment.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
TextAttributes.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
TextDirection.cpp Everywhere: Fix a bunch of typos 2021-05-17 17:48:55 +01:00
TextDirection.h LibGUI: Add missing headers 2021-10-06 23:52:40 +01:00
TextElision.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
TextLayout.cpp LibGfx: Take the glyph spacing into account when building a line 2021-07-27 23:47:00 +02:00
TextLayout.h Userland: Move text wrapping/elision into the new TextLayout :^) 2021-07-26 21:14:39 +04:30
TextWrapping.h Userland: Move text wrapping/elision into the new TextLayout :^) 2021-07-26 21:14:39 +04:30
Triangle.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Triangle.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Typeface.cpp LibGfx: Use move to avoid unnecessary ref/unref of network device RefPtr 2021-09-16 17:17:13 +02:00
Typeface.h LibGfx: Mark Typeface::get_font() const, because it is const 2021-08-18 10:32:32 +02:00
Vector2.h Everywhere: Use AK/Math.h if applicable 2021-07-19 16:34:21 +04:30
Vector3.h Everywhere: Use AK/Math.h if applicable 2021-07-19 16:34:21 +04:30
Vector4.h Everywhere: Use AK/Math.h if applicable 2021-07-19 16:34:21 +04:30
WindowTheme.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
WindowTheme.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00