here's one way of extending the canvas. I dont think it's right. I can't test it now anyway, I'm checking it in for reference. I will probably revert it and do it another way: add a filter after the input filter but before the "emu" surface filter.
This commit is contained in:
parent
dcea6aeed1
commit
dfafee2b25
|
@ -120,6 +120,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int currEmuWidth, currEmuHeight;
|
int currEmuWidth, currEmuHeight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// additional pixels added at the unscaled level for the use of lua drawing. essentially increases the input video provider dimensions
|
||||||
|
/// </summary>
|
||||||
|
public System.Windows.Forms.Padding GameExtraPadding;
|
||||||
|
|
||||||
TextureFrugalizer VideoTextureFrugalizer;
|
TextureFrugalizer VideoTextureFrugalizer;
|
||||||
Dictionary<string, TextureFrugalizer> LuaSurfaceFrugalizers = new Dictionary<string, TextureFrugalizer>();
|
Dictionary<string, TextureFrugalizer> LuaSurfaceFrugalizers = new Dictionary<string, TextureFrugalizer>();
|
||||||
RenderTargetFrugalizer[] ShaderChainFrugalizers;
|
RenderTargetFrugalizer[] ShaderChainFrugalizers;
|
||||||
|
@ -318,6 +323,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to calculate a good client size with the given zoom factor, considering the user's DisplayManager preferences
|
/// Attempts to calculate a good client size with the given zoom factor, considering the user's DisplayManager preferences
|
||||||
|
/// TODO - this needs to be redone with a concept different from zoom factor.
|
||||||
|
/// basically, each increment of a 'zoomlike' factor should definitely increase the viewable area somehow, even if it isnt strictly by an entire zoom level.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Size CalculateClientSize(IVideoProvider videoProvider, int zoom)
|
public Size CalculateClientSize(IVideoProvider videoProvider, int zoom)
|
||||||
{
|
{
|
||||||
|
@ -339,6 +346,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
virtualHeight = Global.Config.DispCustomUserARHeight;
|
virtualHeight = Global.Config.DispCustomUserARHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bufferWidth += GameExtraPadding.Left + GameExtraPadding.Right;
|
||||||
|
virtualWidth += GameExtraPadding.Left + GameExtraPadding.Right;
|
||||||
|
bufferHeight += GameExtraPadding.Top + GameExtraPadding.Bottom;
|
||||||
|
virtualHeight += GameExtraPadding.Top + GameExtraPadding.Bottom;
|
||||||
|
|
||||||
|
|
||||||
//Console.WriteLine("DISPZOOM " + zoom); //test
|
//Console.WriteLine("DISPZOOM " + zoom); //test
|
||||||
|
|
||||||
//old stuff
|
//old stuff
|
||||||
|
@ -429,6 +443,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
chain_outsize = new Size(bufferWidth * zoom, bufferHeight * zoom);
|
chain_outsize = new Size(bufferWidth * zoom, bufferHeight * zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//add requested lua layer canvas extension
|
||||||
|
|
||||||
var job = new JobInfo
|
var job = new JobInfo
|
||||||
{
|
{
|
||||||
videoProvider = fvp,
|
videoProvider = fvp,
|
||||||
|
@ -477,11 +493,18 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//vw += GameExtraPadding.Left + GameExtraPadding.Right;
|
||||||
|
//vh += GameExtraPadding.Top + GameExtraPadding.Bottom;
|
||||||
|
|
||||||
int[] videoBuffer = videoProvider.GetVideoBuffer();
|
int[] videoBuffer = videoProvider.GetVideoBuffer();
|
||||||
|
|
||||||
TESTEROO:
|
TESTEROO:
|
||||||
int bufferWidth = videoProvider.BufferWidth;
|
int bufferWidth = videoProvider.BufferWidth;
|
||||||
int bufferHeight = videoProvider.BufferHeight;
|
int bufferHeight = videoProvider.BufferHeight;
|
||||||
|
|
||||||
|
//bufferWidth += GameExtraPadding.Left + GameExtraPadding.Right;
|
||||||
|
//bufferHeight += GameExtraPadding.Top + GameExtraPadding.Bottom;
|
||||||
|
|
||||||
bool isGlTextureId = videoBuffer.Length == 1;
|
bool isGlTextureId = videoBuffer.Length == 1;
|
||||||
|
|
||||||
//TODO - need to do some work here for GDI+ to repair gl texture ID importing
|
//TODO - need to do some work here for GDI+ to repair gl texture ID importing
|
||||||
|
@ -543,6 +566,7 @@ TESTEROO:
|
||||||
|
|
||||||
//setup the final presentation filter
|
//setup the final presentation filter
|
||||||
Filters.FinalPresentation fPresent = filterProgram["presentation"] as Filters.FinalPresentation;
|
Filters.FinalPresentation fPresent = filterProgram["presentation"] as Filters.FinalPresentation;
|
||||||
|
fPresent.InputPadding = GameExtraPadding;
|
||||||
fPresent.VirtualTextureSize = new Size(vw, vh);
|
fPresent.VirtualTextureSize = new Size(vw, vh);
|
||||||
fPresent.TextureSize = new Size(bufferWidth, bufferHeight);
|
fPresent.TextureSize = new Size(bufferWidth, bufferHeight);
|
||||||
fPresent.BackgroundColor = videoProvider.BackgroundColor;
|
fPresent.BackgroundColor = videoProvider.BackgroundColor;
|
||||||
|
|
|
@ -35,13 +35,24 @@ namespace BizHawk.Client.EmuHawk.Filters
|
||||||
public float WidthScale, HeightScale;
|
public float WidthScale, HeightScale;
|
||||||
|
|
||||||
//do maths on the viewport and the native resolution and the user settings to get a display rectangle
|
//do maths on the viewport and the native resolution and the user settings to get a display rectangle
|
||||||
public LetterboxingLogic(bool maintainAspect, bool maintainInteger, int targetWidth, int targetHeight, int sourceWidth, int sourceHeight, Size textureSize, Size virtualSize)
|
public LetterboxingLogic(System.Windows.Forms.Padding inputPadding, bool maintainAspect, bool maintainInteger, int targetWidth, int targetHeight, int sourceWidth, int sourceHeight, Size textureSize, Size virtualSize)
|
||||||
{
|
{
|
||||||
|
//when using inputPadding, the output will already be sized to accept it. the inptu size will be untouched.
|
||||||
|
//heres how we handle it:
|
||||||
|
//1. pretend the input is larger
|
||||||
|
int padw = inputPadding.Left + inputPadding.Right;
|
||||||
|
int padh = inputPadding.Top + inputPadding.Bottom;
|
||||||
|
|
||||||
int textureWidth = textureSize.Width;
|
int textureWidth = textureSize.Width;
|
||||||
int textureHeight = textureSize.Height;
|
int textureHeight = textureSize.Height;
|
||||||
int virtualWidth = virtualSize.Width;
|
int virtualWidth = virtualSize.Width;
|
||||||
int virtualHeight = virtualSize.Height;
|
int virtualHeight = virtualSize.Height;
|
||||||
|
|
||||||
|
textureWidth += padw;
|
||||||
|
textureHeight += padh;
|
||||||
|
virtualWidth += padw;
|
||||||
|
virtualHeight += padh;
|
||||||
|
|
||||||
//zero 02-jun-2014 - we passed these in, but ignored them. kind of weird..
|
//zero 02-jun-2014 - we passed these in, but ignored them. kind of weird..
|
||||||
int oldSourceWidth = sourceWidth;
|
int oldSourceWidth = sourceWidth;
|
||||||
int oldSourceHeight = sourceHeight;
|
int oldSourceHeight = sourceHeight;
|
||||||
|
@ -128,13 +139,16 @@ namespace BizHawk.Client.EmuHawk.Filters
|
||||||
PS = trials[bestIndex];
|
PS = trials[bestIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
vw = (int)(PS.X * textureWidth);
|
//accomodate padding here to keep pixel precision
|
||||||
vh = (int)(PS.Y * textureHeight);
|
vw = (int)(PS.X * (textureWidth-padw));
|
||||||
|
vh = (int)(PS.Y * (textureHeight-padh));
|
||||||
widthScale = PS.X;
|
widthScale = PS.X;
|
||||||
heightScale = PS.Y;
|
heightScale = PS.Y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
widthScale /= (sourceWidth / (float)(sourceWidth - padw));
|
||||||
|
heightScale /= (sourceHeight / (float)(sourceHeight - padh));
|
||||||
vw = (int)(widthScale * sourceWidth);
|
vw = (int)(widthScale * sourceWidth);
|
||||||
vh = (int)(heightScale * sourceHeight);
|
vh = (int)(heightScale * sourceHeight);
|
||||||
}
|
}
|
||||||
|
@ -150,6 +164,13 @@ namespace BizHawk.Client.EmuHawk.Filters
|
||||||
//HeightScale = heightScale;
|
//HeightScale = heightScale;
|
||||||
WidthScale = (float)vw / oldSourceWidth;
|
WidthScale = (float)vw / oldSourceWidth;
|
||||||
HeightScale = (float)vh / oldSourceHeight;
|
HeightScale = (float)vh / oldSourceHeight;
|
||||||
|
|
||||||
|
//now add the padding, as best we can.
|
||||||
|
//it's a little hard because: ...
|
||||||
|
//vx += (int)(inputPadding.Left * WidthScale);
|
||||||
|
//vy += (int)(inputPadding.Top * HeightScale);
|
||||||
|
//vx += inputPadding.Left;
|
||||||
|
//vy += inputPadding.Top;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -178,6 +199,11 @@ namespace BizHawk.Client.EmuHawk.Filters
|
||||||
LetterboxingLogic LL;
|
LetterboxingLogic LL;
|
||||||
Size ContentSize;
|
Size ContentSize;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// How much should padding should be added to the input (for canvas extension)
|
||||||
|
/// </summary>
|
||||||
|
public System.Windows.Forms.Padding InputPadding;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
DeclareInput();
|
DeclareInput();
|
||||||
|
@ -200,7 +226,7 @@ namespace BizHawk.Client.EmuHawk.Filters
|
||||||
if (FilterOption != eFilterOption.Bicubic)
|
if (FilterOption != eFilterOption.Bicubic)
|
||||||
return size;
|
return size;
|
||||||
|
|
||||||
LL = new LetterboxingLogic(Global.Config.DispFixAspectRatio, Global.Config.DispFixScaleInteger, OutputSize.Width, OutputSize.Height, size.Width, size.Height, TextureSize, VirtualTextureSize);
|
LL = new LetterboxingLogic(InputPadding, Global.Config.DispFixAspectRatio, Global.Config.DispFixScaleInteger, OutputSize.Width, OutputSize.Height, size.Width, size.Height, TextureSize, VirtualTextureSize);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +249,7 @@ namespace BizHawk.Client.EmuHawk.Filters
|
||||||
FindInput().SurfaceDisposition = SurfaceDisposition.Texture;
|
FindInput().SurfaceDisposition = SurfaceDisposition.Texture;
|
||||||
DeclareOutput(new SurfaceState(new SurfaceFormat(OutputSize), SurfaceDisposition.RenderTarget));
|
DeclareOutput(new SurfaceState(new SurfaceFormat(OutputSize), SurfaceDisposition.RenderTarget));
|
||||||
InputSize = state.SurfaceFormat.Size;
|
InputSize = state.SurfaceFormat.Size;
|
||||||
LL = new LetterboxingLogic(Global.Config.DispFixAspectRatio, Global.Config.DispFixScaleInteger, OutputSize.Width, OutputSize.Height, InputSize.Width, InputSize.Height, TextureSize, VirtualTextureSize);
|
LL = new LetterboxingLogic(InputPadding, Global.Config.DispFixAspectRatio, Global.Config.DispFixScaleInteger, OutputSize.Width, OutputSize.Height, InputSize.Width, InputSize.Height, TextureSize, VirtualTextureSize);
|
||||||
ContentSize = new Size(LL.vw,LL.vh);
|
ContentSize = new Size(LL.vw,LL.vh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue