mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:57:35 +00:00
LibWeb: Use glyph run to store text paint command in RecordingPainter
Representing a text run panting command as a vector of glyphs, rather than as a string simplifies collecting of unique glyphs which is a prerequisite for `prepare_glyphs_texture()` call.
This commit is contained in:
parent
32ea11d45c
commit
ee28ba0c93
6 changed files with 23 additions and 17 deletions
|
@ -25,6 +25,7 @@
|
|||
#include <LibGfx/TextAlignment.h>
|
||||
#include <LibGfx/TextDirection.h>
|
||||
#include <LibGfx/TextElision.h>
|
||||
#include <LibGfx/TextLayout.h>
|
||||
#include <LibGfx/TextWrapping.h>
|
||||
#include <LibWeb/Painting/BorderRadiiData.h>
|
||||
#include <LibWeb/Painting/BorderRadiusCornerClipper.h>
|
||||
|
@ -38,11 +39,9 @@ enum class CommandResult {
|
|||
SkipStackingContext,
|
||||
};
|
||||
|
||||
struct DrawTextRun {
|
||||
struct DrawGlyphRun {
|
||||
Vector<Gfx::DrawGlyphOrEmoji> glyph_run;
|
||||
Color color;
|
||||
Gfx::IntPoint baseline_start;
|
||||
String string;
|
||||
NonnullRefPtr<Gfx::Font> font;
|
||||
Gfx::IntRect rect;
|
||||
|
||||
[[nodiscard]] Gfx::IntRect bounding_rect() const { return rect; }
|
||||
|
@ -304,7 +303,7 @@ struct BlitCornerClipping {
|
|||
};
|
||||
|
||||
using PaintingCommand = Variant<
|
||||
DrawTextRun,
|
||||
DrawGlyphRun,
|
||||
DrawText,
|
||||
FillRect,
|
||||
DrawScaledBitmap,
|
||||
|
@ -342,7 +341,7 @@ class PaintingCommandExecutor {
|
|||
public:
|
||||
virtual ~PaintingCommandExecutor() = default;
|
||||
|
||||
virtual CommandResult draw_text_run(Color const&, Gfx::IntPoint const& baseline_start, String const&, Gfx::Font const&) = 0;
|
||||
virtual CommandResult draw_glyph_run(Vector<Gfx::DrawGlyphOrEmoji> const& glyph_run, Color const&) = 0;
|
||||
virtual CommandResult draw_text(Gfx::IntRect const&, String const&, Gfx::TextAlignment alignment, Color const&, Gfx::TextElision, Gfx::TextWrapping, Optional<NonnullRefPtr<Gfx::Font>> const&) = 0;
|
||||
virtual CommandResult fill_rect(Gfx::IntRect const&, Color const&) = 0;
|
||||
virtual CommandResult draw_scaled_bitmap(Gfx::IntRect const& dst_rect, Gfx::Bitmap const& bitmap, Gfx::IntRect const& src_rect, float opacity, Gfx::Painter::ScalingMode scaling_mode) = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue