mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-22 16:09:23 +00:00
When decoding data into bitmaps, we end up with different alpha types (premultiplied vs. unpremultiplied color data). Unfortunately, Skia only seems to handle premultiplied color data well when scaling bitmaps with an alpha channel. This might be due to Skia historically only supporting premultiplied color blending, with unpremultiplied support having been added more recently. When using Skia to blend bitmaps, we need the color data to be premultiplied. ImmutableBitmap gains a new method to enforce the alpha type to be used, which is now used by SharedResourceRequest and CanvasRenderingContext2D to enforce the right alpha type. Our LibWeb tests actually had a couple of screenshot tests that exposed the graphical glitches caused by Skia; see the big smiley faces in the CSS backgrounds tests for example. The failing tests are now updated to accommodate the new behavior. Chromium and Firefox both seem to apply the same behavior; e.g. they actively decode PNGs (which are unpremultiplied in nature) to a premultiplied bitmap. Fixes #3691.
16 lines
368 B
HTML
16 lines
368 B
HTML
<!DOCTYPE html>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
}
|
|
body {
|
|
background-color: cyan;
|
|
}
|
|
</style>
|
|
<!-- To rebase:
|
|
1. Open image-unpremultiplied-data.html in Ladybird
|
|
2. Resize the window just above the width of the largest element
|
|
3. Right click > "Take Full Screenshot"
|
|
4. Update the image below:
|
|
-->
|
|
<img src="../images/image-unpremultiplied-data-ref.png">
|