[Agate-svn-commit] SF.net SVN: agate:[975] branches/agate3d-3.2
Status: Alpha
Brought to you by:
kanato
|
From: <ka...@us...> - 2009-05-11 06:56:14
|
Revision: 975
http://agate.svn.sourceforge.net/agate/?rev=975&view=rev
Author: kanato
Date: 2009-05-11 06:56:04 +0000 (Mon, 11 May 2009)
Log Message:
-----------
Move Push/pop clip rect implementations to DisplayLib/Display.cs.
Modified Paths:
--------------
branches/agate3d-3.2/AgateLib/AgateApplication.cs
branches/agate3d-3.2/AgateLib/DisplayLib/Display.cs
branches/agate3d-3.2/AgateLib/ImplementationBase/DisplayImpl.cs
branches/agate3d-3.2/Drivers/AgateDrawing/Drawing_Display.cs
branches/agate3d-3.2/Drivers/AgateMDX/MDX1_Display.cs
branches/agate3d-3.2/Drivers/AgateOTK/GL_Display.cs
branches/agate3d-3.2/Drivers/AgateSDX/SDX_Display.cs
Modified: branches/agate3d-3.2/AgateLib/AgateApplication.cs
===================================================================
--- branches/agate3d-3.2/AgateLib/AgateApplication.cs 2009-05-11 06:30:52 UTC (rev 974)
+++ branches/agate3d-3.2/AgateLib/AgateApplication.cs 2009-05-11 06:56:04 UTC (rev 975)
@@ -237,7 +237,7 @@
Surface powered = InternalResources.Data.PoweredBy;
Size size = powered.SurfaceSize;
- int left = (int)(totalSplashTime * size.Width - size.Width);
+ int left = (int)(totalSplashTime * size.Width - size.Width)+1;
Rectangle gradientRect = new Rectangle(left, MainWindow.Height - size.Height,
size.Width, size.Height);
Modified: branches/agate3d-3.2/AgateLib/DisplayLib/Display.cs
===================================================================
--- branches/agate3d-3.2/AgateLib/DisplayLib/Display.cs 2009-05-11 06:30:52 UTC (rev 974)
+++ branches/agate3d-3.2/AgateLib/DisplayLib/Display.cs 2009-05-11 06:56:04 UTC (rev 975)
@@ -61,7 +61,9 @@
private static DisplayImpl impl;
private static DisplayWindow mCurrentWindow;
private static SurfacePacker mSurfacePacker;
-
+ private static Rectangle mCurrentClipRect;
+ private static Stack<Rectangle> mClipRects = new Stack<Rectangle>();
+
/// <summary>
/// Gets the object which handles all of the actual calls to Display functions.
/// This may be cast to a surface object in whatever rendering library
@@ -318,15 +320,24 @@
/// <param name="newClipRect"></param>
public static void PushClipRect(Rectangle newClipRect)
{
- impl.PushClipRect(newClipRect);
+ mClipRects.Push(mCurrentClipRect);
+ SetClipRect(newClipRect);
}
/// <summary>
/// Pops the clip rect and restores the previous clip rect.
/// </summary>
public static void PopClipRect()
{
- impl.PopClipRect();
+ if (mClipRects.Count == 0)
+ {
+ throw new Exception("You have popped the cliprect too many times.");
+ }
+ else
+ {
+ SetClipRect(mClipRects.Pop());
+ }
}
+
/// <summary>
/// Returns the maximum size a surface object can be.
/// </summary>
Modified: branches/agate3d-3.2/AgateLib/ImplementationBase/DisplayImpl.cs
===================================================================
--- branches/agate3d-3.2/AgateLib/ImplementationBase/DisplayImpl.cs 2009-05-11 06:30:52 UTC (rev 974)
+++ branches/agate3d-3.2/AgateLib/ImplementationBase/DisplayImpl.cs 2009-05-11 06:56:04 UTC (rev 975)
@@ -321,22 +321,13 @@
/// </summary>
public abstract Size MaxSurfaceSize { get; }
- #region --- Clip Rect stuff ---
+ #region --- SetClipRect ---
/// <summary>
/// Set the current clipping rect.
/// </summary>
/// <param name="newClipRect"></param>
public abstract void SetClipRect(Rectangle newClipRect);
- /// <summary>
- /// Pushes a clip rect onto the clip rect stack.
- /// </summary>
- /// <param name="newClipRect"></param>
- public abstract void PushClipRect(Rectangle newClipRect);
- /// <summary>
- /// Pops the clip rect and restores the previous clip rect.
- /// </summary>
- public abstract void PopClipRect();
#endregion
#region --- Direct modification of the back buffer ---
Modified: branches/agate3d-3.2/Drivers/AgateDrawing/Drawing_Display.cs
===================================================================
--- branches/agate3d-3.2/Drivers/AgateDrawing/Drawing_Display.cs 2009-05-11 06:30:52 UTC (rev 974)
+++ branches/agate3d-3.2/Drivers/AgateDrawing/Drawing_Display.cs 2009-05-11 06:56:04 UTC (rev 975)
@@ -42,9 +42,6 @@
private bool mInFrame = false;
- private Stack<Geometry.Rectangle> mClipRects = new Stack<Geometry.Rectangle>();
- private Geometry.Rectangle mCurrentClipRect;
-
#endregion
#region --- Events and Event Handlers ---
@@ -207,9 +204,6 @@
mGraphics.Dispose();
mGraphics = null;
- while (mClipRects.Count > 0)
- PopClipRect();
-
Drawing_IRenderTarget renderTarget = RenderTarget.Impl as Drawing_IRenderTarget;
renderTarget.EndRender();
@@ -220,24 +214,9 @@
public override void SetClipRect(Geometry.Rectangle newClipRect)
{
mGraphics.SetClip(Interop.Convert(newClipRect));
- mCurrentClipRect = newClipRect;
}
- public override void PushClipRect(Geometry.Rectangle newClipRect)
- {
- mClipRects.Push(mCurrentClipRect);
- SetClipRect(newClipRect);
- }
- public override void PopClipRect()
- {
-#if DEBUG
- if (mClipRects.Count == 0)
- throw new Exception("The cliprect has been popped too many times.");
-#endif
- SetClipRect(mClipRects.Pop());
- }
-
#endregion
protected override void ProcessEvents()
Modified: branches/agate3d-3.2/Drivers/AgateMDX/MDX1_Display.cs
===================================================================
--- branches/agate3d-3.2/Drivers/AgateMDX/MDX1_Display.cs 2009-05-11 06:30:52 UTC (rev 974)
+++ branches/agate3d-3.2/Drivers/AgateMDX/MDX1_Display.cs 2009-05-11 06:56:04 UTC (rev 975)
@@ -261,12 +261,7 @@
protected override void OnEndFrame()
{
mDevice.DrawBuffer.Flush();
-
- while (mClipRects.Count > 0)
- PopClipRect();
-
mRenderTarget.EndRender();
-
}
#endregion
@@ -305,30 +300,12 @@
view.Height = newClipRect.Height;
mDevice.Device.Viewport = view;
- mCurrentClipRect = newClipRect;
SetOrthoProjection(newClipRect);
}
- public override void PushClipRect(Rectangle newClipRect)
- {
- mClipRects.Push(mCurrentClipRect);
- SetClipRect(newClipRect);
- }
- public override void PopClipRect()
- {
- if (mClipRects.Count == 0)
- {
- throw new Exception("You have popped the cliprect too many times.");
- }
- else
- {
- SetClipRect(mClipRects.Pop());
- }
- }
+
- private Stack<Rectangle> mClipRects = new Stack<Rectangle>();
- private Rectangle mCurrentClipRect;
-
+
#endregion
#region --- Methods for drawing to the back buffer ---
Modified: branches/agate3d-3.2/Drivers/AgateOTK/GL_Display.cs
===================================================================
--- branches/agate3d-3.2/Drivers/AgateOTK/GL_Display.cs 2009-05-11 06:30:52 UTC (rev 974)
+++ branches/agate3d-3.2/Drivers/AgateOTK/GL_Display.cs 2009-05-11 06:56:04 UTC (rev 975)
@@ -173,20 +173,6 @@
mCurrentClip = newClipRect;
}
- public override void PushClipRect(Rectangle newClipRect)
- {
- mClipRects.Push(mCurrentClip);
-
- SetClipRect(newClipRect);
- }
-
- public override void PopClipRect()
- {
- SetClipRect(mClipRects.Peek());
-
- mClipRects.Pop();
- }
-
public override void FlushDrawBuffer()
{
mState.DrawBuffer.Flush();
Modified: branches/agate3d-3.2/Drivers/AgateSDX/SDX_Display.cs
===================================================================
--- branches/agate3d-3.2/Drivers/AgateSDX/SDX_Display.cs 2009-05-11 06:30:52 UTC (rev 974)
+++ branches/agate3d-3.2/Drivers/AgateSDX/SDX_Display.cs 2009-05-11 06:56:04 UTC (rev 975)
@@ -269,12 +269,7 @@
protected override void OnEndFrame()
{
mDevice.DrawBuffer.Flush();
-
- while (mClipRects.Count > 0)
- PopClipRect();
-
mRenderTarget.EndRender();
-
}
#endregion
@@ -311,28 +306,19 @@
view.Y = newClipRect.Y;
view.Width = newClipRect.Width;
view.Height = newClipRect.Height;
+ view.MinZ = 0;
+ view.MaxZ = 1;
- //mDevice.Device.Viewport = view;
+ if (view.Width == 0 || view.Height == 0)
+ {
+ throw new AgateLib.AgateException("Cannot set a cliprect with a width / height of zero.");
+ }
+
+ mDevice.Device.Viewport = view;
mCurrentClipRect = newClipRect;
SetOrthoProjection(newClipRect);
}
- public override void PushClipRect(Rectangle newClipRect)
- {
- mClipRects.Push(mCurrentClipRect);
- SetClipRect(newClipRect);
- }
- public override void PopClipRect()
- {
- if (mClipRects.Count == 0)
- {
- throw new Exception("You have popped the cliprect too many times.");
- }
- else
- {
- SetClipRect(mClipRects.Pop());
- }
- }
private Stack<Rectangle> mClipRects = new Stack<Rectangle>();
private Rectangle mCurrentClipRect;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|