[slimdx] r2194 committed - Bug fixes for SpriteBatch.

13 views
Skip to first unread message

sli...@googlecode.com

unread,
Mar 20, 2012, 3:02:55 PM3/20/12
to slimdx...@googlegroups.com
Revision: 2194
Author: mike.popoloski
Date: Tue Mar 20 12:01:54 2012
Log: Bug fixes for SpriteBatch.
http://code.google.com/p/slimdx/source/detail?r=2194

Modified:
/branches/lite/SlimDX.Toolkit/Sprites/SpriteBatch.cs
/branches/lite/SlimDX.Toolkit/Sprites/SpriteDeviceResources.cs

=======================================
--- /branches/lite/SlimDX.Toolkit/Sprites/SpriteBatch.cs Tue Mar 20
11:00:08 2012
+++ /branches/lite/SlimDX.Toolkit/Sprites/SpriteBatch.cs Tue Mar 20
12:01:54 2012
@@ -461,6 +461,8 @@
// set transform matrix
var viewport = context.Rasterizer.GetViewport();
var transform = TransformMatrix *
Matrix.OrthoOffCenterLH(0.0f, viewport.Width, viewport.Height, 0.0f, 0.0f,
1.0f);
+ cr.ConstantBuffer.SetData(context, ref transform);
+
context.VertexShader.SetConstantBuffer(cr.ConstantBuffer.Buffer, 0);

// if this is on a deferred device context, reset the position
so that the first Map call can use Discard
if (context.Type == DeviceContextType.Deferred)
@@ -601,14 +603,14 @@
if ((flags & SourceInTexels) != 0)
{
Vector2.Modulate(ref sourcePos, ref inverseTextureSize,
out sourcePos);
- Vector2.Modulate(ref sourceSize, ref inverseTextureSize,
out sourcePos);
+ Vector2.Modulate(ref sourceSize, ref inverseTextureSize,
out sourceSize);
}
else
- Vector2.Modulate(ref origin, ref inverseTextureSize, out
sourcePos);
+ Vector2.Modulate(ref origin, ref inverseTextureSize, out
origin);

// if the destination size is relative to the source region,
convert it to pixels
if ((flags & DestSizeInPixels) == 0)
- Vector2.Modulate(ref destSize, ref textureSize, out
sourcePos);
+ Vector2.Modulate(ref destSize, ref textureSize, out
destSize);

// compute a 2x2 rotation matrix
var rotationMatrix = rotation == 0 ? Matrix.Identity :
Matrix.RotationZ(rotation);
=======================================
--- /branches/lite/SlimDX.Toolkit/Sprites/SpriteDeviceResources.cs Tue Mar
20 11:00:08 2012
+++ /branches/lite/SlimDX.Toolkit/Sprites/SpriteDeviceResources.cs Tue Mar
20 12:01:54 2012
@@ -34,12 +34,12 @@
for (short i = 0; i < maxBatchSize *
SpriteBatch.VerticesPerSprite; i += SpriteBatch.VerticesPerSprite)
{
indices.Write(i);
- indices.Write(i + 1);
- indices.Write(i + 2);
-
- indices.Write(i + 1);
- indices.Write(i + 3);
- indices.Write(i + 2);
+ indices.Write((short)(i + 1));
+ indices.Write((short)(i + 2));
+
+ indices.Write((short)(i + 1));
+ indices.Write((short)(i + 3));
+ indices.Write((short)(i + 2));
}

// create the index buffer

Reply all
Reply to author
Forward
0 new messages