aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-07-05 08:43:35 -0400
committerMichael <[email protected]>2017-07-05 08:43:35 -0400
commit4f41f51267e04d752d3d438f70f06a7a37975f5d (patch)
tree22036cb834d9915d44c527da55adfdab58a3d529 /ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs
parent2adb8859edb95921e8f6d3cbb41fdc349825d6f8 (diff)
downloadshiftos_thereturn-4f41f51267e04d752d3d438f70f06a7a37975f5d.tar.gz
shiftos_thereturn-4f41f51267e04d752d3d438f70f06a7a37975f5d.tar.bz2
shiftos_thereturn-4f41f51267e04d752d3d438f70f06a7a37975f5d.zip
HEAVILY optimize skins
Diffstat (limited to 'ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs')
-rw-r--r--ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs
index 173a024..43292c0 100644
--- a/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs
+++ b/ShiftOS.Frontend/GraphicsSubsystem/GraphicsContext.cs
@@ -89,7 +89,7 @@ namespace ShiftOS.Frontend.GraphicsSubsystem
public void Clear(Color c)
{
- DrawRectangle(_startx, _starty, _maxwidth, _maxheight, c);
+ DrawRectangle(0, 0, _maxwidth, _maxheight, c);
}
public void DrawLine(int x, int y, int x1, int y1, int thickness, Texture2D tex2)
@@ -152,7 +152,13 @@ namespace ShiftOS.Frontend.GraphicsSubsystem
{
using(var gfx = System.Drawing.Graphics.FromImage(bmp))
{
- gfx.DrawString(text, font, new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B)), 0, 0);
+ var textformat = new System.Drawing.StringFormat(System.Drawing.StringFormat.GenericTypographic);
+ textformat.FormatFlags = System.Drawing.StringFormatFlags.MeasureTrailingSpaces;
+ textformat.Trimming = System.Drawing.StringTrimming.None;
+ textformat.FormatFlags |= System.Drawing.StringFormatFlags.NoClip;
+
+ gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
+ gfx.DrawString(text, font, new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B)), 0, 0, textformat);
}
var lck = bmp.LockBits(new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
var data = new byte[Math.Abs(lck.Stride) * lck.Height];