From cc68e2864fe4f58d6072ea71f2ce365c50f06c22 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Mon, 5 Mar 2018 15:10:51 +0100 Subject: [PATCH] gs-rendertarget: Add and implement GetTexture(...) methods --- source/gs-rendertarget.cpp | 12 ++++++++++++ source/gs-rendertarget.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/source/gs-rendertarget.cpp b/source/gs-rendertarget.cpp index 65428740..8e5ce3f9 100644 --- a/source/gs-rendertarget.cpp +++ b/source/gs-rendertarget.cpp @@ -50,6 +50,18 @@ gs_texture_t* GS::RenderTarget::GetTextureObject() { return tex; } +void GS::RenderTarget::GetTexture(GS::Texture& tex) { + tex = GS::Texture(GetTextureObject(), false); +} + +void GS::RenderTarget::GetTexture(std::shared_ptr& tex) { + tex = std::make_shared(GetTextureObject(), false); +} + +void GS::RenderTarget::GetTexture(std::unique_ptr& tex) { + tex = std::make_unique(GetTextureObject(), false); +} + GS::RenderTargetOp::RenderTargetOp(GS::RenderTarget* rt, uint32_t width, uint32_t height) : m_renderTarget(rt) { if (m_renderTarget == nullptr) throw std::invalid_argument("rt"); diff --git a/source/gs-rendertarget.h b/source/gs-rendertarget.h index ce1c62c3..f866d835 100644 --- a/source/gs-rendertarget.h +++ b/source/gs-rendertarget.h @@ -19,6 +19,8 @@ #pragma once #include +#include +#include "gs-texture.h" extern "C" { #pragma warning( push ) #pragma warning( disable: 4201 ) @@ -35,6 +37,9 @@ namespace GS { virtual ~RenderTarget(); gs_texture_t* GetTextureObject(); + void GetTexture(GS::Texture& tex); + void GetTexture(std::shared_ptr& tex); + void GetTexture(std::unique_ptr& tex); GS::RenderTargetOp Render(uint32_t width, uint32_t height); protected: