chore(release): v0.1.4 - 1:1 SyncLyrics, scroll isolation, object-fit cover, Concerts icon, friends' likes & duplicate-title albums
This commit is contained in:
parent
0b2561503f
commit
f063382410
21 changed files with 1287 additions and 288 deletions
|
|
@ -374,7 +374,32 @@ pub fn draw_plus_badge(
|
|||
(resp, rect)
|
||||
}
|
||||
|
||||
/// Draw cover artwork with SDF rounded-rect / circular clip:
|
||||
/// Compute exact CSS `object-fit: cover` UV sub-rect so images never stretch when
|
||||
/// `(tex_w / tex_h)` differs from `dst.w / dst.h`.
|
||||
/// Uses `focal_y` (e.g. `0.35`) when cropping vertically so portrait faces/heads stay framed,
|
||||
/// and `0.5` when cropping horizontally.
|
||||
#[inline]
|
||||
pub fn cover_fit_uv(tex_w: u32, tex_h: u32, dst: Rect, focal_y: f32) -> Rect {
|
||||
if tex_w == 0 || tex_h == 0 || dst.w <= 0.0 || dst.h <= 0.0 {
|
||||
return Rect::UNIT_UV;
|
||||
}
|
||||
let tex_ar = tex_w as f32 / tex_h as f32;
|
||||
let dst_ar = dst.w / dst.h;
|
||||
if (tex_ar - dst_ar).abs() < 0.015 {
|
||||
return Rect::UNIT_UV;
|
||||
}
|
||||
if tex_ar > dst_ar {
|
||||
let uw = (dst_ar / tex_ar).clamp(0.01, 1.0);
|
||||
let u = (1.0 - uw) * 0.5;
|
||||
Rect::from_xywh(u, 0.0, uw, 1.0)
|
||||
} else {
|
||||
let vh = (tex_ar / dst_ar).clamp(0.01, 1.0);
|
||||
let v = (1.0 - vh) * focal_y.clamp(0.0, 1.0);
|
||||
Rect::from_xywh(0.0, v, 1.0, vh)
|
||||
}
|
||||
}
|
||||
|
||||
/// Draw cover artwork with SDF rounded-rect / circular clip and CSS `object-fit: cover` UV crop:
|
||||
/// - When `special_likes == true`: exact crimson vignette `#8D0F10 -> #59090A` + centered official `heart.png`
|
||||
/// with SDF rounded-rect clip (ZERO `+9.5%` y-shift bug!). If a real CDN cover URI is loaded, uses it.
|
||||
/// - Otherwise: renders real fetched cover texture with SDF rounded/circle clip, or theme-aware neutral placeholder.
|
||||
|
|
@ -399,9 +424,10 @@ pub fn draw_cover_art(
|
|||
if special_likes {
|
||||
// Prefer real CDN cover if provided & already loaded
|
||||
if let Some(u) = uri {
|
||||
let px = rect.width().ceil() as u32;
|
||||
if let Some((tex_id, dom, hue)) = covers.get_or_fetch(u, px) {
|
||||
ctx.dl().push_image(rect, tex_id, cr, Color::WHITE);
|
||||
let px = rect.width().max(rect.height()).ceil() as u32;
|
||||
if let Some((tex_id, dom, hue, tw, th)) = covers.get_or_fetch_with_size(u, px) {
|
||||
let uv = cover_fit_uv(tw, th, rect, 0.35);
|
||||
ctx.dl().push_image_uv(rect, tex_id, uv, cr, Color::WHITE);
|
||||
return (dom, hue);
|
||||
}
|
||||
}
|
||||
|
|
@ -428,9 +454,10 @@ pub fn draw_cover_art(
|
|||
}
|
||||
|
||||
if let Some(u) = uri {
|
||||
let px = rect.width().ceil() as u32;
|
||||
if let Some((tex_id, dom, hue)) = covers.get_or_fetch(u, px) {
|
||||
ctx.dl().push_image(rect, tex_id, cr, Color::WHITE);
|
||||
let px = rect.width().max(rect.height()).ceil() as u32;
|
||||
if let Some((tex_id, dom, hue, tw, th)) = covers.get_or_fetch_with_size(u, px) {
|
||||
let uv = cover_fit_uv(tw, th, rect, 0.35);
|
||||
ctx.dl().push_image_uv(rect, tex_id, uv, cr, Color::WHITE);
|
||||
return (dom, hue);
|
||||
}
|
||||
}
|
||||
|
|
@ -1101,8 +1128,9 @@ pub fn stacked_mix_card(
|
|||
let card_r = Rect::from_xywh(plate_x, plate_y + 8.0, plate_w, plate_w);
|
||||
let mut drew_tex = false;
|
||||
if let Some(u) = cover_uri {
|
||||
if let Some((tex_id, _, _)) = covers.get_or_fetch(u, 200) {
|
||||
ctx.dl().push_image(card_r, tex_id, 6.0, Color::WHITE);
|
||||
if let Some((tex_id, _, _, tw, th)) = covers.get_or_fetch_with_size(u, 200) {
|
||||
let uv = cover_fit_uv(tw, th, card_r, 0.35);
|
||||
ctx.dl().push_image_uv(card_r, tex_id, uv, 6.0, Color::WHITE);
|
||||
drew_tex = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1181,8 +1209,9 @@ pub fn artist_promo_card(
|
|||
// 1. Full-bleed artist photo (or theme-aware gradient placeholder)
|
||||
let mut has_photo = false;
|
||||
if let Some(u) = artist_photo_uri {
|
||||
if let Some((tex_id, _, _)) = covers.get_or_fetch(u, 400) {
|
||||
ctx.dl().push_image(img_r, tex_id, 8.0, Color::WHITE);
|
||||
if let Some((tex_id, _, _, tw, th)) = covers.get_or_fetch_with_size(u, 400) {
|
||||
let uv = cover_fit_uv(tw, th, img_r, 0.35);
|
||||
ctx.dl().push_image_uv(img_r, tex_id, uv, 8.0, Color::WHITE);
|
||||
has_photo = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue