linux: profile text system functions
This commit is contained in:
parent
76196694b7
commit
d895388809
1 changed files with 14 additions and 13 deletions
|
@ -1,22 +1,19 @@
|
||||||
//todo!(linux) remove
|
|
||||||
#[allow(unused)]
|
|
||||||
use crate::{point, size, FontStyle, FontWeight, Point, ShapedGlyph};
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Bounds, DevicePixels, Font, FontFeatures, FontId, FontMetrics, FontRun, GlyphId, LineLayout,
|
point, size, Bounds, DevicePixels, Font, FontFeatures, FontId, FontMetrics, FontRun, FontStyle,
|
||||||
Pixels, PlatformTextSystem, RenderGlyphParams, SharedString, Size,
|
FontWeight, GlyphId, LineLayout, Pixels, PlatformTextSystem, Point, RenderGlyphParams,
|
||||||
|
ShapedGlyph, SharedString, Size,
|
||||||
};
|
};
|
||||||
use anyhow::Ok;
|
use anyhow::{anyhow, Context, Ok, Result};
|
||||||
use anyhow::Result;
|
|
||||||
use anyhow::{anyhow, Context};
|
|
||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use cosmic_text::fontdb::Query;
|
|
||||||
use cosmic_text::{
|
use cosmic_text::{
|
||||||
Attrs, AttrsList, BufferLine, CacheKey, Family, Font as CosmicTextFont, FontSystem, SwashCache,
|
fontdb::Query, Attrs, AttrsList, BufferLine, CacheKey, Family, Font as CosmicTextFont,
|
||||||
|
FontSystem, SwashCache,
|
||||||
};
|
};
|
||||||
use parking_lot::{RwLock, RwLockUpgradableReadGuard};
|
use parking_lot::{RwLock, RwLockUpgradableReadGuard};
|
||||||
use pathfinder_geometry::rect::RectF;
|
use pathfinder_geometry::{
|
||||||
use pathfinder_geometry::rect::RectI;
|
rect::{RectF, RectI},
|
||||||
use pathfinder_geometry::vector::{Vector2F, Vector2I};
|
vector::{Vector2F, Vector2I},
|
||||||
|
};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::{borrow::Cow, sync::Arc};
|
use std::{borrow::Cow, sync::Arc};
|
||||||
|
|
||||||
|
@ -197,6 +194,7 @@ impl PlatformTextSystem for LinuxTextSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LinuxTextSystemState {
|
impl LinuxTextSystemState {
|
||||||
|
#[profiling::function]
|
||||||
fn add_fonts(&mut self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()> {
|
fn add_fonts(&mut self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()> {
|
||||||
let db = self.font_system.db_mut();
|
let db = self.font_system.db_mut();
|
||||||
for bytes in fonts {
|
for bytes in fonts {
|
||||||
|
@ -212,6 +210,7 @@ impl LinuxTextSystemState {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[profiling::function]
|
||||||
fn load_family(
|
fn load_family(
|
||||||
&mut self,
|
&mut self,
|
||||||
name: &SharedString,
|
name: &SharedString,
|
||||||
|
@ -289,6 +288,7 @@ impl LinuxTextSystemState {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[profiling::function]
|
||||||
fn rasterize_glyph(
|
fn rasterize_glyph(
|
||||||
&mut self,
|
&mut self,
|
||||||
params: &RenderGlyphParams,
|
params: &RenderGlyphParams,
|
||||||
|
@ -321,6 +321,7 @@ impl LinuxTextSystemState {
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo!(linux) This is all a quick first pass, maybe we should be using cosmic_text::Buffer
|
// todo!(linux) This is all a quick first pass, maybe we should be using cosmic_text::Buffer
|
||||||
|
#[profiling::function]
|
||||||
fn layout_line(&mut self, text: &str, font_size: Pixels, font_runs: &[FontRun]) -> LineLayout {
|
fn layout_line(&mut self, text: &str, font_size: Pixels, font_runs: &[FontRun]) -> LineLayout {
|
||||||
let mut attrs_list = AttrsList::new(Attrs::new());
|
let mut attrs_list = AttrsList::new(Attrs::new());
|
||||||
let mut offs = 0;
|
let mut offs = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue