1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00
Commit graph

1164 commits

Author SHA1 Message Date
Andreas Kling
1f907a834f LibGfx: Make Bitmap::scaled(1) return a clone
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-21 00:54:04 +01:00
Nico Weber
1d124af66f LibGfx: Implement serialization of Lut16TagData and Lut8TagData 2023-02-19 23:46:36 +01:00
Nico Weber
4bafdaba3f LibGfx: Make Lut16TagData and Lut8TagData ctors verify table sizes
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-19 23:46:36 +01:00
Nico Weber
51be964884 LibGfx: Fix 7-bit ASCII checks in textDescriptionType and textType
This used to check the empty, moved-from parameter instead of
the member variable (-‸ლ)
2023-02-19 23:46:36 +01:00
Nico Weber
8f181e0e94 LibGfx: Implement serialization of NamedColor2TagData 2023-02-19 23:46:36 +01:00
Nico Weber
eac9941766 LibGfx: Make NamedColor2TagData verify inputs are 32-byte 7-bit ASCII
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-19 23:46:36 +01:00
Nico Weber
7ad11fa59a LibGfx: Mark a few ICC:NamedColor2TagData methods as const 2023-02-19 23:46:36 +01:00
Nico Weber
47cfcf5dca LibGfx: Move NamedColorHeader to BinaryFormat.h 2023-02-19 23:46:36 +01:00
Nico Weber
937d018fc6 LibGfx: Use ICC::Profile::try_for_each_tag in encode_tag_datas() 2023-02-19 23:46:36 +01:00
Nico Weber
8179327068 LibGfx: Add fallible ICC::Profile::try_for_each_tag
Similar to 13b18a1 or d0f3f3d.
2023-02-19 23:46:36 +01:00
Nico Weber
0f0694edb1 LibGfx: Remove an ICC writing FIXME, and a comment 2023-02-19 23:46:36 +01:00
Lucas CHOLLET
fa24f13452 LibGfx: Bring variables names closer to spec
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-19 23:39:59 +01:00
Lucas CHOLLET
51000961f2 LibGfx: Add a spec reference for JPEG constants definitions 2023-02-19 23:39:59 +01:00
Lucas CHOLLET
acc5161535 LibGfx: Add a spec link for the JPEG decoder 2023-02-19 23:39:59 +01:00
Lucas CHOLLET
71afef6466 LibGfx: Remove some magic variables in JPEGLoader 2023-02-19 23:39:59 +01:00
Lucas CHOLLET
c8213c24dd LibGfx: Rename is_valid_marker() to is_supported_marker() 2023-02-19 23:39:59 +01:00
Nico Weber
e2dde64628 LibGfx: Use static_cast in ICC writing code
It's what project leadership wants.
2023-02-19 22:31:41 +01:00
Nico Weber
0e66a5c3ed LibGfx: Write multiLocalizedUnicodeType with multiple strings correctly
Found by reencoding Tests/LibGfx/test-inputs/icc-v2.png, the 'dscm' tag.
2023-02-19 22:31:41 +01:00
Nico Weber
07bf2d944c LibGfx: Add a FIXME to ICC encode_tag_data() 2023-02-19 22:31:41 +01:00
Nico Weber
7e769c7217 LibGfx: Partially implement serialization of TextDescriptionTagData
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-19 22:31:41 +01:00
Nico Weber
b2cf773d85 LibGfx: Make TextDescriptionTagData verify input is 7-bit ASCII
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-19 22:31:41 +01:00
Nico Weber
e76f1caf79 LibGfx: Re-alphabetize TagData classes
This moves TextDescriptionTagData below SignatureTagData.
It just moves code around and doesn't change anything.
2023-02-19 22:31:41 +01:00
Nico Weber
4d972ab975 LibGfx: Add spec comment to ICC encode_tag_table() 2023-02-19 22:31:41 +01:00
MacDue
bb8c8a67dc LibGfx: Fix a slight mistake in AA ellipse error calculation
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-19 18:40:15 +01:00
Sam Atkins
2db168acc1 LibTextCodec+Everywhere: Port Decoders to new Strings 2023-02-19 17:15:47 +01:00
Lucas CHOLLET
85287fcc1e LibGfx: Rename all JPG_* macros to JPEG_* in JPEGLoader 2023-02-19 11:31:45 +01:00
Nico Weber
19e91e5211 LibGfx: Dedupe identical tag data objects when writing ICC data
With this, common v4 profiles, such as embedded into jpgs by iPhones
(when configured to write jpegs) or Pixel phones, are identical to
the input when reexported :^)
2023-02-19 08:12:04 +00:00
Nico Weber
2504f2035c LibGfx: Implement serialization of ViewingConditionsTagData 2023-02-19 08:12:04 +00:00
Nico Weber
933002ae5a LibGfx: Move ICC ViewingConditionsHeader to BinaryFormat.h 2023-02-19 08:12:04 +00:00
Lucas CHOLLET
841e359341 LibGfx: Correctly handle JPEG image with restart markers
Restart markers are supposed to be applied every restart interval.
However, in these loops macroblocks are counted taking the luma sampling
factor into consideration. Meaning that we need to correct this factor
when testing if we should reset the DC.

Also, the decoder was discarding the first byte of every scan with a set
restart interval, as `0 % n == 0` is always true.
2023-02-19 07:59:58 +00:00
Linus Groh
10575fea9f LibGfx: Fix sign-compare compile error in TGALoader
I'm not sure why this isn't caught on other people's setups or CI, but
when building on NixOS it fails with:

    error: comparison of integer expressions of different signedness:
    ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Werror=sign-compare]
2023-02-19 00:37:51 +01:00
Nico Weber
22c0e6b60e LibGfx: Implement serialization of MeasurementTagData 2023-02-19 00:01:44 +01:00
Nico Weber
8e5392f9c0 LibGfx: Move ICC MeasurementHeader to BinaryFormat.h 2023-02-19 00:01:44 +01:00
Nico Weber
a1de65c34f LibGfx: Implement serialization of TextTagData 2023-02-19 00:01:44 +01:00
Nico Weber
eaa0e3484b LibGfx: Make TextTagData verify input is 7-bit ASCII
TextTagData::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-19 00:01:44 +01:00
Nico Weber
df5dbc180f LibGfx: Implement serialization of SignatureTagData 2023-02-19 00:01:44 +01:00
Nico Weber
3690305794 LibGfx: Implement serialization of CurveTagData 2023-02-19 00:01:44 +01:00
Nico Weber
1ca7f109a1 LibGfx: Implement serialization of CicpTagData 2023-02-19 00:01:44 +01:00
Nico Weber
fd590fe55d LibGfx: Implement serialization of ChromaticityTagData 2023-02-19 00:01:44 +01:00
Nico Weber
ececea9a1c LibGfx: Implement serialization of ParametricCurveTagData
With this, simple v4 matrix profiles using parametric curves, such as
Compact-ICC-Profiles/profiles/sRGB-v4.icc, can be completely serialized
and the serialized file can be read again by `icc` :^)
2023-02-19 00:01:44 +01:00
Nico Weber
685e2da302 LibGfx: Implement serialization of S15Fixed16ArrayTagData 2023-02-19 00:01:44 +01:00
Nico Weber
931594fce3 LibGfx: Implement serialization of XYZTagData 2023-02-19 00:01:44 +01:00
Nico Weber
eb6dccb675 LibGfx: Implement serialization of MultiLocalizedUnicodeTagData 2023-02-19 00:01:44 +01:00
Nico Weber
4a62cf35fc LibGfx: Move MultiLocalizedUnicodeRawRecord to BinaryFormat.h 2023-02-19 00:01:44 +01:00
Nico Weber
4e72a35398 LibGfx: Add scaffolding for writing tag data
This doesn't deduplicate identical TagDatas yet.

It also doesn't implement actual serialization of TagData yet.
2023-02-19 00:01:44 +01:00
Nico Weber
1457e36b79 LibGfx: Write ICC tag table
All offsets and sizes are set to 0 for now, so this still doesn't
produce a valid icc file. It gets closer, though.
2023-02-19 00:01:44 +01:00
Nico Weber
9bd7048519 LibGfx: Move ICC TagTableEntry to BinaryFormat.h 2023-02-19 00:01:44 +01:00
Nico Weber
026d9ceaf9 LibGfx: Extract encode_header() function in ICC writing code 2023-02-19 00:01:44 +01:00
Lucas CHOLLET
743b6e8781 LibGfx: Rename format name from jpg to jpeg 2023-02-18 23:56:24 +01:00
Lucas CHOLLET
856d0202f2 LibGfx: Rename JPGLoader to JPEGLoader
The patch also contains modifications on several classes, functions or
files that are related to the `JPGLoader`.

Renaming include:
 - JPGLoader{.h, .cpp}
 - JPGImageDecoderPlugin
 - JPGLoadingContext
 - JPG_DEBUG
 - decode_jpg
 - FuzzJPGLoader.cpp
 - Few string literals or texts
2023-02-18 23:56:24 +01:00