Commit graph

47359 commits

Author SHA1 Message Date
Andreas Kling
4b3e229157 LibGfx: Replace Bitmap::invert() with Bitmap::inverted()
The new function return a new bitmap instead of mutating the current
one in place.
2023-02-21 00:54:04 +01:00
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
Andreas Kling
bd5d8e9d35 LibJS: Make RefPtr and NonnullRefPtr usage const-correct
This mainly affected the AST, which is now const throughout.
2023-02-21 00:54:04 +01:00
Andreas Kling
b2b942b4ec AK: Stop NonnullPtrVector from making accessed elements const 2023-02-21 00:54:04 +01:00
Niklas Poslovski
13f6767637 LibSQL: Don't use fchmod for socket on any BSD 2023-02-20 18:47:09 +01:00
nipos
f700d553ab LibCore: Add support for NetBSD in anon_create 2023-02-20 18:46:51 +01:00
nipos
9a77934e23 LibCore: Enable file descriptor passing on all BSDs 2023-02-20 18:46:36 +01:00
nipos
5b147f29ab AK/StackInfo: Add support for NetBSD 2023-02-20 18:44:36 +01:00
nipos
b3aa36d7bd LibCore: All BSDs need sig_t instead of sighandler_t 2023-02-20 18:42:54 +01:00
nipos
d710da108c LibCore: Implement socket credentials for NetBSD 2023-02-20 18:42:29 +01:00
Sam Atkins
e54a03d497 LibGUI: Use Gfx::Font::bold_variant() instead of a manual lookup
This has the nice side-effect of being cached in the Font, instead of
being repeatedly looked up in the FontDatabase.
2023-02-20 18:41:47 +01:00
Sam Atkins
efd56cda6a LibGUI: Use a while loop for iterating text spans 2023-02-20 18:41:47 +01:00
Sam Atkins
04deb81f71 LibGUI: Validate TextDocument spans when merging them, not when painting
TextDocument::merge_span_collections() automatically makes sure that the
spans are valid, move forwards, are in order, and do not overlap. This
means we don't have to check these things every time TextEditor paints
the document.

merge_span_collections() now does these checks instead. I am not certain
they are still useful, but someone in the past certainly did. I have
modified them to take advantage of the operator overloads and Formatter
that we now have.
2023-02-20 18:41:47 +01:00
Sam Atkins
54d45d4ac6 LibGUI: Add and use TextEditor::fixed_elements_width()
We were manually adding together the gutter and ruler widths in several
places. Soon we'll have a third section that needs to be included in
this width, so let's abstract it now.
2023-02-20 18:41:47 +01:00
Sam Atkins
1a5159df73 LibGUI+HackStudio: Simplify TextEditor gutter & ruler calculations
- Make gutter/ruler_content_rect() return rectangles relative to the
  TextEditor widget.
- Re-order painting code to translate the Painter after the gutter/ruler
  has been painted, to use those coordinates.
- Consistently put gutter before ruler in code, because that's the order
  they physically appear.
2023-02-20 18:41:47 +01:00
MacDue
3676f5085e LibWeb: Replace RefPtr with ValueComparingRefPtr in StyleValue
Like the name suggests this pointer type compares its pointees by value
rather than just by the pointer. This is needed for the defaulted
struct Properties equality operator.

This commit also contains a few changes to StyleValue such as replacing
the operator==()s with a .equals() again. This is done to avoid the new
reversed operator==()s ambiguity in C++20.
2023-02-20 10:50:20 +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
04d519f1f1 LibGfx: Use ICC::Profile::try_for_each_tag in icc main loop
I didn't use it in out_curve(), out_parametric_curve() since it
wouldn't be necessary if I printed the indent with a loop instead
of String::repeated() there.
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
Liav A
ac4829cc50 Kernel/IntelGraphics: Move PLL handling code to a different file
Dealing with the specific details of how to program a PLL should be done
in a separate file to ensure we can easily expand it to support future
generations of the Intel graphics device.
2023-02-19 15:01:01 -07:00
Liav A
9eab59c42b Kernel/Graphics: Return ENODEV if there's no valid EDID to return
ENODEV better represents the fact that there might be no display device
(e.g. a monitor) connected to the connector, therefore we should return
this error.
Another reason to not use ENOTIMPL is that it's a requirement for all
DisplayConnectors to put a valid EDID in place even for a hardware we
don't currently support mode-setting in runtime.
2023-02-19 15:01:01 -07:00
Liav A
b2da5d3e62 Kernel/Graphics: Allow Intel DisplayConnector to not have console 2023-02-19 15:01:01 -07:00
Liav A
016fedbd20 Kernel/IntelGraphics: Move DisplayPlane enable code to derived classes
Instead of doing that on the IntelDisplayPlane class, let's have this in
derived classes so these classes can decide how to use the settings that
were provided before calling the enable method.
2023-02-19 15:01:01 -07:00
Liav A
e393071a9b Kernel/IntelGraphics: Add Generation enum to the Definitions file
This will be used to annotate which Generation is being used for each
Intel iGPU we discover.
2023-02-19 15:01:01 -07:00
Liav A
8042ae43c3 Kernel/IntelGraphics: Move pipe management to the Transcoder class
It became apparent to me that future generations of the Intel graphics
chipset utilize the same register set as part of the Transcoder register
set. Therefore, it should be included now in the Transcoder class.
2023-02-19 15:01:01 -07:00
Liav A
2def16a3d2 Kernel/Graphics: Introduce the IntelDisplayConnectorGroup class
In the real world, graphics hardware tend to have multiple display
connectors. However, usually the connectors share one register space but
still keeping different PLL timings and display lanes.
This new class should represent a group of multiple display connectors
working together in the same Intel graphics adapter. This opens an
opportunity to abstract the interface so we could support future Intel
iGPU generations.

This is also a preparation before the driver can support newer devices
and utilize their capabilities.
The mentioned preparation is applied in a these aspects:
1. The code is splitted into more classes to adjust to future expansion.
2 classes are introduced: IntelDisplayPlane and IntelDisplayTranscoder,
so the IntelDisplayPlane controls the plane registers and second class
controls the pipeline (transcoder, encoder) registers. On gen4 it's not
really useful because there are probably one plane and one encoder to
care about, but in future generations, there are likely to be multiple
transcoders and planes to accommodate multi head support.
2. The set_edid_bytes method in the DisplayConnector class can now be
told to not assume the provided EDID bytes are always invalid. Therefore
it can refrain from printing error messages if this flag parameter is
true. This is useful for supporting real hardware situation when on boot
not all ports are connected to a monitor, which can result in floating
bus condition (essentially all the bytes we read are 0xFF).
3. An IntelNativeDisplayConnector could now be set to flag other types
of connections such as eDP (embedded DisplayPort), Analog output, etc.
This is important because on the Intel gen4 graphics we could assume to
have one analog output connector, but on future generations this is very
likely to not be the case, as there might be no VGA outputs, but rather
only an eDP connector which is converted to VGA by a design choice of
the motherboard manufacturer.
4. Add ConnectorIndex to IntelNativeDisplayConnector class - Currently
this is used to verify we always handle the correct connector when doing
modesetting.
Later, it will be used to locate special settings needed when handling
connector requests.
5. Prepare to support more types of display planes. For example, the
Intel Skylake register set for display planes is a bit different, so
let's ensure we can properly support it in the near future.
2023-02-19 15:01:01 -07: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
Jonah
30ec59f163 WebDriver: Add computedlabel endpoint 2023-02-19 13:28:01 -05:00
Sam Atkins
307cd4a1da HackStudio: Make wrapping modes consistent
We were only setting the wrapping mode when triggering the action. So:
- Any editors open without triggering a wrapping-mode action would have
  the default (WrapAtWords) instead of the selected item (NoWrap).
- Any editors opened after triggering an action would have the default
  too.

This fixes both situations, by:
- Storing the current wrapping mode in `m_wrapping_mode`. Later this
  could be loaded from the config.
- Changing that value any time a wrapping-mode action is triggered.
- Setting the wrapping mode on newly-created editors.
2023-02-19 18:52:26 +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