mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-23 01:36:57 -08:00
feature: add supports for .webp
image format (#421)
This commit is contained in:
parent
3d57398d15
commit
a573436b67
3 changed files with 8 additions and 7 deletions
|
@ -536,7 +536,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
private static readonly HashSet<string> IMG_EXTS = new HashSet<string>()
|
private static readonly HashSet<string> IMG_EXTS = new HashSet<string>()
|
||||||
{
|
{
|
||||||
".ico", ".bmp", ".jpg", ".png", ".jpeg"
|
".ico", ".bmp", ".jpg", ".png", ".jpeg", ".webp"
|
||||||
};
|
};
|
||||||
|
|
||||||
private Repository _repo = null;
|
private Repository _repo = null;
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace SourceGit.ViewModels
|
||||||
else if (latest.IsBinary)
|
else if (latest.IsBinary)
|
||||||
{
|
{
|
||||||
var oldPath = string.IsNullOrEmpty(_option.OrgPath) ? _option.Path : _option.OrgPath;
|
var oldPath = string.IsNullOrEmpty(_option.OrgPath) ? _option.Path : _option.OrgPath;
|
||||||
var ext = Path.GetExtension(oldPath);
|
var ext = Path.GetExtension(_option.Path);
|
||||||
|
|
||||||
if (IMG_EXTS.Contains(ext))
|
if (IMG_EXTS.Contains(ext))
|
||||||
{
|
{
|
||||||
|
@ -147,13 +147,14 @@ namespace SourceGit.ViewModels
|
||||||
if (_option.Revisions.Count == 2)
|
if (_option.Revisions.Count == 2)
|
||||||
{
|
{
|
||||||
(imgDiff.Old, imgDiff.OldFileSize) = BitmapFromRevisionFile(_repo, _option.Revisions[0], oldPath);
|
(imgDiff.Old, imgDiff.OldFileSize) = BitmapFromRevisionFile(_repo, _option.Revisions[0], oldPath);
|
||||||
(imgDiff.New, imgDiff.NewFileSize) = BitmapFromRevisionFile(_repo, _option.Revisions[1], oldPath);
|
(imgDiff.New, imgDiff.NewFileSize) = BitmapFromRevisionFile(_repo, _option.Revisions[1], _option.Path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var fullPath = Path.Combine(_repo, _option.Path);
|
if (!oldPath.Equals("/dev/null", StringComparison.Ordinal))
|
||||||
(imgDiff.Old, imgDiff.OldFileSize) = BitmapFromRevisionFile(_repo, "HEAD", oldPath);
|
(imgDiff.Old, imgDiff.OldFileSize) = BitmapFromRevisionFile(_repo, "HEAD", oldPath);
|
||||||
|
|
||||||
|
var fullPath = Path.Combine(_repo, _option.Path);
|
||||||
if (File.Exists(fullPath))
|
if (File.Exists(fullPath))
|
||||||
{
|
{
|
||||||
imgDiff.New = new Bitmap(fullPath);
|
imgDiff.New = new Bitmap(fullPath);
|
||||||
|
@ -226,7 +227,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
private static readonly HashSet<string> IMG_EXTS = new HashSet<string>()
|
private static readonly HashSet<string> IMG_EXTS = new HashSet<string>()
|
||||||
{
|
{
|
||||||
".ico", ".bmp", ".jpg", ".png", ".jpeg"
|
".ico", ".bmp", ".jpg", ".png", ".jpeg", ".webp"
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly string _repo;
|
private readonly string _repo;
|
||||||
|
|
|
@ -186,7 +186,7 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
private static readonly HashSet<string> IMG_EXTS = new HashSet<string>()
|
private static readonly HashSet<string> IMG_EXTS = new HashSet<string>()
|
||||||
{
|
{
|
||||||
".ico", ".bmp", ".jpg", ".png", ".jpeg"
|
".ico", ".bmp", ".jpg", ".png", ".jpeg", ".webp"
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly Repository _repo = null;
|
private readonly Repository _repo = null;
|
||||||
|
|
Loading…
Reference in a new issue