diff --git a/Core/Shared/Video/DebugHud.cpp b/Core/Shared/Video/DebugHud.cpp index e9a058f60..92984d928 100644 --- a/Core/Shared/Video/DebugHud.cpp +++ b/Core/Shared/Video/DebugHud.cpp @@ -89,7 +89,7 @@ void DebugHud::DrawRectangle(int x, int y, int width, int height, int color, boo AddCommand(unique_ptr(new DrawRectangleCommand(x, y, width, height, color, fill, frameCount, startFrame))); } -void DebugHud::DrawString(int x, int y, string text, int color, int backColor, int frameCount, int startFrame, int maxWidth) +void DebugHud::DrawString(int x, int y, string text, int color, int backColor, int frameCount, int startFrame, int maxWidth, bool overwritePixels) { - AddCommand(unique_ptr(new DrawStringCommand(x, y, text, color, backColor, frameCount, startFrame, maxWidth))); + AddCommand(unique_ptr(new DrawStringCommand(x, y, text, color, backColor, frameCount, startFrame, maxWidth, overwritePixels))); } diff --git a/Core/Shared/Video/DebugHud.h b/Core/Shared/Video/DebugHud.h index c8450583a..d3507f195 100644 --- a/Core/Shared/Video/DebugHud.h +++ b/Core/Shared/Video/DebugHud.h @@ -25,7 +25,7 @@ class DebugHud void DrawPixel(int x, int y, int color, int frameCount, int startFrame = -1); void DrawLine(int x, int y, int x2, int y2, int color, int frameCount, int startFrame = -1); void DrawRectangle(int x, int y, int width, int height, int color, bool fill, int frameCount, int startFrame = -1); - void DrawString(int x, int y, string text, int color, int backColor, int frameCount, int startFrame = -1, int maxWidth = 0); + void DrawString(int x, int y, string text, int color, int backColor, int frameCount, int startFrame = -1, int maxWidth = 0, bool overwritePixels = false); __forceinline void AddCommand(unique_ptr cmd) { diff --git a/Core/Shared/Video/DrawCommand.h b/Core/Shared/Video/DrawCommand.h index df4f1fd0f..ee642aab5 100644 --- a/Core/Shared/Video/DrawCommand.h +++ b/Core/Shared/Video/DrawCommand.h @@ -14,6 +14,7 @@ class DrawCommand FrameInfo _frameInfo = {}; OverscanDimensions _overscan = {}; bool _useIntegerScaling = false; + bool _overwritePixels = false; float _xScale = 1; int _yScale = 1; @@ -24,10 +25,10 @@ class DrawCommand if(_drawnPixels) { //Log modified pixels if(alpha != 0xFF000000) { - if(_drawnPixels->find(offset) == _drawnPixels->end()) { + if(_drawnPixels->find(offset) == _drawnPixels->end() || _overwritePixels) { //When drawing on an empty background, premultiply channels & preserve alpha value //This is needed for hardware blending between the HUD and the game screen - (*_drawnPixels)[offset] = color; + (*_drawnPixels)[offset] = 0; BlendColors((uint8_t*)&(*_drawnPixels)[offset], (uint8_t*)&color, true); } else { BlendColors((uint8_t*)&(*_drawnPixels)[offset], (uint8_t*)&color); @@ -38,6 +39,10 @@ class DrawCommand } else { //Draw pixels directly to the buffer if(alpha != 0xFF000000) { + if(_overwritePixels) { + _argbBuffer[offset] = 0; + } + if(_argbBuffer[offset] == 0) { //When drawing on an empty background, premultiply channels & preserve alpha value //This is needed for hardware blending between the HUD and the game screen diff --git a/Core/Shared/Video/DrawStringCommand.h b/Core/Shared/Video/DrawStringCommand.h index 08f28ca78..601d38ade 100644 --- a/Core/Shared/Video/DrawStringCommand.h +++ b/Core/Shared/Video/DrawStringCommand.h @@ -227,10 +227,11 @@ class DrawStringCommand : public DrawCommand } public: - DrawStringCommand(int x, int y, string text, int color, int backColor, int frameCount, int startFrame, int maxWidth = 0) : + DrawStringCommand(int x, int y, string text, int color, int backColor, int frameCount, int startFrame, int maxWidth = 0, bool overwritePixels = false) : DrawCommand(startFrame, frameCount, true), _x(x), _y(y), _color(color), _backColor(backColor), _maxWidth(maxWidth), _text(text) { //Invert alpha byte - 0 = opaque, 255 = transparent (this way, no need to specifiy alpha channel all the time) + _overwritePixels = overwritePixels; _color = (~color & 0xFF000000) | (color & 0xFFFFFF); _backColor = (~backColor & 0xFF000000) | (backColor & 0xFFFFFF); } diff --git a/Core/Shared/Video/SystemHud.cpp b/Core/Shared/Video/SystemHud.cpp index 3952fa131..016a3e887 100644 --- a/Core/Shared/Video/SystemHud.cpp +++ b/Core/Shared/Video/SystemHud.cpp @@ -68,10 +68,10 @@ void SystemHud::DrawString(DebugHud* hud, uint32_t screenWidth, string text, int opacity = 255 - opacity; for(int i = -1; i <= 1; i++) { for(int j = -1; j <= 1; j++) { - hud->DrawString(x + i, y + j, text, 0 | (opacity << 24), 0xFF000000, 1, -1, maxWidth); + hud->DrawString(x + i, y + j, text, 0 | (opacity << 24), 0xFF000000, 1, -1, maxWidth, true); } } - hud->DrawString(x, y, text, 0xFFFFFF | (opacity << 24), 0xFF000000, 1, -1, maxWidth); + hud->DrawString(x, y, text, 0xFFFFFF | (opacity << 24), 0xFF000000, 1, -1, maxWidth, true); } void SystemHud::ShowFpsCounter(DebugHud* hud, uint32_t screenWidth, int lineNumber) const diff --git a/Core/Shared/Video/SystemHud.h b/Core/Shared/Video/SystemHud.h index d53a29cda..019ca964a 100644 --- a/Core/Shared/Video/SystemHud.h +++ b/Core/Shared/Video/SystemHud.h @@ -87,8 +87,8 @@ class MessageInfo float GetOpacity() { uint64_t currentTime = GetCurrentTime(); - if(currentTime - _startTime < 200) { - return (currentTime - _startTime) * 5.0f / 1000.0f; + if(currentTime - _startTime < 100) { + return (currentTime - _startTime) * 10.0f / 1000.0f; } else if(_endTime - currentTime < 200) { return (_endTime - currentTime) * 5.0f / 1000.0f; } else if(currentTime >= _endTime) {