From: <je...@us...> - 2007-04-28 04:36:12
|
Revision: 1366 http://cs-sdl.svn.sourceforge.net/cs-sdl/?rev=1366&view=rev Author: jendave Date: 2007-04-27 21:36:08 -0700 (Fri, 27 Apr 2007) Log Message: ----------- fxcop changes Modified Paths: -------------- trunk/SdlDotNet/examples/SdlDotNetExamples/SmallDemos/SpriteCollectionSort.cs trunk/SdlDotNet/examples/SdlDotNetExamples/SmallDemos/Template.cs trunk/SdlDotNet/src/Graphics/Sprites/KillSpriteEventArgs.cs trunk/SdlDotNet/src/Graphics/Surface.cs trunk/SdlDotNet/src/Properties/AssemblyInfo.cs trunk/SdlDotNet/tools/Prebuild/prebuild.exe Modified: trunk/SdlDotNet/examples/SdlDotNetExamples/SmallDemos/SpriteCollectionSort.cs =================================================================== --- trunk/SdlDotNet/examples/SdlDotNetExamples/SmallDemos/SpriteCollectionSort.cs 2007-04-27 17:59:56 UTC (rev 1365) +++ trunk/SdlDotNet/examples/SdlDotNetExamples/SmallDemos/SpriteCollectionSort.cs 2007-04-28 04:36:08 UTC (rev 1366) @@ -35,7 +35,7 @@ namespace SdlDotNetExamples.SmallDemos { - public class SpriteCollectionSort + public class SpriteCollectionSort : IDisposable { Surface screen; SpriteCollection manager; @@ -53,7 +53,7 @@ Video.WindowIcon(); Video.WindowCaption = "SDL.NET - Sprite Sorting Example"; screen = Video.SetVideoMode(200, 200, false, false, false); - + s = new Sprite(new Surface(100, 100), new Point(10, 10)); s2 = new Sprite(new Surface(100, 100), new Point(10, 10)); @@ -106,6 +106,61 @@ return "SpriteCollectionSort: Sorting Sprite on the Z Axis"; } } + + #region IDisposable Members + + private bool disposed; + + /// <summary> + /// + /// </summary> + /// <param name="disposing"></param> + protected virtual void Dispose(bool disposing) + { + if (!this.disposed) + { + if (disposing) + { + if (this.s != null) + { + this.s.Dispose(); + this.s = null; + } + if (this.s2 != null) + { + this.s2.Dispose(); + this.s2 = null; + } + } + this.disposed = true; + } + } + /// <summary> + /// + /// </summary> + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize(this); + } + + /// <summary> + /// + /// </summary> + public void Close() + { + Dispose(); + } + + /// <summary> + /// + /// </summary> + ~SpriteCollectionSort() + { + Dispose(false); + } + + #endregion } } Modified: trunk/SdlDotNet/examples/SdlDotNetExamples/SmallDemos/Template.cs =================================================================== --- trunk/SdlDotNet/examples/SdlDotNetExamples/SmallDemos/Template.cs 2007-04-27 17:59:56 UTC (rev 1365) +++ trunk/SdlDotNet/examples/SdlDotNetExamples/SmallDemos/Template.cs 2007-04-28 04:36:08 UTC (rev 1366) @@ -16,13 +16,13 @@ } public Template() - { - Video.SetVideoMode(800, 600); - AddHandlers(); + { } public void Go() { + Video.SetVideoMode(800, 600); + this.AddHandlers(); Events.Run(); } Modified: trunk/SdlDotNet/src/Graphics/Sprites/KillSpriteEventArgs.cs =================================================================== --- trunk/SdlDotNet/src/Graphics/Sprites/KillSpriteEventArgs.cs 2007-04-27 17:59:56 UTC (rev 1365) +++ trunk/SdlDotNet/src/Graphics/Sprites/KillSpriteEventArgs.cs 2007-04-28 04:36:08 UTC (rev 1366) @@ -61,9 +61,13 @@ /// </summary> public KillSpriteEventArgs(Sprite sprite) { + if (sprite == null) + { + throw new ArgumentNullException("sprite"); + } this.sprite = sprite; this.rectangle = sprite.LastBlitRectangle; - } + } #endregion } Modified: trunk/SdlDotNet/src/Graphics/Surface.cs =================================================================== --- trunk/SdlDotNet/src/Graphics/Surface.cs 2007-04-27 17:59:56 UTC (rev 1365) +++ trunk/SdlDotNet/src/Graphics/Surface.cs 2007-04-28 04:36:08 UTC (rev 1366) @@ -1642,14 +1642,18 @@ Unlock(); } } - + /// <summary> /// Sets a block of pixels. /// </summary> /// <param name="point">The top left corner of where the block should go.</param> /// <param name="colors">The 2D color array representing the pixels.</param> - public void SetPixels(Point point,Color[,] colors) + public void SetPixels(Point point, Color[,] colors) { + if (colors == null) + { + throw new ArgumentNullException("colors"); + } if (this.disposed) { throw (new ObjectDisposedException(this.ToString())); @@ -1659,7 +1663,7 @@ { throw new ArgumentOutOfRangeException("point"); } - if (point.Y < 0 || point.Y + colors.GetLength(1) > surfaceStruct.h) + if (point.Y < 0 || point.Y + colors.GetLength(1) > surfaceStruct.h) { throw new ArgumentOutOfRangeException("point"); } @@ -1746,7 +1750,7 @@ Unlock(); } } - + /// <summary> /// AlphaBlending on Surface /// </summary> @@ -2336,13 +2340,13 @@ throw new ArgumentNullException("transformation"); } int antiAliasParameter = (transformation.AntiAlias) ? (SdlGfx.SMOOTHING_ON) : (SdlGfx.SMOOTHING_OFF); - Surface surface = + Surface surface = new Surface( SdlGfx.rotozoomSurfaceXY( - this.Handle, - transformation.DegreesOfRotation, - transformation.ScaleX, - transformation.ScaleY, + this.Handle, + transformation.DegreesOfRotation, + transformation.ScaleX, + transformation.ScaleY, antiAliasParameter)); CloneFields(this, surface); return surface; @@ -2668,6 +2672,7 @@ { private const int sizeofInt24 = 3; private static readonly int offset = ((BitConverter.IsLittleEndian) ? (0) : (1)); + public static Int32 ReadInt24(IntPtr ptr) { //creates a buffer to put the data read for the pointer Modified: trunk/SdlDotNet/src/Properties/AssemblyInfo.cs =================================================================== --- trunk/SdlDotNet/src/Properties/AssemblyInfo.cs 2007-04-27 17:59:56 UTC (rev 1365) +++ trunk/SdlDotNet/src/Properties/AssemblyInfo.cs 2007-04-28 04:36:08 UTC (rev 1366) @@ -98,4 +98,7 @@ [module: SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters", Scope = "member", Target = "SdlDotNet.Graphics.Surface.Erase(System.Drawing.Rectangle,SdlDotNet.Graphics.Surface):System.Void")] [module: SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Scope = "member", Target = "SdlDotNet.Graphics.Sprites.Sprite.LastBlitRectangle", MessageId = "Blit")] [module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SdlDotNet.Graphics.Surface.GetColors(System.Drawing.Rectangle):System.Drawing.Color[,]", MessageId = "Body")] -[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SdlDotNet.Graphics.Surface.GetColors(System.Drawing.Rectangle):System.Drawing.Color[,]", MessageId = "Return")] \ No newline at end of file +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SdlDotNet.Graphics.Surface.GetColors(System.Drawing.Rectangle):System.Drawing.Color[,]", MessageId = "Return")] +[module: SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", Scope = "member", Target = "SdlDotNet.Graphics.Surface.SetPixels(System.Drawing.Point,System.Drawing.Color[,]):System.Void", MessageId = "1#")] +[module: SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily", Scope = "member", Target = "SdlDotNet.Graphics.MarshalHelper..cctor()")] +[module: SuppressMessage("Microsoft.Performance", "CA1802:UseLiteralsWhereAppropriate", Scope = "member", Target = "SdlDotNet.Graphics.MarshalHelper.offset")] \ No newline at end of file Modified: trunk/SdlDotNet/tools/Prebuild/prebuild.exe =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |