Address code-review findings across export, decode, and data model
Export correctness: - Honor the user's color-range (Limited/Full) on the software encode path: thread full_range through gpu_yuv (new shader range uniform), the CPU swscale fallback (sws_setColorspaceDetails → BT.709 + range, fixing the BT.601 hue/level shift on odd-width exports), and the encoder color tags. - Reject HDR + WebM up front with a clear message and log the forced HEVC override instead of producing an unplayable file. - Delete dead render_frame_to_rgba_hdr (hardcoded Stretch; live HDR path already honors the fit mode). Decode/playback (video.rs): - Drain the decoder at EOF (send_eof + flush) so the final B-frame-delayed frames render instead of erroring; per-frame logic extracted to a helper. - Missing-PTS frames continue monotonically rather than snapping to ts=0. - Force exact thumbnail width so sub-128px sources aren't shown stretched. Resource leaks (gpu-video-encoder): - dmabuf import_raw: RAII guard frees the duped fd + partial VkImages/memory on every error path. - vaapi alloc: free device/frames-ctx/AVFrames on the unexpected-DRM path. Data model / robustness: - collapse_boundary_spikes requires a full curve reversal (all control points) so it no longer deletes a real lens/sliver and drops the fill. - Export audio spin-wait ignores a stale `finished` flag when a forward seek is pending (was rendering silence over real audio). - RasterDiff apply_before/after take current dims and skip on a post-resize mismatch. - beam_archive read_media_full caps the preallocation from untrusted total_len. UI/visual: - SVG export skips hidden layers/empty groups; import folds fill-opacity into gradients and surfaces failures as a notification. - Active raster-layer border uses playback_time + overlay_transform. - gpu_brush remove_layer_texture also evicts the stale low-res proxy. - ensure_raster_resident_for_undo registers faulted frames in the LRU so resident RAM stays bounded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
1fa4d744be
commit
b301c63387
@@ -1302,21 +1302,26 @@ impl VectorGraph {
|
||||
/// bouncing across near-coincident duplicate edges). These are zero-area and would make
|
||||
/// `boundary_to_bezpath` render a stray hair; collapsing them yields a simple loop.
|
||||
fn collapse_boundary_spikes(&self, face: &mut Vec<(EdgeId, Direction)>) {
|
||||
let dstart = |entry: &(EdgeId, Direction)| -> Point {
|
||||
// The four control points of an entry's curve in its traversal order.
|
||||
let traversed = |entry: &(EdgeId, Direction)| -> [Point; 4] {
|
||||
let c = self.edges[entry.0.idx()].curve;
|
||||
match entry.1 {
|
||||
Direction::Forward => c.p0,
|
||||
Direction::Backward => c.p3,
|
||||
}
|
||||
};
|
||||
let dend = |entry: &(EdgeId, Direction)| -> Point {
|
||||
let c = self.edges[entry.0.idx()].curve;
|
||||
match entry.1 {
|
||||
Direction::Forward => c.p3,
|
||||
Direction::Backward => c.p0,
|
||||
Direction::Forward => [c.p0, c.p1, c.p2, c.p3],
|
||||
Direction::Backward => [c.p3, c.p2, c.p1, c.p0],
|
||||
}
|
||||
};
|
||||
const EPS: f64 = 0.5;
|
||||
// Entries i and j cancel only when j is the *exact reverse* of i — every control point of
|
||||
// j matches the mirror of i. Testing endpoints alone would also collapse a genuine
|
||||
// lens/sliver (two distinct edges that merely share near-coincident endpoints), silently
|
||||
// deleting real boundary geometry and dropping the fill.
|
||||
let reverses = |a: &(EdgeId, Direction), b: &(EdgeId, Direction)| -> bool {
|
||||
let (ca, cb) = (traversed(a), traversed(b));
|
||||
(0..4).all(|k| {
|
||||
let (p, q) = (ca[k], cb[3 - k]);
|
||||
(p.x - q.x).hypot(p.y - q.y) < EPS
|
||||
})
|
||||
};
|
||||
loop {
|
||||
let n = face.len();
|
||||
if n < 2 {
|
||||
@@ -1325,10 +1330,7 @@ impl VectorGraph {
|
||||
let mut collapsed = false;
|
||||
for i in 0..n {
|
||||
let j = (i + 1) % n;
|
||||
// entries i and j cancel when j ends back at i's start.
|
||||
let si = dstart(&face[i]);
|
||||
let ej = dend(&face[j]);
|
||||
if (si.x - ej.x).hypot(si.y - ej.y) < EPS {
|
||||
if reverses(&face[i], &face[j]) {
|
||||
let (hi, lo) = if i > j { (i, j) } else { (j, i) };
|
||||
face.remove(hi);
|
||||
face.remove(lo);
|
||||
|
||||
Reference in New Issue
Block a user