Debugger: Minor performance fix for debug HUD
This commit is contained in:
parent
a978e1e08f
commit
ceda28fcbb
2 changed files with 8 additions and 8 deletions
|
@ -27,38 +27,38 @@ void DebugHud::ClearScreen()
|
|||
void DebugHud::Draw(uint32_t* argbBuffer, OverscanDimensions overscan, uint32_t lineWidth, uint32_t frameNumber)
|
||||
{
|
||||
auto lock = _commandLock.AcquireSafe();
|
||||
for(shared_ptr<DrawCommand> &command : _commands) {
|
||||
for(unique_ptr<DrawCommand> &command : _commands) {
|
||||
command->Draw(argbBuffer, overscan, lineWidth, frameNumber);
|
||||
}
|
||||
_commands.erase(std::remove_if(_commands.begin(), _commands.end(), [](const shared_ptr<DrawCommand>& c) { return c->Expired(); }), _commands.end());
|
||||
_commands.erase(std::remove_if(_commands.begin(), _commands.end(), [](const unique_ptr<DrawCommand>& c) { return c->Expired(); }), _commands.end());
|
||||
}
|
||||
|
||||
void DebugHud::DrawPixel(int x, int y, int color, int frameCount, int startFrame)
|
||||
{
|
||||
auto lock = _commandLock.AcquireSafe();
|
||||
_commands.push_back(shared_ptr<DrawPixelCommand>(new DrawPixelCommand(x, y, color, frameCount, startFrame)));
|
||||
_commands.push_back(unique_ptr<DrawPixelCommand>(new DrawPixelCommand(x, y, color, frameCount, startFrame)));
|
||||
}
|
||||
|
||||
void DebugHud::DrawLine(int x, int y, int x2, int y2, int color, int frameCount, int startFrame)
|
||||
{
|
||||
auto lock = _commandLock.AcquireSafe();
|
||||
_commands.push_back(shared_ptr<DrawLineCommand>(new DrawLineCommand(x, y, x2, y2, color, frameCount, startFrame)));
|
||||
_commands.push_back(unique_ptr<DrawLineCommand>(new DrawLineCommand(x, y, x2, y2, color, frameCount, startFrame)));
|
||||
}
|
||||
|
||||
void DebugHud::DrawRectangle(int x, int y, int width, int height, int color, bool fill, int frameCount, int startFrame)
|
||||
{
|
||||
auto lock = _commandLock.AcquireSafe();
|
||||
_commands.push_back(shared_ptr<DrawRectangleCommand>(new DrawRectangleCommand(x, y, width, height, color, fill, frameCount, startFrame)));
|
||||
_commands.push_back(unique_ptr<DrawRectangleCommand>(new DrawRectangleCommand(x, y, width, height, color, fill, frameCount, startFrame)));
|
||||
}
|
||||
|
||||
void DebugHud::DrawScreenBuffer(uint32_t* screenBuffer, int startFrame)
|
||||
{
|
||||
auto lock = _commandLock.AcquireSafe();
|
||||
_commands.push_back(shared_ptr<DrawScreenBufferCommand>(new DrawScreenBufferCommand(screenBuffer, startFrame)));
|
||||
_commands.push_back(unique_ptr<DrawScreenBufferCommand>(new DrawScreenBufferCommand(screenBuffer, startFrame)));
|
||||
}
|
||||
|
||||
void DebugHud::DrawString(int x, int y, string text, int color, int backColor, int frameCount, int startFrame)
|
||||
{
|
||||
auto lock = _commandLock.AcquireSafe();
|
||||
_commands.push_back(shared_ptr<DrawStringCommand>(new DrawStringCommand(x, y, text, color, backColor, frameCount, startFrame)));
|
||||
_commands.push_back(unique_ptr<DrawStringCommand>(new DrawStringCommand(x, y, text, color, backColor, frameCount, startFrame)));
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class DrawCommand;
|
|||
class DebugHud
|
||||
{
|
||||
private:
|
||||
vector<shared_ptr<DrawCommand>> _commands;
|
||||
vector<unique_ptr<DrawCommand>> _commands;
|
||||
SimpleLock _commandLock;
|
||||
|
||||
public:
|
||||
|
|
Loading…
Add table
Reference in a new issue