add render_widgets to perf history

This commit is contained in:
Chris Forbes
2011-05-05 19:22:35 +12:00
parent 52f79f232e
commit fe392bd42d
2 changed files with 14 additions and 8 deletions

View File

@@ -147,6 +147,7 @@ namespace OpenRA
PerfHistory.items["render"].Tick(); PerfHistory.items["render"].Tick();
PerfHistory.items["batches"].Tick(); PerfHistory.items["batches"].Tick();
PerfHistory.items["render_widgets"].Tick();
afterTickActions.PerformActions(); afterTickActions.PerformActions();
} }
@@ -301,6 +302,7 @@ namespace OpenRA
PerfHistory.items["render"].hasNormalTick = false; PerfHistory.items["render"].hasNormalTick = false;
PerfHistory.items["batches"].hasNormalTick = false; PerfHistory.items["batches"].hasNormalTick = false;
PerfHistory.items["render_widgets"].hasNormalTick = false;
JoinLocal(); JoinLocal();
viewport = new Viewport(new int2(Renderer.Resolution), Rectangle.Empty, Renderer); viewport = new Viewport(new int2(Renderer.Resolution), Rectangle.Empty, Renderer);

View File

@@ -12,6 +12,7 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Widgets; using OpenRA.Widgets;
using OpenRA.Support;
namespace OpenRA.Graphics namespace OpenRA.Graphics
{ {
@@ -34,7 +35,7 @@ namespace OpenRA.Graphics
public void Scroll(float2 delta) public void Scroll(float2 delta)
{ {
this.Scroll(delta, false); Scroll(delta, false);
} }
public void Scroll(float2 delta, bool ignoreBorders) public void Scroll(float2 delta, bool ignoreBorders)
@@ -85,13 +86,16 @@ namespace OpenRA.Graphics
if (wr != null) if (wr != null)
wr.Draw(); wr.Draw();
Widget.DoDraw(); using( new PerfSample("render_widgets") )
var cursorName = Widget.RootWidget.GetCursorOuter(Viewport.LastMousePos) ?? "default"; {
var cursorSequence = CursorProvider.GetCursorSequence(cursorName); Widget.DoDraw();
var cursorName = Widget.RootWidget.GetCursorOuter(Viewport.LastMousePos) ?? "default";
cursorSequence.GetSprite((int)cursorFrame).DrawAt( var cursorSequence = CursorProvider.GetCursorSequence(cursorName);
Viewport.LastMousePos + Location - cursorSequence.Hotspot,
Game.modData.Palette.GetPaletteIndex(cursorSequence.Palette)); cursorSequence.GetSprite((int)cursorFrame).DrawAt(
Viewport.LastMousePos + Location - cursorSequence.Hotspot,
Game.modData.Palette.GetPaletteIndex(cursorSequence.Palette));
}
renderer.EndFrame( inputHandler ); renderer.EndFrame( inputHandler );
} }