summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx
AgeCommit message (Collapse)Author
2023-02-23LibGfx: Pad last element in ICC files to 4-byte boundary tooNico Weber
The spec wants that to happen.
2023-02-23LibGfx: Implement serialization of LutAToBTagData and LutBToATagDataNico Weber
With this, we can write all tag types we can currently read :^)
2023-02-22LibGfx: Do not exclude all ASCII code points from emoji lookupsTimothy Flynn
Keycap emoji, for example, begin with ASCII digits. Instead, check the first code point for the Emoji Unicode property. On a profile of scrolling around on the welcome page in the Browser, this raises the runtime percentage of Font::glyph_or_emoji_width from about 0.8% to 1.3%.
2023-02-22LibGfx: Bail early from Emoji::emoji_for_code_point_iterator for ASCIITimothy Flynn
On a profile of scrolling around on the welcome page in the Browser, this drops the runtime percentage of Font::glyph_or_emoji_width from about 70% to 0.8%.
2023-02-22LibGfx: Consult Unicode data to decode emoji sequencesTimothy Flynn
For example, consider the Pirate Flag emoji, which is the code point sequence U+1F3F4 U+200D U+2620 U+FE0F. Our current emoji resolution does not consider U+200D (Zero Width Joiner) as part of an emoji sequence. Therefore fonts like Katica, which have a glyph for U+1F3F4, will draw that glyph without checking if we have an emoji bitmap. This removes some hard-coded code points and consults the UCD's code point properties for emoji sequence components and variation selectors. This recognizes the ZWJ code point as part of an emoji sequence.
2023-02-22LibGfx: Consider multi-code point glyphs when computing text widthTimothy Flynn
Currently, we compute the width of text one code point at a time. This ignores grapheme clusters (emoji in particular). One effect of this is when highlighting a multi-code point emoji. We will errantly increase the highlight rect to the sum of all code point widths, rather than just the width of the resolved emoji bitmap.
2023-02-22LibGfx: Support computing a font's glyph width with code point iteratorsTimothy Flynn
This allows consideration of multi-code point glyphs.
2023-02-22LibGfx: Implement Emoji::emoji_for_code_point_iterator for UTF-32 viewsTimothy Flynn
2023-02-22LibGfx: Log the underlying error when failing to decode a macroblockLucas CHOLLET
2023-02-22LibGfx: Don't assume that scans are always full when filling macroblocksLucas CHOLLET
In other words: only consider coefficient of the current scan when adding coefficients to a macroblock. Information about which coefficients are present in the stream are passed through the spectral information in the context.
2023-02-22LibGfx: Save spectral information in the contextLucas CHOLLET
These variables are useless for baseline JPEG, but they will become useful for other encodings.
2023-02-22LibGfx: Put code to add AC coefficients to a macroblock in a functionLucas CHOLLET
2023-02-22LibGfx: Put code to add the DC coefficient to a macroblock in a functionLucas CHOLLET
2023-02-22LibGfx: Don't store the size of a `Vector` in an external variableLucas CHOLLET
2023-02-22LibGfx: Put the code to reset the encoder in its own functionLucas CHOLLET
With it, we can also add a spec reference. And it will remind to anyone who wants to add support for a new coding to not forget to update it.
2023-02-22LibGfx: Make `decode_huffman_stream` take macroblocks by referenceLucas CHOLLET
In progressive mode, this functions will need to be called multiple time on the same macroblocks, so it shouldn't create the vector every time it's called.
2023-02-22LibGfx: Prepare the decoder to handle multiples scansLucas CHOLLET
This means that we should read markers in a loop instead of quiting on the first scan. This is useless for now as `SOF0` frames only have one scan, but this is a step forward `SOF2` support.
2023-02-22LibGfx: Return from `scan_huffman_stream` before `JPEG_EOI`Lucas CHOLLET
As a JPEG file can contain multiples scans, we should return from `scan_huffman_stream` on all new markers (except restart markers) and not only `JPEG_EOI`.
2023-02-22LibGfx: Factorize handling of miscellaneous and tables segmentsLucas CHOLLET
Miscellaneous and tables segments can also be placed between scans, placing this code in a function will allow us to avoid duplication when we get there.
2023-02-22LibGfx: Rename "skip_marker_with_length" to "skip_segment"Lucas CHOLLET
As it, in fact, does not skip a marker but a segment :^).
2023-02-21LibGfx: Fix const-correctness issuesAndreas Kling
2023-02-21LibGfx: Make Gfx::Path const-correct internally (segment list)Andreas Kling
2023-02-21LibGfx: Add const hack in Bitmap::to_bitmap_backed_by_anonymous_buffer()Andreas Kling
2023-02-21LibGfx: Replace Bitmap::invert() with Bitmap::inverted()Andreas Kling
The new function return a new bitmap instead of mutating the current one in place.
2023-02-21LibGfx: Make Bitmap::scaled(1) return a cloneAndreas Kling
While returning the same image is a cute optimization, it violates the expectation that the returned Bitmap is a new bitmap, not shared with anyone else.
2023-02-19LibGfx: Implement serialization of Lut16TagData and Lut8TagDataNico Weber
2023-02-19LibGfx: Make Lut16TagData and Lut8TagData ctors verify table sizesNico Weber
The from_bytes() methods error out on invalid table sizes, but let's make sure other potential future callers get it right too.
2023-02-19LibGfx: Fix 7-bit ASCII checks in textDescriptionType and textTypeNico Weber
This used to check the empty, moved-from parameter instead of the member variable (οΌβ€Έαƒš)
2023-02-19LibGfx: Implement serialization of NamedColor2TagDataNico Weber
2023-02-19LibGfx: Make NamedColor2TagData verify inputs are 32-byte 7-bit ASCIINico Weber
NamedColor2TagData::from_bytes() errors out if that isn't the case, but let's make sure other potential future callers get it right too.
2023-02-19LibGfx: Mark a few ICC:NamedColor2TagData methods as constNico Weber
2023-02-19LibGfx: Move NamedColorHeader to BinaryFormat.hNico Weber
2023-02-19LibGfx: Use ICC::Profile::try_for_each_tag in encode_tag_datas()Nico Weber
2023-02-19LibGfx: Add fallible ICC::Profile::try_for_each_tagNico Weber
Similar to 13b18a1 or d0f3f3d.
2023-02-19LibGfx: Remove an ICC writing FIXME, and a commentNico Weber
2023-02-19LibGfx: Bring variables names closer to specLucas CHOLLET
Rename "reset_marker" to "restart_marker" as described by the spec. It also concerns disambiguate the situation as the DRI was also called a reset marker.
2023-02-19LibGfx: Add a spec reference for JPEG constants definitionsLucas CHOLLET
2023-02-19LibGfx: Add a spec link for the JPEG decoderLucas CHOLLET
2023-02-19LibGfx: Remove some magic variables in `JPEGLoader`Lucas CHOLLET
2023-02-19LibGfx: Rename `is_valid_marker()` to `is_supported_marker()`Lucas CHOLLET
2023-02-19LibGfx: Use static_cast in ICC writing codeNico Weber
It's what project leadership wants.
2023-02-19LibGfx: Write multiLocalizedUnicodeType with multiple strings correctlyNico Weber
Found by reencoding Tests/LibGfx/test-inputs/icc-v2.png, the 'dscm' tag.
2023-02-19LibGfx: Add a FIXME to ICC encode_tag_data()Nico Weber
2023-02-19LibGfx: Partially implement serialization of TextDescriptionTagDataNico Weber
It only implements serialization of the 7-bit ASCII string, not yet serialization of the UCS-2 and Macintosh ScriptCode strings. With this, matrix-based v2 profiles can be reencoded :^)
2023-02-19LibGfx: Make TextDescriptionTagData verify input is 7-bit ASCIINico Weber
TextDescriptionTagData::from_bytes() errors out if that isn't the case, but let's make sure other potential future callers get it right too.
2023-02-19LibGfx: Re-alphabetize TagData classesNico Weber
This moves TextDescriptionTagData below SignatureTagData. It just moves code around and doesn't change anything.
2023-02-19LibGfx: Add spec comment to ICC encode_tag_table()Nico Weber
2023-02-19LibGfx: Fix a slight mistake in AA ellipse error calculationMacDue
The initial signs were wrong for the deltas of f(x), the ellipse equation. This seemed to be fine for larger circles/ellipses but broke things at a small scale, this was previously fixed with a horrible "error = error / 4" hack. With this change, all ellipses look a little better :^) This also fixed a signed integer overflow Andreas found with UBSAN, which happened for circles with a 1px radius.
2023-02-19LibTextCodec+Everywhere: Port Decoders to new StringsSam Atkins
2023-02-19LibGfx: Rename all `JPG_*` macros to `JPEG_*` in JPEGLoaderLucas CHOLLET