ladybird/Userland/Libraries/LibGfx
Jelle Raaijmakers 5865cf5864 LibWeb: Use bitmap's alpha type instead of assuming unpremultiplied
When converting a `Gfx::Bitmap` to a Skia bitmap, we cannot assume the
color data is unpremultiplied. For example, everything canvas-related
uses premultiplied color data:

  https://html.spec.whatwg.org/multipage/canvas.html#premultiplied-alpha-and-the-2d-rendering-context

We were probably assuming unpremultiplied since that is what the PNG
decoder gives us. Since we now make `Gfx::Bitmap` identify what alpha
type is being used, we can instruct Skia a bit better :^)

Update our `EdgeFlagPathRasterizer` to use premultiplied alpha instead
of unpremultiplied so we can apply alpha correctly for path masks.

This fixes the dark borders sometimes visible when SVGs are blended
with a colored background.

This also exposed an issue with our `CanvasRenderingContext2D`, which is
supposed to hold a bitmap with premultiplied alpha internally but expose
a bitmap with unpremultiplied alpha in `CanvasImageData`. Expand our C2D
test to include the alpha channel as well.

Finally, this also exposed an off-by-one issue in
`EdgeFlagPathRasterizer` which caused the last scanlines for edges to
render incorrectly. We had some reference images which included these
corruptions (they were almost unnoticeable), so update them as well.
2024-08-07 18:51:12 +02:00
..
Font Everywhere: Remove AK_DONT_REPLACE_STD macro 2024-07-30 18:38:02 -06:00
ICC LibGfx+icc: Prefix AK::FixedPoint with AK Namespace 2024-07-18 09:43:38 +01:00
ImageFormats LibGfx: Mark PNG bitmaps as having unpremultiplied alpha 2024-08-07 18:51:12 +02:00
AffineTransform.cpp
AffineTransform.h
AntiAliasingPainter.cpp
AntiAliasingPainter.h
Bitmap.cpp LibGfx: Store alpha type information in Gfx::Bitmap 2024-08-07 18:51:12 +02:00
Bitmap.h LibGfx: Store alpha type information in Gfx::Bitmap 2024-08-07 18:51:12 +02:00
BoundingBox.h
CIELAB.h
CMakeLists.txt AK+LibGfx: Only generate clang module map if ENABLE_SWIFT 2024-08-07 09:04:09 +02:00
CMYKBitmap.cpp
CMYKBitmap.h
Color.cpp LibGfx: Add an implementation of #rrggbb color parsing in Swift 2024-07-30 18:38:02 -06:00
Color.h LibWeb: Use bitmap's alpha type instead of assuming unpremultiplied 2024-08-07 18:51:12 +02:00
Color.swift LibGfx: Generate clang module map 2024-08-06 18:28:10 -06:00
DeltaE.cpp
DeltaE.h
DisjointRectSet.h
EdgeFlagPathRasterizer.cpp LibWeb: Use bitmap's alpha type instead of assuming unpremultiplied 2024-08-07 18:51:12 +02:00
EdgeFlagPathRasterizer.h LibGfx: Prefix class members with m_ in EdgeTable 2024-08-07 18:51:12 +02:00
FontCascadeList.cpp
FontCascadeList.h
Forward.h
FourCC.h
GradientPainting.cpp LibGfx: Factor out alpha type from GradientPainting 2024-08-07 18:51:12 +02:00
Gradients.h LibGfx+LibWeb: Support CSS gradient "transition hints" in Skia painter 2024-07-10 20:01:04 +03:00
ImmutableBitmap.cpp
ImmutableBitmap.h
Line.h
LineStyle.h
Matrix.h
Matrix3x3.h
Matrix4x4.h
MedianCut.cpp
MedianCut.h
Orientation.h
Painter.cpp LibGfx: Remove code responsible for glyph rasterization 2024-07-27 18:37:40 +01:00
Painter.h LibGfx: Remove code responsible for glyph rasterization 2024-07-27 18:37:40 +01:00
PaintStyle.h
Palette.cpp
Palette.h
Path.cpp Everywhere: Limit layout text fragments to use one font for all glyphs 2024-06-30 19:23:24 +02:00
Path.h
PathClipper.cpp
PathClipper.h
Point.cpp
Point.h
Quad.h
Rect.cpp
Rect.h
ScalingMode.h
ShareableBitmap.cpp LibGfx: Store alpha type information in Gfx::Bitmap 2024-08-07 18:51:12 +02:00
ShareableBitmap.h
Size.cpp
Size.h
StandardCursor.h
SystemTheme.cpp
SystemTheme.h
TextAlignment.h
TextAttributes.h
TextLayout.cpp LibGfx: Do not draw U+FFFD for unknown glyphs 2024-07-05 13:42:07 +02:00
TextLayout.h Everywhere: Limit layout text fragments to use one font for all glyphs 2024-06-30 19:23:24 +02:00
TIFFGenerator.py
Triangle.cpp
Triangle.h
Vector2.h
Vector3.h
Vector4.h
VectorGraphic.cpp
VectorGraphic.h
VectorN.h
WindingRule.h