diff --git a/Bizware/BizHawk.Bizware.BizwareGL.GdiPlus/GdiPlusGuiRenderer.cs b/Bizware/BizHawk.Bizware.BizwareGL.GdiPlus/GdiPlusGuiRenderer.cs index 06ed24b922..c1ee8d0644 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL.GdiPlus/GdiPlusGuiRenderer.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL.GdiPlus/GdiPlusGuiRenderer.cs @@ -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 ? ? } diff --git a/Bizware/BizHawk.Bizware.BizwareGL/Art.cs b/Bizware/BizHawk.Bizware.BizwareGL/Art.cs index 5992872e23..13db7e68a6 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/Art.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/Art.cs @@ -5,6 +5,16 @@ namespace BizHawk.Bizware.BizwareGL /// 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; diff --git a/Bizware/BizHawk.Bizware.BizwareGL/GuiRenderer.cs b/Bizware/BizHawk.Bizware.BizwareGL/GuiRenderer.cs index 9ecf4b5e5d..d4b25aac90 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/GuiRenderer.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/GuiRenderer.cs @@ -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;