Permalink
Browse files

Fixed font color being passed as signed integer to font engine.

  • Loading branch information...
1 parent 40bbf2c commit b42d4d50be693afafd0ef1d4e89be9582e77dc09 @tourettes tourettes committed Nov 12, 2012
View
8 DirectShowFilters/fontEngine/source/fontEngine.cpp
@@ -502,7 +502,7 @@ int FontEngineAddSurface(int hashCode, bool useAlphaBlend,void* surface)
}
//*******************************************************************************************************************
-void FontEngineDrawTexture(int textureNo,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, int color, float m[3][4])
+void FontEngineDrawTexture(int textureNo,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, unsigned int color, float m[3][4])
{
if (textureNo < 0 || textureNo>=MAX_TEXTURES)
return;
@@ -751,7 +751,7 @@ void FontEngineDrawTexture(int textureNo,float x, float y, float nw, float nh, f
// blendMode 1 = diffuse blending (choose D3DTOP_MODULATE)
// blendMode 2 = linear blending (choose D3DTOP_BLENDTEXTUREALPHA)
void FontEngineDrawTexture2(int textureNo1,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax,
- int color, float m[3][4],
+ unsigned int color, float m[3][4],
int textureNo2, float uoff2, float voff2, float umax2, float vmax2,
int blendMode)
{
@@ -1029,7 +1029,7 @@ void FontEngineDrawTexture2(int textureNo1,float x, float y, float nw, float nh,
//*******************************************************************************************************************
void FontEngineDrawMaskedTexture(int textureNo1, float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax,
- int color, float m[3][4],
+ unsigned int color, float m[3][4],
int textureNo2, float uoff2, float voff2, float umax2, float vmax2)
{
// textureNo1 - main image
@@ -1291,7 +1291,7 @@ void FontEngineDrawMaskedTexture(int textureNo1, float x, float y, float nw, flo
// blendMode 1 = diffuse blending (choose D3DTOP_MODULATE)
// blendMode 2 = linear blending (choose D3DTOP_BLENDTEXTUREALPHA)
void FontEngineDrawMaskedTexture2(int textureNo1,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax,
- int color, float m[3][4],
+ unsigned int color, float m[3][4],
int textureNo2, float uoff2, float voff2, float umax2, float vmax2,
int textureNo3, float uoff3, float voff3, float umax3, float vmax3,
int blendMode)
View
8 DirectShowFilters/fontEngine/source/fontEngine.h
@@ -31,10 +31,10 @@ void FontEngineInitialize(int screenWidth, int screenHeight, int poolFormat);
int FontEngineAddTexture(int hashCode, bool useAlphaBlend,void* texture);
int FontEngineAddSurface(int hashCode, bool useAlphaBlend, void* surface);
void FontEngineRemoveTexture(int textureNo);
-void FontEngineDrawTexture(int textureNo,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, int color);
-void FontEngineDrawTexture2(int textureNo1,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, int color, float m[3][4], int textureNo2, float uoff2, float voff2, float umax2, float vmax2);
-void FontEngineDrawMaskedTexture(int textureNo1,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, int color, float m[3][4], int textureNo2, float uoff2, float voff2, float umax2, float vmax2);
-void FontEngineDrawMaskedTexture2(int textureNo1,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, int color, float m[3][4], int textureNo2, float uoff2, float voff2, float umax2, float vmax2, int textureNo3, float uoff3, float voff3, float umax3, float vmax3);
+void FontEngineDrawTexture(int textureNo,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, unsigned int color);
+void FontEngineDrawTexture2(int textureNo1,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, unsigned int color, float m[3][4], int textureNo2, float uoff2, float voff2, float umax2, float vmax2);
+void FontEngineDrawMaskedTexture(int textureNo1,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, unsigned int color, float m[3][4], int textureNo2, float uoff2, float voff2, float umax2, float vmax2);
+void FontEngineDrawMaskedTexture2(int textureNo1,float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, unsigned int color, float m[3][4], int textureNo2, float uoff2, float voff2, float umax2, float vmax2, int textureNo3, float uoff3, float voff3, float umax3, float vmax3);
void FontEnginePresentTextures();
void FontEngineAddFont(void* device, int fontNumber,void* fontTexture, int firstChar, int endChar, float textureScale, float textureWidth, float textureHeight, float fSpacingPerChar,int maxVertices);
View
14 mediaportal/Core/guilib/CachedTexture.cs
@@ -49,21 +49,21 @@ public class CachedTexture : IDisposable
[DllImport("fontEngine.dll", ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)]
private static extern unsafe void FontEngineDrawTexture(int textureNo, float x, float y, float nw, float nh,
- float uoff, float voff, float umax, float vmax, int color,
+ float uoff, float voff, float umax, float vmax, uint color,
float[,] matrix);
[DllImport("fontEngine.dll", ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)]
private static extern unsafe void FontEngineDrawMaskedTexture(int textureNo1, float x, float y, float nw, float nh,
float uoff, float voff, float umax, float vmax,
- int color,
+ uint color,
float[,] matrix, int textureNo2, float uoff2,
float voff2,
float umax2, float vmax2);
[DllImport("fontEngine.dll", ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)]
private static extern unsafe void FontEngineDrawTexture2(int textureNo1, float x, float y, float nw, float nh,
float uoff, float voff, float umax, float vmax,
- int color,
+ uint color,
float[,] matrix, int textureNo2, float uoff2,
float voff2,
float umax2, float vmax2,
@@ -291,7 +291,7 @@ public int TextureNumber
/// <param name="umax"></param>
/// <param name="vmax"></param>
/// <param name="color"></param>
- public void Draw(float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, int color)
+ public void Draw(float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax, uint color)
{
//string logline=String.Format("draw:#{0} {1} {2} {3} {4}",_textureNumber,x,y,nw,nh);
//Trace.WriteLine(logline);
@@ -323,7 +323,7 @@ public void Draw(float x, float y, float nw, float nh, float uoff, float voff, f
/// <param name="vmax"></param>
/// <param name="color"></param>
public void Draw(float x, float y, float nw, float nh, float zrot, float uoff, float voff, float umax, float vmax,
- int color)
+ uint color)
{
if (_textureNumber >= 0)
{
@@ -363,7 +363,7 @@ public void Draw(float x, float y, float nw, float nh, float uoff, float voff, f
/// <param name="umaxd"></param>
/// <param name="vmaxd"></param>
public void Draw(float x, float y, float nw, float nh, float zrot, float uoff, float voff, float umax, float vmax,
- int color, int blendableTextureNo, float uoffd, float voffd, float umaxd, float vmaxd,
+ uint color, int blendableTextureNo, float uoffd, float voffd, float umaxd, float vmaxd,
GUIImage.FontEngineBlendMode blendMode)
{
if (_textureNumber >= 0)
@@ -406,7 +406,7 @@ public void Draw(float x, float y, float nw, float nh, float uoff, float voff, f
/// <param name="umaxm"></param>
/// <param name="vmaxm"></param>
public void DrawMasked(float x, float y, float nw, float nh, float uoff, float voff, float umax, float vmax,
- int color, int maskTextureNo, float uoffm, float voffm, float umaxm, float vmaxm)
+ uint color, int maskTextureNo, float uoffm, float voffm, float umaxm, float vmaxm)
{
if (_textureNumber >= 0)
{
View
8 mediaportal/Core/guilib/GUIFontManager.cs
@@ -65,7 +65,7 @@ private struct FontManagerDrawText
public Font fnt;
public float xpos;
public float ypos;
- public int color;
+ public uint color;
public string text;
public float[,] matrix;
public Viewport viewport;
@@ -364,7 +364,7 @@ public static void DrawText(Font fnt, float xpos, float ypos, Color color, strin
draw.fnt = fnt;
draw.xpos = xpos;
draw.ypos = ypos;
- draw.color = color.ToArgb();
+ draw.color = (uint)color.ToArgb();
draw.text = text;
draw.matrix = (float[,])GUIGraphicsContext.GetFinalMatrix().Clone();
draw.viewport = GUIGraphicsContext.DX9Device.Viewport;
@@ -487,7 +487,7 @@ private static void DrawTextUsingTexture(FontManagerDrawText draw, int fontSize)
_d3dxSprite.Draw(drawingTexture.texture, new Rectangle(0, 0, size.Width, size.Height),
Vector3.Empty,
- new Vector3((int)draw.xpos, (int)draw.ypos, 0), draw.color);
+ new Vector3((int)draw.xpos, (int)draw.ypos, 0), (int)draw.color);
}
public static void Present()
@@ -554,7 +554,7 @@ public static void Present()
{
draw.fnt.DrawText(_d3dxSprite, draw.text, new Rectangle((int)draw.xpos,
(int)draw.ypos, 0, 0), DrawTextFormat.NoClip,
- draw.color);
+ (int)draw.color);
}
_d3dxSprite.Flush();
View
30 mediaportal/Core/guilib/GUIImage.cs
@@ -46,28 +46,28 @@ public enum FontEngineBlendMode
[DllImport("fontEngine.dll", ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)]
private static extern unsafe void FontEngineDrawTexture(int textureNo, float x, float y, float nw, float nh,
- float uoff, float voff, float umax, float vmax, int color,
+ float uoff, float voff, float umax, float vmax, uint color,
float[,] matrix);
[DllImport("fontEngine.dll", ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)]
private static extern unsafe void FontEngineDrawTexture2(int textureNo1, float x, float y, float nw, float nh,
- float uoff, float voff, float umax, float vmax, int color,
+ float uoff, float voff, float umax, float vmax, uint color,
float[,] matrix, int textureNo2, float uoff2, float voff2,
float umax2, float vmax2,
FontEngineBlendMode blendMode);
[DllImport("fontEngine.dll", ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)]
private static extern unsafe void FontEngineDrawMaskedTexture(int textureNo1, float x, float y, float nw, float nh,
float uoff, float voff, float umax, float vmax,
- int color,
+ uint color,
float[,] matrix, int textureNo2, float uoff2,
float voff2,
float umax2, float vmax2);
[DllImport("fontEngine.dll", ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)]
private static extern unsafe void FontEngineDrawMaskedTexture2(int textureNo1, float x, float y, float nw, float nh,
float uoff, float voff, float umax, float vmax,
- int color,
+ uint color,
float[,] matrix, int textureNo2, float uoff2,
float voff2,
float umax2, float vmax2, int textureNo3, float uoff3,
@@ -1465,7 +1465,7 @@ public override void Render(float timePassed)
// Compute the number of textures to draw in the control and draw the texture.
float umax = _nw / x;
float vmax = _nh / x;
- texture.Draw(_fx, _fy, _nw, _nh, 0, 0, umax, vmax, (int)color);
+ texture.Draw(_fx, _fy, _nw, _nh, 0, 0, umax, vmax, color);
}
else
{
@@ -1492,14 +1492,14 @@ public override void Render(float timePassed)
vmaxm = _masktexVmax + _masktexVoff;
FontEngineDrawMaskedTexture(_packedTextureNo, _fx, _fy, _nw, _nh, uoff, voff, umax, vmax,
- (int)color, matrix,
+ color, matrix,
_packedMaskTextureNo, uoffm, voffm, umaxm, vmaxm);
}
}
else
{
// Default behavior, draw the image texture with no mask.
- FontEngineDrawTexture(_packedTextureNo, _fx, _fy, _nw, _nh, _uoff, _voff, _umax, _vmax, (int)color,
+ FontEngineDrawTexture(_packedTextureNo, _fx, _fy, _nw, _nh, _uoff, _voff, _umax, _vmax, color,
matrix);
}
}
@@ -1577,15 +1577,15 @@ public override void Render(float timePassed)
vmaxm = _masktexVmax + _masktexVoff;
FontEngineDrawMaskedTexture2(_packedTextureNo, fx, fy, nw, nh, uoff1, voff1, umax1, vmax1,
- (int)color, m,
+ color, m,
_packedBlendableTextureNo, _blendabletexUoffCalc, _blendabletexVoffCalc, _blendabletexUmaxCalc, _blendabletexVmaxCalc,
_packedMaskTextureNo, uoffm, voffm, umaxm, vmaxm,
_blendMode);
}
}
else
{
- FontEngineDrawTexture2(_packedTextureNo, fx, fy, nw, nh, uoff1, voff1, umax1, vmax1, (int)color, m,
+ FontEngineDrawTexture2(_packedTextureNo, fx, fy, nw, nh, uoff1, voff1, umax1, vmax1, color, m,
_packedBlendableTextureNo, _blendabletexUoffCalc, _blendabletexVoffCalc, _blendabletexUmaxCalc, _blendabletexVmaxCalc,
_blendMode);
}
@@ -1671,7 +1671,7 @@ public override void Render(float timePassed)
// Compute the number of textures to draw in the control and draw the texture.
float umax = _nw / x;
float vmax = _nh / x;
- frame.Draw(_fx, _fy, _nw, _nh, 0, 0, umax, vmax, (int)color);
+ frame.Draw(_fx, _fy, _nw, _nh, 0, 0, umax, vmax, color);
}
else
{
@@ -1693,13 +1693,13 @@ public override void Render(float timePassed)
umaxm = _masktexUmax + _masktexUoff;
vmaxm = _masktexVmax + _masktexVoff;
- frame.DrawMasked(_fx, _fy, _nw, _nh, _uoff, _voff, _umax, _vmax, (int)color,
+ frame.DrawMasked(_fx, _fy, _nw, _nh, _uoff, _voff, _umax, _vmax, color,
_packedMaskTextureNo, uoffm, voffm, umaxm, vmaxm);
}
}
else
{
- frame.Draw(_fx, _fy, _nw, _nh, _uoff, _voff, _umax, _vmax, (int)color);
+ frame.Draw(_fx, _fy, _nw, _nh, _uoff, _voff, _umax, _vmax, color);
}
}
@@ -1779,15 +1779,15 @@ public override void Render(float timePassed)
vmaxm = _masktexVmax + _masktexVoff;
FontEngineDrawMaskedTexture2(frame.TextureNumber, fx, fy, nw, nh, uoff1, voff1, umax1, vmax1,
- (int)color, matrix,
+ color, matrix,
_packedBlendableTextureNo, _blendabletexUoffCalc, _blendabletexVoffCalc, _blendabletexUmaxCalc, _blendabletexVmaxCalc,
_packedMaskTextureNo, uoffm, voffm, umaxm, vmaxm,
_blendMode);
}
}
else
{
- FontEngineDrawTexture2(frame.TextureNumber, fx, fy, nw, nh, uoff1, voff1, umax1, vmax1, (int)color,
+ FontEngineDrawTexture2(frame.TextureNumber, fx, fy, nw, nh, uoff1, voff1, umax1, vmax1, color,
matrix,
_packedBlendableTextureNo, _blendabletexUoffCalc, _blendabletexVoffCalc, _blendabletexUmaxCalc, _blendabletexVmaxCalc,
_blendMode);
@@ -1860,7 +1860,7 @@ private void DrawBorder(bool flip)
CachedTexture.Frame texture = null;
CachedTexture.Frame cornerTexture = null;
- int mergedBorderColorKey = (int)GUIGraphicsContext.MergeAlpha((uint)_borderColorKey);
+ uint mergedBorderColorKey = GUIGraphicsContext.MergeAlpha((uint)_borderColorKey);
int itw, ith;
int ictw, icth;
float textureWidth;

0 comments on commit b42d4d5

Please sign in to comment.