From 7b3a4f828156ec4e7e1f344abf7cd752c857e94b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 19 Jul 2021 20:46:30 +0200 Subject: [PATCH] LibTTF: Rename "raster" => "rasterize" --- Userland/Libraries/LibTTF/Font.cpp | 10 +++++----- Userland/Libraries/LibTTF/Font.h | 4 ++-- Userland/Libraries/LibTTF/Glyf.cpp | 6 +++--- Userland/Libraries/LibTTF/Glyf.h | 14 +++++++------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Userland/Libraries/LibTTF/Font.cpp b/Userland/Libraries/LibTTF/Font.cpp index d61515d908..b24050d75c 100644 --- a/Userland/Libraries/LibTTF/Font.cpp +++ b/Userland/Libraries/LibTTF/Font.cpp @@ -410,14 +410,14 @@ ScaledGlyphMetrics Font::glyph_metrics(u32 glyph_id, float x_scale, float y_scal } // FIXME: "loca" and "glyf" are not available for CFF fonts. -RefPtr Font::raster_glyph(u32 glyph_id, float x_scale, float y_scale) const +RefPtr Font::rasterize_glyph(u32 glyph_id, float x_scale, float y_scale) const { if (glyph_id >= glyph_count()) { glyph_id = 0; } auto glyph_offset = m_loca.get_glyph_offset(glyph_id); auto glyph = m_glyf.glyph(glyph_offset); - return glyph.raster(x_scale, y_scale, [&](u16 glyph_id) { + return glyph.rasterize(x_scale, y_scale, [&](u16 glyph_id) { if (glyph_id >= glyph_count()) { glyph_id = 0; } @@ -513,13 +513,13 @@ ALWAYS_INLINE int ScaledFont::unicode_view_width(T const& view) const return longest_width; } -RefPtr ScaledFont::raster_glyph(u32 glyph_id) const +RefPtr ScaledFont::rasterize_glyph(u32 glyph_id) const { auto glyph_iterator = m_cached_glyph_bitmaps.find(glyph_id); if (glyph_iterator != m_cached_glyph_bitmaps.end()) return glyph_iterator->value; - auto glyph_bitmap = m_font->raster_glyph(glyph_id, m_x_scale, m_y_scale); + auto glyph_bitmap = m_font->rasterize_glyph(glyph_id, m_x_scale, m_y_scale); m_cached_glyph_bitmaps.set(glyph_id, glyph_bitmap); return glyph_bitmap; } @@ -527,7 +527,7 @@ RefPtr ScaledFont::raster_glyph(u32 glyph_id) const Gfx::Glyph ScaledFont::glyph(u32 code_point) const { auto id = glyph_id_for_code_point(code_point); - auto bitmap = raster_glyph(id); + auto bitmap = rasterize_glyph(id); auto metrics = glyph_metrics(id); return Gfx::Glyph(bitmap, metrics.left_side_bearing, metrics.advance_width, metrics.ascender); } diff --git a/Userland/Libraries/LibTTF/Font.h b/Userland/Libraries/LibTTF/Font.h index 987cac44c9..9a565972f6 100644 --- a/Userland/Libraries/LibTTF/Font.h +++ b/Userland/Libraries/LibTTF/Font.h @@ -50,7 +50,7 @@ public: ScaledFontMetrics metrics(float x_scale, float y_scale) const; ScaledGlyphMetrics glyph_metrics(u32 glyph_id, float x_scale, float y_scale) const; - RefPtr raster_glyph(u32 glyph_id, float x_scale, float y_scale) const; + RefPtr rasterize_glyph(u32 glyph_id, float x_scale, float y_scale) const; u32 glyph_count() const; u16 units_per_em() const; u32 glyph_id_for_code_point(u32 code_point) const { return m_cmap.glyph_id_for_code_point(code_point); } @@ -115,7 +115,7 @@ public: u32 glyph_id_for_code_point(u32 code_point) const { return m_font->glyph_id_for_code_point(code_point); } ScaledFontMetrics metrics() const { return m_font->metrics(m_x_scale, m_y_scale); } ScaledGlyphMetrics glyph_metrics(u32 glyph_id) const { return m_font->glyph_metrics(glyph_id, m_x_scale, m_y_scale); } - RefPtr raster_glyph(u32 glyph_id) const; + RefPtr rasterize_glyph(u32 glyph_id) const; // Gfx::Font implementation virtual NonnullRefPtr clone() const override { return *this; } // FIXME: clone() should not need to be implemented diff --git a/Userland/Libraries/LibTTF/Glyf.cpp b/Userland/Libraries/LibTTF/Glyf.cpp index 86c039e3ea..28c707f794 100644 --- a/Userland/Libraries/LibTTF/Glyf.cpp +++ b/Userland/Libraries/LibTTF/Glyf.cpp @@ -380,7 +380,7 @@ static void get_ttglyph_offsets(ReadonlyBytes const& slice, u32 num_points, u32 *y_offset = *x_offset + x_size; } -void Glyf::Glyph::raster_inner(Rasterizer& rasterizer, Gfx::AffineTransform& affine) const +void Glyf::Glyph::rasterize_impl(Rasterizer& rasterizer, Gfx::AffineTransform& affine) const { // Get offset for flags, x, and y. u16 num_points = be_u16(m_slice.offset_pointer((m_num_contours - 1) * 2)) + 1; @@ -476,13 +476,13 @@ void Glyf::Glyph::raster_inner(Rasterizer& rasterizer, Gfx::AffineTransform& aff rasterizer.draw_path(path); } -RefPtr Glyf::Glyph::raster_simple(float x_scale, float y_scale) const +RefPtr Glyf::Glyph::rasterize_simple(float x_scale, float y_scale) const { u32 width = (u32)(ceilf((m_xmax - m_xmin) * x_scale)) + 2; u32 height = (u32)(ceilf((m_ymax - m_ymin) * y_scale)) + 2; Rasterizer rasterizer(Gfx::IntSize(width, height)); auto affine = Gfx::AffineTransform().scale(x_scale, -y_scale).translate(-m_xmin, -m_ymax); - raster_inner(rasterizer, affine); + rasterize_impl(rasterizer, affine); return rasterizer.accumulate(); } diff --git a/Userland/Libraries/LibTTF/Glyf.h b/Userland/Libraries/LibTTF/Glyf.h index af8f801089..39c54181a3 100644 --- a/Userland/Libraries/LibTTF/Glyf.h +++ b/Userland/Libraries/LibTTF/Glyf.h @@ -63,13 +63,13 @@ public: } } template - RefPtr raster(float x_scale, float y_scale, GlyphCb glyph_callback) const + RefPtr rasterize(float x_scale, float y_scale, GlyphCb glyph_callback) const { switch (m_type) { case Type::Simple: - return raster_simple(x_scale, y_scale); + return rasterize_simple(x_scale, y_scale); case Type::Composite: - return raster_composite(x_scale, y_scale, glyph_callback); + return rasterize_composite(x_scale, y_scale, glyph_callback); } VERIFY_NOT_REACHED(); } @@ -101,10 +101,10 @@ public: u32 m_offset { 0 }; }; - void raster_inner(Rasterizer&, Gfx::AffineTransform&) const; - RefPtr raster_simple(float x_scale, float y_scale) const; + void rasterize_impl(Rasterizer& rasterizer, Gfx::AffineTransform& affine) const; + RefPtr rasterize_simple(float x_scale, float y_scale) const; template - RefPtr raster_composite(float x_scale, float y_scale, GlyphCb glyph_callback) const + RefPtr rasterize_composite(float x_scale, float y_scale, GlyphCb glyph_callback) const { u32 width = (u32)(ceilf((m_xmax - m_xmin) * x_scale)) + 1; u32 height = (u32)(ceilf((m_ymax - m_ymin) * y_scale)) + 1; @@ -119,7 +119,7 @@ public: auto item = opt_item.value(); auto affine_here = affine.multiply(item.affine); auto glyph = glyph_callback(item.glyph_id); - glyph.raster_inner(rasterizer, affine_here); + glyph.rasterize_impl(rasterizer, affine_here); } return rasterizer.accumulate(); }