add 'buffer' property to Monitor to access the buffer pointer directly.
This commit is contained in:
@@ -499,3 +499,14 @@ bool Monitor::GetPixels(BYTE* output, int x, int y, int width, int height)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
BYTE* Monitor::GetBuffer() const
|
||||
{
|
||||
if (!bufferForGetPixels_)
|
||||
{
|
||||
Debug::Error("Monitor::GetBuffer() => CopyTextureFromGpuToCpu() has not been called yet.");
|
||||
return nullptr;
|
||||
}
|
||||
return bufferForGetPixels_.Get();
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
void UseGetPixels(bool use);
|
||||
bool UseGetPixels() const;
|
||||
bool GetPixels(BYTE* output, int x, int y, int width, int height);
|
||||
BYTE* GetBuffer() const;
|
||||
|
||||
private:
|
||||
void CopyTextureFromGpuToCpu(ID3D11Texture2D* texture);
|
||||
|
||||
@@ -366,7 +366,7 @@ extern "C"
|
||||
return 0;
|
||||
}
|
||||
|
||||
UNITY_INTERFACE_EXPORT void* UNITY_INTERFACE_API GetMoveRects(int id)
|
||||
UNITY_INTERFACE_EXPORT DXGI_OUTDUPL_MOVE_RECT* UNITY_INTERFACE_API GetMoveRects(int id)
|
||||
{
|
||||
if (!g_manager) return nullptr;
|
||||
if (auto monitor = g_manager->GetMonitor(id))
|
||||
@@ -386,7 +386,7 @@ extern "C"
|
||||
return 0;
|
||||
}
|
||||
|
||||
UNITY_INTERFACE_EXPORT void* UNITY_INTERFACE_API GetDirtyRects(int id)
|
||||
UNITY_INTERFACE_EXPORT RECT* UNITY_INTERFACE_API GetDirtyRects(int id)
|
||||
{
|
||||
if (!g_manager) return nullptr;
|
||||
if (auto monitor = g_manager->GetMonitor(id))
|
||||
@@ -398,7 +398,7 @@ extern "C"
|
||||
|
||||
UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API GetPixels(int id, BYTE* output, int x, int y, int width, int height)
|
||||
{
|
||||
if (!g_manager) return nullptr;
|
||||
if (!g_manager) return false;
|
||||
if (auto monitor = g_manager->GetMonitor(id))
|
||||
{
|
||||
return monitor->GetPixels(output, x, y, width, height);
|
||||
@@ -406,6 +406,16 @@ extern "C"
|
||||
return false;
|
||||
}
|
||||
|
||||
UNITY_INTERFACE_EXPORT BYTE* UNITY_INTERFACE_API GetBuffer(int id)
|
||||
{
|
||||
if (!g_manager) return nullptr;
|
||||
if (auto monitor = g_manager->GetMonitor(id))
|
||||
{
|
||||
return monitor->GetBuffer();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API HasBeenUpdated(int id)
|
||||
{
|
||||
if (!g_manager) return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user