gs-rendertarget: Add and implement GetTexture(...) methods

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2018-03-05 15:10:51 +01:00
parent 7d065c131d
commit cc68e2864f
2 changed files with 17 additions and 0 deletions

View file

@ -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<GS::Texture>& tex) {
tex = std::make_shared<GS::Texture>(GetTextureObject(), false);
}
void GS::RenderTarget::GetTexture(std::unique_ptr<GS::Texture>& tex) {
tex = std::make_unique<GS::Texture>(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");

View file

@ -19,6 +19,8 @@
#pragma once
#include <inttypes.h>
#include <memory>
#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<GS::Texture>& tex);
void GetTexture(std::unique_ptr<GS::Texture>& tex);
GS::RenderTargetOp Render(uint32_t width, uint32_t height);
protected: