mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibGfx+LibWeb: Perform unchecked appends related to text layout
Use unchecked appends in places where we know for certain the vector has enough capacity.
This commit is contained in:
parent
2cba208366
commit
7d1ee3a2fa
Notes:
github-actions[bot]
2025-06-17 09:57:01 +00:00
Author: https://github.com/gmta
Commit: 7d1ee3a2fa
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5104
2 changed files with 4 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021, sin-ack <sin-ack@protonmail.com>
|
||||
* Copyright (c) 2024-2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -68,7 +69,7 @@ NonnullRefPtr<GlyphRun> shape_text(FloatPoint baseline_start, float letter_spaci
|
|||
if (!features.is_empty()) {
|
||||
hb_features.ensure_capacity(features.size());
|
||||
for (auto const& feature : features) {
|
||||
hb_features.append({
|
||||
hb_features.unchecked_append({
|
||||
.tag = HB_TAG(feature.tag[0], feature.tag[1], feature.tag[2], feature.tag[3]),
|
||||
.value = feature.value,
|
||||
.start = 0,
|
||||
|
@ -90,7 +91,7 @@ NonnullRefPtr<GlyphRun> shape_text(FloatPoint baseline_start, float letter_spaci
|
|||
auto position = point
|
||||
- FloatPoint { 0, font.pixel_metrics().ascent }
|
||||
+ FloatPoint { positions[i].x_offset, positions[i].y_offset } / text_shaping_resolution;
|
||||
glyph_run.append({ position, glyph_info[i].codepoint });
|
||||
glyph_run.unchecked_append({ position, glyph_info[i].codepoint });
|
||||
point += FloatPoint { positions[i].x_advance, positions[i].y_advance } / text_shaping_resolution;
|
||||
|
||||
// don't apply spacing to last glyph
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue