従来エンジンにもforce引数を復元
このコミットが含まれているのは:
2ファイル変更
+18
-18
検索条件に一致するファイルはありません
@@ -511,7 +511,7 @@ namespace LuaScript
|
||||
private byte[]? _resizeSource;
|
||||
private byte[]? _resizeBuffer;
|
||||
|
||||
public unsafe void FillBuffer(double r, double g, double b, double a, int x, int y, int w, int h)
|
||||
public unsafe void FillBuffer(double r, double g, double b, double a, int x, int y, int w, int h, bool force = false)
|
||||
{
|
||||
EnsurePixelBuffer();
|
||||
if (_pixelBuffer is null)
|
||||
@@ -526,7 +526,7 @@ namespace LuaScript
|
||||
if (x1 <= x0 || y1 <= y0)
|
||||
return;
|
||||
|
||||
if (PixelProcessor?.TryFill(_pixelBuffer, cw, ch, r, g, b, a, x0, y0, x1 - x0, y1 - y0) == true)
|
||||
if (PixelProcessor?.TryFill(_pixelBuffer, cw, ch, r, g, b, a, x0, y0, x1 - x0, y1 - y0, force) == true)
|
||||
{
|
||||
_isPixelsDirty = true;
|
||||
return;
|
||||
@@ -621,7 +621,7 @@ namespace LuaScript
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void Convolve(double[] kernel, int size, double divisor, double offset)
|
||||
public unsafe void Convolve(double[] kernel, int size, double divisor, double offset, bool force = false)
|
||||
{
|
||||
EnsurePixelBuffer();
|
||||
if (_pixelBuffer is null)
|
||||
@@ -629,7 +629,7 @@ namespace LuaScript
|
||||
|
||||
int cw = ImageWidth;
|
||||
int ch = ImageHeight;
|
||||
if (PixelProcessor?.TryConvolve(_pixelBuffer, cw, ch, kernel, size, divisor, offset) == true)
|
||||
if (PixelProcessor?.TryConvolve(_pixelBuffer, cw, ch, kernel, size, divisor, offset, force) == true)
|
||||
{
|
||||
_isPixelsDirty = true;
|
||||
return;
|
||||
@@ -639,7 +639,7 @@ namespace LuaScript
|
||||
PixelBufferSoftwareProcessor.Convolve(_pixelBuffer, cw, ch, kernel, size, divisor, offset, ref _convolveSource);
|
||||
}
|
||||
|
||||
public unsafe void Resize(int newWidth, int newHeight, bool linear)
|
||||
public unsafe void Resize(int newWidth, int newHeight, bool linear, bool force = false)
|
||||
{
|
||||
EnsurePixelBuffer();
|
||||
if (_pixelBuffer is null)
|
||||
@@ -650,7 +650,7 @@ namespace LuaScript
|
||||
int cw = ImageWidth;
|
||||
int ch = ImageHeight;
|
||||
|
||||
if (PixelProcessor?.TryResize(_pixelBuffer, cw, ch, newWidth, newHeight, linear, out var processed) == true && processed is not null)
|
||||
if (PixelProcessor?.TryResize(_pixelBuffer, cw, ch, newWidth, newHeight, linear, out var processed, force) == true && processed is not null)
|
||||
{
|
||||
ReplaceBuffer(processed, newWidth, newHeight);
|
||||
return;
|
||||
|
||||
@@ -187,9 +187,9 @@ namespace LuaScript
|
||||
|
||||
private void RegisterFastPrimitives(Script script)
|
||||
{
|
||||
script.Globals.Set("__fast_fill", DynValue.NewCallback((_, args) => FillCore(args)));
|
||||
script.Globals.Set("__fast_convolve", DynValue.NewCallback((_, args) => ConvolveCore(args)));
|
||||
script.Globals.Set("__fast_resize", DynValue.NewCallback((_, args) => ResizeCore(args)));
|
||||
script.Globals.Set("__fast_fill", DynValue.NewCallback((_, args) => FillCore(args, true)));
|
||||
script.Globals.Set("__fast_convolve", DynValue.NewCallback((_, args) => ConvolveCore(args, true)));
|
||||
script.Globals.Set("__fast_resize", DynValue.NewCallback((_, args) => ResizeCore(args, true)));
|
||||
}
|
||||
|
||||
private void EnsureScriptIntegrity()
|
||||
@@ -1015,9 +1015,9 @@ namespace LuaScript
|
||||
}
|
||||
|
||||
[LuaFunction("fill")]
|
||||
private DynValue Fill(CallbackArguments args) => FillCore(args);
|
||||
private DynValue Fill(CallbackArguments args) => FillCore(args, false);
|
||||
|
||||
private DynValue FillCore(CallbackArguments args)
|
||||
private DynValue FillCore(CallbackArguments args, bool force)
|
||||
{
|
||||
_activeCancellation.ThrowIfCancellationRequested();
|
||||
if (_activeContext is null)
|
||||
@@ -1033,7 +1033,7 @@ namespace LuaScript
|
||||
int w = args.Count > 6 ? (int)(args[6].CastToNumber() ?? 0d) : ctx.ImageWidth;
|
||||
int h = args.Count > 7 ? (int)(args[7].CastToNumber() ?? 0d) : ctx.ImageHeight;
|
||||
|
||||
ctx.FillBuffer(r, g, b, a, x, y, w, h);
|
||||
ctx.FillBuffer(r, g, b, a, x, y, w, h, force);
|
||||
return DynValue.Void;
|
||||
}
|
||||
|
||||
@@ -1086,9 +1086,9 @@ namespace LuaScript
|
||||
}
|
||||
|
||||
[LuaFunction("convolve")]
|
||||
private DynValue Convolve(CallbackArguments args) => ConvolveCore(args);
|
||||
private DynValue Convolve(CallbackArguments args) => ConvolveCore(args, false);
|
||||
|
||||
private DynValue ConvolveCore(CallbackArguments args)
|
||||
private DynValue ConvolveCore(CallbackArguments args, bool force)
|
||||
{
|
||||
_activeCancellation.ThrowIfCancellationRequested();
|
||||
if (_activeContext is null || args.Count < 2 || args[0].Type != DataType.Table)
|
||||
@@ -1115,14 +1115,14 @@ namespace LuaScript
|
||||
divisor = 1d;
|
||||
double offset = args.Count > 3 ? args[3].CastToNumber() ?? 0d : 0d;
|
||||
|
||||
_activeContext.Convolve(_kernelScratch, size, divisor, offset);
|
||||
_activeContext.Convolve(_kernelScratch, size, divisor, offset, force);
|
||||
return DynValue.Void;
|
||||
}
|
||||
|
||||
[LuaFunction("resize")]
|
||||
private DynValue Resize(CallbackArguments args) => ResizeCore(args);
|
||||
private DynValue Resize(CallbackArguments args) => ResizeCore(args, false);
|
||||
|
||||
private DynValue ResizeCore(CallbackArguments args)
|
||||
private DynValue ResizeCore(CallbackArguments args, bool force)
|
||||
{
|
||||
_activeCancellation.ThrowIfCancellationRequested();
|
||||
if (_activeContext is null || args.Count < 2)
|
||||
@@ -1134,7 +1134,7 @@ namespace LuaScript
|
||||
return DynValue.Void;
|
||||
|
||||
bool linear = !(args.Count > 2 && args[2].Type == DataType.String && args[2].String == "nearest");
|
||||
_activeContext.Resize(w, h, linear);
|
||||
_activeContext.Resize(w, h, linear, force);
|
||||
RefreshObjDimensions();
|
||||
return DynValue.Void;
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする