Prevent LoadGlyph from thrashing the PixelStore attribute.

This commit is contained in:
the_fiddler 2008-11-19 18:00:28 +00:00
parent ebc25d1660
commit dbfe063aee

View file

@ -418,12 +418,22 @@ using System.Text.RegularExpressions;
BitmapData bitmap_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, BitmapData bitmap_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly,
System.Drawing.Imaging.PixelFormat.Format32bppArgb); System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.PushClientAttrib(ClientAttribMask.ClientPixelStoreBit);
try
{
GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1.0f); GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1.0f);
GL.PixelStore(PixelStoreParameter.UnpackRowLength, bmp.Width); GL.PixelStore(PixelStoreParameter.UnpackRowLength, bmp.Width);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, (int)rect.Left, (int)rect.Top, GL.TexSubImage2D(TextureTarget.Texture2D, 0, (int)rect.Left, (int)rect.Top,
rect.Width, rect.Height, rect.Width, rect.Height,
OpenTK.Graphics.PixelFormat.Rgba, OpenTK.Graphics.PixelFormat.Rgba,
PixelType.UnsignedByte, bitmap_data.Scan0); PixelType.UnsignedByte, bitmap_data.Scan0);
}
finally
{
GL.PopClientAttrib();
}
bmp.UnlockBits(bitmap_data); bmp.UnlockBits(bitmap_data);
rectangle = RectangleF.FromLTRB( rectangle = RectangleF.FromLTRB(