add some little fragments i meant for the user display cropping stuff but didnt use

This commit is contained in:
zeromus 2019-01-18 00:59:23 -05:00
parent 65ce3abaa9
commit ca9385c3c8
3 changed files with 29 additions and 2 deletions

View File

@ -240,7 +240,17 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.GdiPlus
g.Transform = new sd.Drawing2D.Matrix(mat.M11, mat.M12, mat.M21, mat.M22, mat.M41, mat.M42);
}
unsafe void DrawInternal(Art art, float x, float y, float w, float h)
{
DrawInternal(art.BaseTexture, x, y, w, h, art.u0, art.v0, art.u1, art.v1);
}
unsafe void DrawInternal(Texture2d tex, float x, float y, float w, float h)
{
DrawInternal(tex, x, y, w, h, 0, 0, 1, 1);
}
unsafe void DrawInternal(Texture2d tex, float x, float y, float w, float h, float u0, float v0, float u1, float v1)
{
var g = Gdi.GetCurrentGraphics();
PrepDraw(g, tex);
@ -253,9 +263,16 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.GdiPlus
new sd.PointF(x,y+h),
};
float sx = tex.Width * u0;
float sy = tex.Height * v0;
float sx2 = tex.Width * u1;
float sy2 = tex.Height * v1;
float sw = sx2 - sx;
float sh = sy2 - sy;
var tw = tex.Opaque as IGL_GdiPlus.TextureWrapper;
g.PixelOffsetMode = sd.Drawing2D.PixelOffsetMode.Half;
g.DrawImage(tw.SDBitmap, destPoints, new sd.RectangleF(0, 0, tex.Width, tex.Height), sd.GraphicsUnit.Pixel, CurrentImageAttributes);
g.DrawImage(tw.SDBitmap, destPoints, new sd.RectangleF(sx, sy, sw, sh), sd.GraphicsUnit.Pixel, CurrentImageAttributes);
g.Transform = new sd.Drawing2D.Matrix(); //.Reset() doesnt work ? ?
}

View File

@ -5,6 +5,16 @@ namespace BizHawk.Bizware.BizwareGL
/// </summary>
public class Art
{
//bleh, didnt mean to have this here, but I need it now
public Art(Texture2d tex)
{
BaseTexture = tex;
u1 = 1;
v1 = 1;
Width = tex.Width;
Height = tex.Height;
}
internal Art(ArtManager owner)
{
Owner = owner;

View File

@ -224,7 +224,7 @@ namespace BizHawk.Bizware.BizwareGL
unsafe void DrawInternal(Texture2d tex, float x, float y, float w, float h)
{
Art art = new Art(null);
Art art = new Art((ArtManager)null);
art.Width = w;
art.Height = h;
art.u0 = art.v0 = 0;