CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout and the system SQLite. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow; the throw-away server runs without durability) and pe-check. - Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR, 3 on the shared runner; the weekly performance gates keep theirs). BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
86 lines
3.3 KiB
C#
86 lines
3.3 KiB
C#
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using Chronos.Core.Diagnostics;
|
|
using Chronos.Core.Imaging;
|
|
using Chronos.Ui.Visuals;
|
|
|
|
namespace Chronos.App.Editor;
|
|
|
|
/// <summary>Linear-light frames as frozen sRGB bitmaps the UI thread can show (created on any thread).</summary>
|
|
public static class EditorImages
|
|
{
|
|
public static BitmapSource ToBitmap(ImageBuffer image)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(image);
|
|
var channels = int.Min(3, image.Channels);
|
|
var pixels = PixelConvert.ToInterleaved8(image, channels);
|
|
var format = channels == 1 ? PixelFormats.Gray8 : PixelFormats.Rgb24;
|
|
var bitmap = BitmapSource.Create(image.Width, image.Height, 96, 96, format, null, pixels, image.Width * channels);
|
|
bitmap.Freeze();
|
|
return bitmap;
|
|
}
|
|
|
|
/// <summary>A waveform as an opacity mask (white, alpha = density) so the view paints it in a theme brush.</summary>
|
|
public static BitmapSource ToMask(LumaWaveform waveform)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(waveform);
|
|
var pixels = new byte[waveform.Density.Length * 4];
|
|
for (var i = 0; i < waveform.Density.Length; i++)
|
|
{
|
|
var alpha = waveform.Density[i];
|
|
pixels[4 * i] = pixels[4 * i + 1] = pixels[4 * i + 2] = pixels[4 * i + 3] = alpha;
|
|
}
|
|
var bitmap = BitmapSource.Create(waveform.Columns, waveform.Rows, 96, 96, PixelFormats.Pbgra32, null, pixels, waveform.Columns * 4);
|
|
bitmap.Freeze();
|
|
return bitmap;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Filmstrip thumbnails decoded through the editor's <see cref="ISequenceSource"/> (embedded previews when large
|
|
/// enough), at most a few at a time so scrolling the strip never floods the decoders.
|
|
/// </summary>
|
|
public sealed class EditorThumbnails(ISequenceSource source, int count) : IThumbnailSource
|
|
{
|
|
private readonly SemaphoreSlim _decoders = new(int.Clamp(Environment.ProcessorCount / 2, 2, 6));
|
|
private int _pending;
|
|
|
|
public int Count { get; } = count;
|
|
|
|
/// <summary>Thumbnails requested and not yet returned (capture and tests wait for them).</summary>
|
|
public int Pending => Volatile.Read(ref _pending);
|
|
|
|
public async ValueTask<ImageSource?> GetAsync(int index, int pixelWidth, CancellationToken cancellationToken)
|
|
{
|
|
Interlocked.Increment(ref _pending);
|
|
try
|
|
{
|
|
return await DecodeAsync(index, pixelWidth, cancellationToken);
|
|
}
|
|
finally
|
|
{
|
|
Interlocked.Decrement(ref _pending);
|
|
}
|
|
}
|
|
|
|
private async Task<ImageSource?> DecodeAsync(int index, int pixelWidth, CancellationToken cancellationToken)
|
|
{
|
|
await _decoders.WaitAsync(cancellationToken);
|
|
try
|
|
{
|
|
// Long edge for frames up to 16:9 tall or wide; the cache rounds requests, so nearby widths share a decode.
|
|
using var frame = await source.DecodeAsync(index, int.Clamp(pixelWidth, 32, 512), DecodePurpose.Thumbnail, cancellationToken);
|
|
return frame is null ? null : EditorImages.ToBitmap(frame);
|
|
}
|
|
catch (Exception ex) when (ex is not OperationCanceledException)
|
|
{
|
|
Log.Debug("editor", $"No thumbnail for frame {index}: {ex.Message}");
|
|
return null;
|
|
}
|
|
finally
|
|
{
|
|
_decoders.Release();
|
|
}
|
|
}
|
|
}
|