Browse Source

use screenshot for eye dropper

instead of using backbuffer image, use the screenshot so it captures everything
marauder2k7 7 tháng trước cách đây
mục cha
commit
055ca0ae00

+ 1 - 1
Engine/source/gfx/D3D11/screenshotD3D11.h

@@ -29,7 +29,7 @@
 //**************************************************************************
 class ScreenShotD3D11 : public ScreenShot
 {
-protected:
+public:
 
    GBitmap* _captureBackBuffer() override;
 

+ 1 - 1
Engine/source/gfx/gl/screenshotGL.h

@@ -29,7 +29,7 @@
 //**************************************************************************
 class ScreenShotGL : public ScreenShot
 {
-protected:
+public:
 
    GBitmap* _captureBackBuffer() override;
 

+ 3 - 4
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 );
 

+ 4 - 10
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();
 
-      // 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();
+      eyeDropperCap = gScreenShot->_captureBackBuffer();
 
-      if (eyeHandle.isValid())
-      {
-         eyeDropperCap = new GBitmap(eyeHandle.getWidth(), eyeHandle.getHeight(), false, GFXFormatR8G8B8A8);
-         eyeHandle.copyToBmp(eyeDropperCap);
-      }
+      // Texture handle to resolve the target to.
+      eyeHandle.set(eyeDropperCap, &GFXStaticTextureSRGBProfile, false, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__));
    }
 }