Move IGL_GdiPlus.RenderTargetWrapper to own file
This commit is contained in:
parent
826f9469dc
commit
984982cd9b
|
@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// <summary>
|
||||
/// the render target for rendering to this control
|
||||
/// </summary>
|
||||
public IGL_GdiPlus.RenderTargetWrapper RenderTargetWrapper;
|
||||
public RenderTargetWrapper RenderTargetWrapper;
|
||||
|
||||
public void SetVsync(bool state)
|
||||
{
|
||||
|
|
|
@ -251,59 +251,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
}
|
||||
|
||||
public class RenderTargetWrapper
|
||||
{
|
||||
public RenderTargetWrapper(IGL_GdiPlus gdi)
|
||||
{
|
||||
Gdi = gdi;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
private readonly IGL_GdiPlus Gdi;
|
||||
|
||||
/// <summary>
|
||||
/// the control associated with this render target (if any)
|
||||
/// </summary>
|
||||
public GLControlWrapper_GdiPlus Control;
|
||||
|
||||
/// <summary>
|
||||
/// the offscreen render target, if that's what this is representing
|
||||
/// </summary>
|
||||
public RenderTarget Target;
|
||||
|
||||
public BufferedGraphics MyBufferedGraphics;
|
||||
|
||||
public Graphics refGraphics; //?? hacky?
|
||||
|
||||
public void CreateGraphics()
|
||||
{
|
||||
Rectangle r;
|
||||
if (Control != null)
|
||||
{
|
||||
r = Control.ClientRectangle;
|
||||
refGraphics = Control.CreateGraphics();
|
||||
}
|
||||
else
|
||||
{
|
||||
var tw = Target.Texture2d.Opaque as GDIPTextureWrapper;
|
||||
r = Target.Texture2d.Rectangle;
|
||||
refGraphics = Graphics.FromImage(tw.SDBitmap);
|
||||
}
|
||||
|
||||
MyBufferedGraphics?.Dispose();
|
||||
MyBufferedGraphics = Gdi.MyBufferedGraphicsContext.Allocate(refGraphics, r);
|
||||
//MyBufferedGraphics.Graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighSpeed;
|
||||
|
||||
////not sure about this stuff...
|
||||
////it will wreck alpha blending, for one thing
|
||||
//MyBufferedGraphics.Graphics.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
|
||||
//MyBufferedGraphics.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
public void BeginScene()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
using System.Drawing;
|
||||
|
||||
using BizHawk.Bizware.BizwareGL;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public class RenderTargetWrapper
|
||||
{
|
||||
public RenderTargetWrapper(IGL_GdiPlus gdi)
|
||||
{
|
||||
Gdi = gdi;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
private readonly IGL_GdiPlus Gdi;
|
||||
|
||||
/// <summary>
|
||||
/// the control associated with this render target (if any)
|
||||
/// </summary>
|
||||
public GLControlWrapper_GdiPlus Control;
|
||||
|
||||
/// <summary>
|
||||
/// the offscreen render target, if that's what this is representing
|
||||
/// </summary>
|
||||
public RenderTarget Target;
|
||||
|
||||
public BufferedGraphics MyBufferedGraphics;
|
||||
|
||||
public Graphics refGraphics; //?? hacky?
|
||||
|
||||
public void CreateGraphics()
|
||||
{
|
||||
Rectangle r;
|
||||
if (Control != null)
|
||||
{
|
||||
r = Control.ClientRectangle;
|
||||
refGraphics = Control.CreateGraphics();
|
||||
}
|
||||
else
|
||||
{
|
||||
var tw = Target.Texture2d.Opaque as GDIPTextureWrapper;
|
||||
r = Target.Texture2d.Rectangle;
|
||||
refGraphics = Graphics.FromImage(tw.SDBitmap);
|
||||
}
|
||||
|
||||
MyBufferedGraphics?.Dispose();
|
||||
MyBufferedGraphics = Gdi.MyBufferedGraphicsContext.Allocate(refGraphics, r);
|
||||
// MyBufferedGraphics.Graphics.PixelOffsetMode = PixelOffsetMode.HighSpeed;
|
||||
|
||||
//not sure about this stuff...
|
||||
//it will wreck alpha blending, for one thing
|
||||
// MyBufferedGraphics.Graphics.CompositingMode = CompositingMode.SourceCopy;
|
||||
// MyBufferedGraphics.Graphics.CompositingQuality = CompositingQuality.HighSpeed;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue