From 055ca0ae00f11cb793ba0a694ffa089d26d17700 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Thu, 23 Jan 2025 20:23:47 +0000 Subject: [PATCH] use screenshot for eye dropper instead of using backbuffer image, use the screenshot so it captures everything --- Engine/source/gfx/D3D11/screenshotD3D11.h | 2 +- Engine/source/gfx/gl/screenshotGL.h | 2 +- Engine/source/gfx/screenshot.h | 7 +++---- Engine/source/gui/controls/guiColorPicker.cpp | 14 ++++---------- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Engine/source/gfx/D3D11/screenshotD3D11.h b/Engine/source/gfx/D3D11/screenshotD3D11.h index ce890a473..8822ae933 100644 --- a/Engine/source/gfx/D3D11/screenshotD3D11.h +++ b/Engine/source/gfx/D3D11/screenshotD3D11.h @@ -29,7 +29,7 @@ //************************************************************************** class ScreenShotD3D11 : public ScreenShot { -protected: +public: GBitmap* _captureBackBuffer() override; diff --git a/Engine/source/gfx/gl/screenshotGL.h b/Engine/source/gfx/gl/screenshotGL.h index 442d8bb0f..9fce67b90 100644 --- a/Engine/source/gfx/gl/screenshotGL.h +++ b/Engine/source/gfx/gl/screenshotGL.h @@ -29,7 +29,7 @@ //************************************************************************** class ScreenShotGL : public ScreenShot { -protected: +public: GBitmap* _captureBackBuffer() override; diff --git a/Engine/source/gfx/screenshot.h b/Engine/source/gfx/screenshot.h index 9de224f06..f8b059fae 100644 --- a/Engine/source/gfx/screenshot.h +++ b/Engine/source/gfx/screenshot.h @@ -40,10 +40,6 @@ class Frustum; class ScreenShot { - /// This is overloaded to copy the current GFX - /// backbuffer to a new bitmap. - virtual GBitmap* _captureBackBuffer() { return NULL; } - /// This is set to toggle the capture. bool mPending; @@ -76,6 +72,9 @@ public: ScreenShot(); virtual ~ScreenShot() { } + /// This is overloaded to copy the current GFX + /// backbuffer to a new bitmap. + virtual GBitmap* _captureBackBuffer() { return NULL; } /// Used to start the screenshot capture. void setPending( const char *filename, bool writeJPG, S32 tiles, F32 overlap ); diff --git a/Engine/source/gui/controls/guiColorPicker.cpp b/Engine/source/gui/controls/guiColorPicker.cpp index 1bf3a935a..f3bf4d628 100644 --- a/Engine/source/gui/controls/guiColorPicker.cpp +++ b/Engine/source/gui/controls/guiColorPicker.cpp @@ -30,6 +30,7 @@ #include "gfx/primBuilder.h" #include "gfx/gfxDrawUtil.h" #include "postFx/postEffectManager.h" +#include "gfx/screenshot.h" IMPLEMENT_CONOBJECT(GuiColorPickerCtrl); @@ -707,17 +708,10 @@ void GuiColorPickerCtrl::activateEyeDropper() // Set up our resolution. Point2I resolution = getRoot()->getExtent(); + eyeDropperCap = gScreenShot->_captureBackBuffer(); + // Texture handle to resolve the target to. - eyeHandle.set(resolution.x, resolution.y, GFXFormatR8G8B8A8_SRGB, &GFXRenderTargetSRGBProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__)); - - // Get our active render target (should be backbuffer). - eyeHandle = PFXMGR->getBackBufferTex(); - - if (eyeHandle.isValid()) - { - eyeDropperCap = new GBitmap(eyeHandle.getWidth(), eyeHandle.getHeight(), false, GFXFormatR8G8B8A8); - eyeHandle.copyToBmp(eyeDropperCap); - } + eyeHandle.set(eyeDropperCap, &GFXStaticTextureSRGBProfile, false, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__)); } }