Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable channel, 2026-09-22
with:
components: rustfmt
# The version is `rust-toolchain.toml` and nothing else. `rustup toolchain
# install` with no argument reads that file, so there is one place to bump
# and no way for CI to test a version the working tree does not. Installing
# the floating `stable` channel instead is what reddened a green main on
# 2026-10-01: rustc 1.99.0 sharpened a clippy lint and no commit had changed.
- name: Install the pinned toolchain
run: rustup toolchain install
- name: Check formatting
run: cargo fmt --all --check

Expand All @@ -30,9 +34,8 @@ jobs:
# fonts-dejavu-core: font *files*, not just the libraries. A bare runner has none,
# and usvg silently drops an <svg>'s <text> when no face resolves.
run: sudo apt-get update && sudo apt-get install -y libfontconfig1-dev libfreetype6-dev libxkbcommon-x11-dev libwayland-dev libxcb-cursor-dev libasound2-dev fonts-dejavu-core
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable channel, 2026-09-22
with:
components: clippy
- name: Install the pinned toolchain
run: rustup toolchain install
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
- name: Clippy
# `--features rustmotion/studio` n'est pas décoratif : le studio est
Expand All @@ -53,7 +56,8 @@ jobs:
# fonts-dejavu-core: font *files*, not just the libraries. A bare runner has none,
# and usvg silently drops an <svg>'s <text> when no face resolves.
run: sudo apt-get update && sudo apt-get install -y libfontconfig1-dev libfreetype6-dev libxkbcommon-x11-dev libwayland-dev libxcb-cursor-dev libasound2-dev fonts-dejavu-core
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable channel, 2026-09-22
- name: Install the pinned toolchain
run: rustup toolchain install
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
- name: Run tests
# Même raison qu'au job clippy : sans le feature, les tests du studio
Expand All @@ -64,7 +68,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable channel, 2026-09-22
- name: Install the pinned toolchain
run: rustup toolchain install
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
- name: Install cargo-audit
run: cargo install cargo-audit --locked
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ jobs:
# asound: required by cpal, which rodio pulls in for preview audio
run: sudo apt-get update && sudo apt-get install -y libfontconfig1-dev libfreetype6-dev libxkbcommon-x11-dev libwayland-dev libxcb-cursor-dev libasound2-dev

- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable channel, 2026-09-22
- name: Install the pinned toolchain
run: rustup toolchain install

# La version se lit via `cargo metadata`, pas en grepant un manifeste : elle
# est déclarée dans `[workspace.package]` et héritée, donc un `grep
Expand Down
4 changes: 2 additions & 2 deletions crates/rustmotion-components/src/avatar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use skia_safe::{Canvas, Paint, PaintStyle, RRect, Rect};

use rustmotion_core::engine::animator::AnimatedProperties;
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::{asset_cache, paint_from_hex};
use rustmotion_core::engine::renderer::{asset_cache, draw_photo, paint_from_hex};
use rustmotion_core::error::RustmotionError;
use rustmotion_core::schema::TimelineStep;
use rustmotion_core::traits::{PaintCtx, Painter, TimingConfig};
Expand Down Expand Up @@ -112,7 +112,7 @@ impl Avatar {
let offset_y = (h - draw_h) / 2.0;

let dst = Rect::from_xywh(offset_x, offset_y, draw_w, draw_h);
canvas.draw_image_rect(img, None, dst, &Paint::default());
draw_photo(canvas, img, dst, &Paint::default());

canvas.restore();

Expand Down
3 changes: 2 additions & 1 deletion crates/rustmotion-components/src/avatar_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use skia_safe::{Canvas, Paint, PaintStyle, RRect, Rect};

use rustmotion_core::engine::animator::AnimatedProperties;
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::draw_photo;
use rustmotion_core::engine::renderer::{
asset_cache, draw_text_with_fallback, emoji_typeface, measure_text_with_fallback,
paint_from_hex, subpixel_font, typeface_with_fallback,
Expand Down Expand Up @@ -141,7 +142,7 @@ impl AvatarGroup {
let offset_y = cy - inner_r + (d - draw_h) / 2.0;

let dst = Rect::from_xywh(offset_x, offset_y, draw_w, draw_h);
canvas.draw_image_rect(img, None, dst, &Paint::default());
draw_photo(canvas, img, dst, &Paint::default());
canvas.restore();
}

Expand Down
3 changes: 2 additions & 1 deletion crates/rustmotion-components/src/badge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use rustmotion_core::css::style::AlignSelf;
use rustmotion_core::css::CssStyle;
use rustmotion_core::engine::animator::AnimatedProperties;
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::draw_photo;
use rustmotion_core::engine::renderer::{
asset_cache, draw_text_with_fallback, emoji_typeface, fetch_icon_svg,
measure_text_with_fallback, paint_from_hex, subpixel_font, typeface_with_fallback,
Expand Down Expand Up @@ -221,7 +222,7 @@ impl Badge {

let icon_y = (h - icon_size) / 2.0;
let dst = Rect::from_xywh(x_offset, icon_y, icon_size, icon_size);
canvas.draw_image_rect(img, None, dst, &Paint::default());
draw_photo(canvas, img, dst, &Paint::default());

let ratio = self.resolved_font_size(ctx) / self.badge_size.params().0;
x_offset += icon_size + 6.0 * ratio;
Expand Down
3 changes: 2 additions & 1 deletion crates/rustmotion-components/src/gif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use skia_safe::{Canvas, ColorType, ImageInfo, Paint, Rect};
use rustmotion_core::css::CssStyle;
use rustmotion_core::engine::animator::AnimatedProperties;
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::draw_photo;
use rustmotion_core::engine::renderer::gif_cache;
use rustmotion_core::schema::{ImageFit, TimelineStep};
use rustmotion_core::traits::{PaintCtx, Painter, TimingConfig};
Expand Down Expand Up @@ -228,7 +229,7 @@ impl Painter for Gif {
if let Some(img) = skia_safe::images::raster_from_data(&img_info, data, row_bytes) {
let dst = Rect::from_xywh(0.0, 0.0, layout.width, layout.height);
let paint = Paint::default();
canvas.draw_image_rect(img, None, dst, &paint);
draw_photo(canvas, img, dst, &paint);
}
}
}
Expand Down
12 changes: 3 additions & 9 deletions crates/rustmotion-components/src/icon.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use skia_safe::{Canvas, ColorType, ImageInfo, Paint, Rect, SamplingOptions};
use skia_safe::{Canvas, ColorType, ImageInfo, Paint, Rect};

use rustmotion_core::css::CssStyle;
use rustmotion_core::engine::animator::AnimatedProperties;
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::{asset_cache, fetch_icon_svg, icon_cache_key};
use rustmotion_core::engine::renderer::{asset_cache, draw_photo, fetch_icon_svg, icon_cache_key};
use rustmotion_core::schema::TimelineStep;
use rustmotion_core::traits::{PaintCtx, Painter, TimingConfig};

Expand Down Expand Up @@ -91,13 +91,7 @@ impl Painter for Icon {

let dst = Rect::from_xywh(0.0, 0.0, layout.width, layout.height);
let paint = Paint::default();
canvas.draw_image_rect_with_sampling_options(
img,
None,
dst,
SamplingOptions::from(skia_safe::CubicResampler::mitchell()),
&paint,
);
draw_photo(canvas, img, dst, &paint);
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/rustmotion-components/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use skia_safe::{Canvas, Paint, Rect};
use rustmotion_core::css::CssStyle;
use rustmotion_core::engine::animator::AnimatedProperties;
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::asset_cache;
use rustmotion_core::engine::renderer::{asset_cache, draw_photo};
use rustmotion_core::schema::{ImageFit, TimelineStep};
use rustmotion_core::traits::{PaintCtx, Painter, TimingConfig};

Expand Down Expand Up @@ -84,10 +84,10 @@ impl Painter for Image {
skia_safe::ClipOp::Intersect,
true,
);
canvas.draw_image_rect(img, None, dst, &paint);
draw_photo(canvas, img, dst, &paint);
canvas.restore();
} else {
canvas.draw_image_rect(img, None, dst, &paint);
draw_photo(canvas, img, dst, &paint);
}
}
}
3 changes: 2 additions & 1 deletion crates/rustmotion-components/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use skia_safe::{Canvas, ColorType, ImageInfo, Paint, PaintStyle, Rect};

use rustmotion_core::engine::animator::AnimatedProperties;
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::draw_photo;
use rustmotion_core::engine::renderer::{
asset_cache, draw_text_with_fallback, emoji_typeface, fetch_icon_svg, paint_from_hex,
subpixel_font, typeface_with_fallback,
Expand Down Expand Up @@ -154,7 +155,7 @@ impl List {
};

let dst = Rect::from_xywh(x, y, self.icon_size, self.icon_size);
canvas.draw_image_rect(img, None, dst, &Paint::default());
draw_photo(canvas, img, dst, &Paint::default());
Ok(())
}
}
Expand Down
7 changes: 4 additions & 3 deletions crates/rustmotion-components/src/lottie.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustmotion_core::css::CssStyle;
use rustmotion_core::engine::animator::AnimatedProperties;
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::asset_cache;
use rustmotion_core::engine::renderer::{asset_cache, draw_photo};
use rustmotion_core::error::{Result, RustmotionError};
use rustmotion_core::schema::TimelineStep;
use rustmotion_core::traits::{PaintCtx, Painter, TimingConfig};
Expand Down Expand Up @@ -128,6 +128,7 @@ mod native {
use std::sync::{Arc, OnceLock};

use dashmap::DashMap;
use rustmotion_core::engine::renderer::draw_photo;

const CACHE_MAX_ENTRIES: usize = 128;

Expand Down Expand Up @@ -363,7 +364,7 @@ mod native {

let dst = skia_safe::Rect::from_xywh(0.0, 0.0, layout.width, layout.height);
let paint = skia_safe::Paint::default();
canvas.draw_image_rect(img, None, dst, &paint);
draw_photo(canvas, img, dst, &paint);
}

#[cfg(test)]
Expand Down Expand Up @@ -417,7 +418,7 @@ impl Painter for Lottie {

let dst = Rect::from_xywh(0.0, 0.0, layout.width, layout.height);
let paint = Paint::default();
canvas.draw_image_rect(img, None, dst, &paint);
draw_photo(canvas, img, dst, &paint);
return;
}

Expand Down
3 changes: 2 additions & 1 deletion crates/rustmotion-components/src/mockup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use skia_safe::{Canvas, Paint, PaintStyle, PathBuilder, RRect, Rect};

use rustmotion_core::engine::animator::AnimatedProperties;
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::draw_photo;
use rustmotion_core::engine::renderer::{asset_cache, paint_from_hex};
use rustmotion_core::error::RustmotionError;
use rustmotion_core::schema::TimelineStep;
Expand Down Expand Up @@ -151,7 +152,7 @@ impl Mockup {
canvas.save();
canvas.clip_rect(screen_rect, skia_safe::ClipOp::Intersect, true);
let dst = Rect::from_xywh(offset_x, offset_y, draw_w, draw_h);
canvas.draw_image_rect(img, None, dst, &Paint::default());
draw_photo(canvas, img, dst, &Paint::default());
canvas.restore();

Ok(())
Expand Down
3 changes: 2 additions & 1 deletion crates/rustmotion-components/src/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use skia_safe::{
use rustmotion_core::css::CssStyle;
use rustmotion_core::engine::animator::AnimatedProperties;
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::draw_photo;
use rustmotion_core::engine::renderer::{
asset_cache, draw_text_with_fallback, emoji_typeface, fetch_icon_svg,
measure_text_with_fallback, paint_from_hex, parse_hex_color, subpixel_font,
Expand Down Expand Up @@ -276,7 +277,7 @@ impl Stat {
if let Some(img) = icon_img {
let icon_y = ty - trend_fs * 0.8;
let dst = Rect::from_xywh(tx, icon_y, icon_sz as f32, icon_sz as f32);
canvas.draw_image_rect(img, None, dst, &Paint::default());
draw_photo(canvas, img, dst, &Paint::default());
tx += icon_sz as f32 + 4.0;
}
}
Expand Down
9 changes: 5 additions & 4 deletions crates/rustmotion-components/src/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use skia_safe::{
use rustmotion_core::css::CssStyle;
use rustmotion_core::engine::animator::{ease, AnimatedProperties};
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::draw_photo;
use rustmotion_core::engine::renderer::{asset_cache, interpolate_path_data};
use rustmotion_core::schema::{SvgPathMorph, TimelineStep};
use rustmotion_core::traits::{PaintCtx, Painter, TimingConfig};
Expand Down Expand Up @@ -372,7 +373,7 @@ fn paint_fill_reveal(
canvas.clip_rect(sweep, None, true);
}

canvas.draw_image_rect(full_image, None, image_dst, &paint);
draw_photo(canvas, full_image, image_dst, &paint);
canvas.restore();
}
}
Expand Down Expand Up @@ -721,7 +722,7 @@ impl Svg {
return;
};
let dst = Rect::from_xywh(0.0, 0.0, layout.width, layout.height);
canvas.draw_image_rect(img, None, dst, &Paint::default());
draw_photo(canvas, img, dst, &Paint::default());
return;
}

Expand Down Expand Up @@ -773,7 +774,7 @@ impl Svg {

let dst = Rect::from_xywh(0.0, 0.0, layout.width, layout.height);
let paint = Paint::default();
canvas.draw_image_rect(img, None, dst, &paint);
draw_photo(canvas, img, dst, &paint);
}

fn cached_full_image(&self, layout: &BoxLayout) -> Option<skia_safe::Image> {
Expand Down Expand Up @@ -896,7 +897,7 @@ impl Svg {

let dst = Rect::from_xywh(0.0, 0.0, layout.width, layout.height);
let paint = Paint::default();
canvas.draw_image_rect(img, None, dst, &paint);
draw_photo(canvas, img, dst, &paint);

let _ = svg_data;
}
Expand Down
5 changes: 3 additions & 2 deletions crates/rustmotion-components/src/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use skia_safe::{Canvas, ColorType, ImageInfo, Paint, Rect};
use rustmotion_core::css::CssStyle;
use rustmotion_core::engine::animator::AnimatedProperties;
use rustmotion_core::engine::layout_pass::BoxLayout;
use rustmotion_core::engine::renderer::draw_photo;
use rustmotion_core::engine::renderer::{
extract_video_frame, find_closest_frame, probe_video_metadata, video_frame_cache,
};
Expand Down Expand Up @@ -80,10 +81,10 @@ fn draw_fitted(canvas: &Canvas, img: skia_safe::Image, fit: &ImageFit, layout: &
skia_safe::ClipOp::Intersect,
true,
);
canvas.draw_image_rect(img, None, dst, &paint);
draw_photo(canvas, img, dst, &paint);
canvas.restore();
} else {
canvas.draw_image_rect(img, None, dst, &paint);
draw_photo(canvas, img, dst, &paint);
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/rustmotion-core/src/engine/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod colors;
mod fonts;
pub mod google_fonts;
pub use google_fonts::{remote_font_policy, set_remote_font_policy, RemoteFontPolicy};
mod photo;
mod shapes;
mod text;
mod yuv;
Expand All @@ -12,6 +13,7 @@ pub use assets::*;
pub use audio_analysis::*;
pub use colors::*;
pub use fonts::*;
pub use photo::*;
pub use shapes::*;
pub use text::*;
pub use yuv::*;
Loading
Loading