1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-26 08:25:50 +03:00

fonts: stub out sweep gradient

This commit is contained in:
Wez Furlong 2023-08-21 09:38:18 -07:00
parent 40083f55b8
commit dd6f2a4d7f
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
3 changed files with 45 additions and 22 deletions

View File

@ -148,6 +148,18 @@ pub fn paint_radial_gradient(
Ok(()) Ok(())
} }
pub fn paint_sweep_gradient(
context: &Context,
x0: f64,
y0: f64,
start_angle: f64,
end_angle: f64,
mut color_line: ColorLine,
) -> anyhow::Result<()> {
let (min_stop, max_stop) = normalize_color_line(&mut color_line);
anyhow::bail!("NOT IMPL: SweepGradient");
}
fn normalize_color_line(color_line: &mut ColorLine) -> (f64, f64) { fn normalize_color_line(color_line: &mut ColorLine) -> (f64, f64) {
let mut smallest = color_line.color_stops[0].offset; let mut smallest = color_line.color_stops[0].offset;
let mut largest = smallest; let mut largest = smallest;

View File

@ -5,7 +5,8 @@ use crate::ftwrap::{
}; };
use crate::parser::ParsedFont; use crate::parser::ParsedFont;
use crate::rasterizer::colr::{ use crate::rasterizer::colr::{
paint_linear_gradient, paint_radial_gradient, ColorLine, ColorStop, DrawOp, PaintOp, paint_linear_gradient, paint_radial_gradient, paint_sweep_gradient, ColorLine, ColorStop,
DrawOp, PaintOp,
}; };
use crate::rasterizer::harfbuzz::{argb_to_rgba, HarfbuzzRasterizer}; use crate::rasterizer::harfbuzz::{argb_to_rgba, HarfbuzzRasterizer};
use crate::rasterizer::{FontRasterizer, FAKE_ITALIC_SKEW}; use crate::rasterizer::{FontRasterizer, FAKE_ITALIC_SKEW};
@ -805,17 +806,21 @@ fn record_to_cairo_surface(
)?; )?;
} }
PaintOp::PaintSweepGradient { PaintOp::PaintSweepGradient {
x0: _, x0,
y0: _, y0,
start_angle: _, start_angle,
end_angle: _, end_angle,
color_line: _, color_line,
} => { } => {
#[allow(unused_assignments)]
{
has_color = true; has_color = true;
} paint_sweep_gradient(
anyhow::bail!("NOT IMPL: PaintSweepGradient"); &context,
x0.into(),
y0.into(),
start_angle.into(),
end_angle.into(),
color_line,
)?;
} }
} }
} }

View File

@ -2,7 +2,9 @@ use crate::hbwrap::{
hb_color, hb_color_get_alpha, hb_color_get_blue, hb_color_get_green, hb_color_get_red, hb_color, hb_color_get_alpha, hb_color_get_blue, hb_color_get_green, hb_color_get_red,
hb_color_t, hb_paint_composite_mode_t, hb_tag_to_string, Font, PaintOp, IS_PNG, hb_color_t, hb_paint_composite_mode_t, hb_tag_to_string, Font, PaintOp, IS_PNG,
}; };
use crate::rasterizer::colr::{paint_linear_gradient, paint_radial_gradient, DrawOp}; use crate::rasterizer::colr::{
paint_linear_gradient, paint_radial_gradient, paint_sweep_gradient, DrawOp,
};
use crate::rasterizer::FAKE_ITALIC_SKEW; use crate::rasterizer::FAKE_ITALIC_SKEW;
use crate::units::PixelLength; use crate::units::PixelLength;
use crate::{FontRasterizer, ParsedFont, RasterizedGlyph}; use crate::{FontRasterizer, ParsedFont, RasterizedGlyph};
@ -216,17 +218,21 @@ fn record_to_cairo_surface(paint_ops: Vec<PaintOp>) -> anyhow::Result<(Recording
)?; )?;
} }
PaintOp::PaintSweepGradient { PaintOp::PaintSweepGradient {
x0: _, x0,
y0: _, y0,
start_angle: _, start_angle,
end_angle: _, end_angle,
color_line: _, color_line,
} => { } => {
#[allow(unused_assignments)]
{
has_color = true; has_color = true;
} paint_sweep_gradient(
anyhow::bail!("NOT IMPL: PaintSweepGradient"); &context,
x0.into(),
y0.into(),
start_angle.into(),
end_angle.into(),
color_line,
)?;
} }
PaintOp::PaintImage { PaintOp::PaintImage {
image, image,