From 79ae0f77d85c61157c7de3caa2047dd5b72bd1f1 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 1 Jun 2017 20:40:21 -0700 Subject: [PATCH 1/2] UI: Fix Take Screenshot support. --- UI/NativeApp.cpp | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index a002d63329..d1e21c9b05 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -743,27 +743,25 @@ void TakeScreenshot() { void RenderOverlays(UIContext *dc, void *userdata) { // Thin bar at the top of the screen like Chrome. std::vector progress = g_DownloadManager.GetCurrentProgress(); - if (progress.empty()) { - return; - } + if (!progress.empty()) { + static const uint32_t colors[4] = { + 0xFFFFFFFF, + 0xFFCCCCCC, + 0xFFAAAAAA, + 0xFF777777, + }; - static const uint32_t colors[4] = { - 0xFFFFFFFF, - 0xFFCCCCCC, - 0xFFAAAAAA, - 0xFF777777, - }; - - dc->Begin(); - int h = 5; - for (size_t i = 0; i < progress.size(); i++) { - float barWidth = 10 + (dc->GetBounds().w - 10) * progress[i]; - Bounds bounds(0, h * i, barWidth, h); - UI::Drawable solid(colors[i & 3]); - dc->FillRect(solid, bounds); + dc->Begin(); + int h = 5; + for (size_t i = 0; i < progress.size(); i++) { + float barWidth = 10 + (dc->GetBounds().w - 10) * progress[i]; + Bounds bounds(0, h * i, barWidth, h); + UI::Drawable solid(colors[i & 3]); + dc->FillRect(solid, bounds); + } + dc->End(); + dc->Flush(); } - dc->End(); - dc->Flush(); if (g_TakeScreenshot) { TakeScreenshot(); From 1cc488aef46d942c741c7a7c5b7867ef9ce5865f Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 1 Jun 2017 20:40:45 -0700 Subject: [PATCH 2/2] SoftGPU: Support Take Screenshot partially. This doesn't capture the FPS etc. as other backends do, but at least it takes a screenshot. --- GPU/Common/FramebufferCommon.h | 1 + GPU/Software/SoftGpu.cpp | 4 ++++ GPU/Software/SoftGpu.h | 1 + 3 files changed, 6 insertions(+) diff --git a/GPU/Common/FramebufferCommon.h b/GPU/Common/FramebufferCommon.h index 17bc0153c1..fc5b5b59ae 100644 --- a/GPU/Common/FramebufferCommon.h +++ b/GPU/Common/FramebufferCommon.h @@ -19,6 +19,7 @@ #include #include +#include #include "Common/CommonTypes.h" #include "Core/MemMap.h" diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index 94ec5b59a8..28a5a03e96 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -954,6 +954,10 @@ bool SoftGPU::GetCurrentFramebuffer(GPUDebugBuffer &buffer, GPUDebugFramebufferT return true; } +bool SoftGPU::GetOutputFramebuffer(GPUDebugBuffer &buffer) { + return GetCurrentFramebuffer(buffer, GPU_DBG_FRAMEBUF_DISPLAY, 1); +} + bool SoftGPU::GetCurrentDepthbuffer(GPUDebugBuffer &buffer) { const int w = gstate.getRegionX2() - gstate.getRegionX1() + 1; diff --git a/GPU/Software/SoftGpu.h b/GPU/Software/SoftGpu.h index 3b0dd6b7b5..c25e68751c 100644 --- a/GPU/Software/SoftGpu.h +++ b/GPU/Software/SoftGpu.h @@ -85,6 +85,7 @@ public: } bool GetCurrentFramebuffer(GPUDebugBuffer &buffer, GPUDebugFramebufferType type, int maxRes = -1) override; + bool GetOutputFramebuffer(GPUDebugBuffer &buffer) override; bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) override; bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) override; bool GetCurrentTexture(GPUDebugBuffer &buffer, int level) override;