mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Textures: PR #327 feedback
This commit is contained in:
parent
6c0864c8b9
commit
f54146ada4
1 changed files with 9 additions and 7 deletions
|
|
@ -249,12 +249,10 @@ public partial class CombinedTexture
|
||||||
if (sourceWidth == _targetWidth && sourceHeight == _targetHeight)
|
if (sourceWidth == _targetWidth && sourceHeight == _targetHeight)
|
||||||
return rgbaPixels;
|
return rgbaPixels;
|
||||||
|
|
||||||
byte[] resizedPixels;
|
var resizedPixels = new byte[_targetWidth * _targetHeight * 4];
|
||||||
using (var image = Image.LoadPixelData<Rgba32>(rgbaPixels, sourceWidth, sourceHeight))
|
using (var image = Image.LoadPixelData<Rgba32>(rgbaPixels, sourceWidth, sourceHeight))
|
||||||
{
|
{
|
||||||
image.Mutate(ctx => ctx.Resize(_targetWidth, _targetHeight));
|
image.Mutate(ctx => ctx.Resize(_targetWidth, _targetHeight, KnownResamplers.Lanczos3));
|
||||||
|
|
||||||
resizedPixels = new byte[_targetWidth * _targetHeight * 4];
|
|
||||||
image.CopyPixelDataTo(resizedPixels);
|
image.CopyPixelDataTo(resizedPixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -267,9 +265,13 @@ public partial class CombinedTexture
|
||||||
var combineOp = GetActualCombineOp();
|
var combineOp = GetActualCombineOp();
|
||||||
var (usesLeft, usesRight) = GetCombineOpFlags(combineOp);
|
var (usesLeft, usesRight) = GetCombineOpFlags(combineOp);
|
||||||
var resizeOp = usesLeft && usesRight ? _resizeOp : ResizeOp.None;
|
var resizeOp = usesLeft && usesRight ? _resizeOp : ResizeOp.None;
|
||||||
(_targetWidth, _targetHeight) = usesLeft && resizeOp != ResizeOp.ToRight
|
(_targetWidth, _targetHeight) = resizeOp switch
|
||||||
? (_left.TextureWrap!.Width, _left.TextureWrap!.Height)
|
{
|
||||||
: (_right.TextureWrap!.Width, _right.TextureWrap!.Height);
|
ResizeOp.ToLeft => (_left.TextureWrap!.Width, _left.TextureWrap!.Height),
|
||||||
|
ResizeOp.ToRight => (_right.TextureWrap!.Width, _right.TextureWrap!.Height),
|
||||||
|
ResizeOp.None when usesLeft => (_left.TextureWrap!.Width, _left.TextureWrap!.Height),
|
||||||
|
_ => (_right.TextureWrap!.Width, _right.TextureWrap!.Height),
|
||||||
|
};
|
||||||
_centerStorage.RgbaPixels = new byte[_targetWidth * _targetHeight * 4];
|
_centerStorage.RgbaPixels = new byte[_targetWidth * _targetHeight * 4];
|
||||||
_centerStorage.Type = TextureType.Bitmap;
|
_centerStorage.Type = TextureType.Bitmap;
|
||||||
try
|
try
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue