feat: Files app - add Trash

This commit is contained in:
daniel committed 2026-10-24 08:20:18 +02:00
1 parent e047c1e0c0
commit 07191b1286
15 files changed
+1044 -150

No files matched your search

+32
View File
@@ -1241,6 +1241,37 @@ inline void svg_parse_css_table(const char* style_data, int style_len, SvgCssTab
}
}
// Parse a functional color "rgb(r, g, b)": each channel is 0-255 or a
// percentage, decimals allowed (e.g. "rgb(90.196%,90.196%,90.196%)").
// Returns false if s is not a well-formed rgb() value.
inline bool svg_parse_rgb_color(const char* s, Color* out) {
if (!svg_strncmp(s, "rgb(", 4)) return false;
s += 4;
int channel[3];
for (int i = 0; i < 3; i++) {
while (svg_char_is_ws(*s)) ++s;
fixed_t value = 0;
int consumed = svg_parse_fixed(s, &value);
if (consumed <= 0) return false;
s += consumed;
while (svg_char_is_ws(*s)) ++s;
int64_t scaled = value;
if (*s == '%') {
scaled = scaled * 255 / 100;
++s;
}
int v = (int)((scaled + (1 << 15)) >> 16);
channel[i] = v < 0 ? 0 : v > 255 ? 255 : v;
while (svg_char_is_ws(*s)) ++s;
if (i < 2) {
if (*s != ',') return false;
++s;
}
}
*out = Color::from_rgb((uint8_t)channel[0], (uint8_t)channel[1], (uint8_t)channel[2]);
return true;
}
// ---------------------------------------------------------------------------
// Resolve a fill value that might be url(#id) against gradient table
// Returns: 1 = resolved, 0 = not a url() ref, -1 = fill="none"
@@ -1248,6 +1279,7 @@ inline void svg_parse_css_table(const char* style_data, int style_len, SvgCssTab
inline int svg_resolve_fill_value(const char* val, Color* out_color, const SvgGradientTable* grads) {
if (svg_strncmp(val, "none", 4)) return -1;
if (*val == '#') { *out_color = svg_parse_hex_color(val); return 1; }
if (svg_parse_rgb_color(val, out_color)) return 1;
if (grads && svg_strncmp(val, "url(#", 5)) {
// Extract id from url(#id)
const char* id_start = val + 5;