From 9f518764b6f1bc17bbbd20fba9ba961fd0473a6e Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Thu, 8 Mar 2018 11:28:23 +0100 Subject: [PATCH] gfx: Move util::SourceTexture to gfx::SourceTexture 'gfx' is the new preview for Graphics utilities that do not act as a wrapper around the Graphics Subsystem directly. --- CMakeLists.txt | 4 ++-- ...source-texture.cpp => gfx-source-texture.cpp} | 16 ++++++++-------- ...til-source-texture.h => gfx-source-texture.h} | 2 +- source/source-mirror.cpp | 2 +- source/source-mirror.h | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) rename source/{util-source-texture.cpp => gfx-source-texture.cpp} (79%) rename source/{util-source-texture.h => gfx-source-texture.h} (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d3093b7..017688ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ SET(obs-stream-effects_HEADERS "${PROJECT_SOURCE_DIR}/source/strings.h" "${PROJECT_SOURCE_DIR}/source/util-math.h" "${PROJECT_SOURCE_DIR}/source/util-memory.h" - "${PROJECT_SOURCE_DIR}/source/util-source-texture.h" + "${PROJECT_SOURCE_DIR}/source/gfx-source-texture.h" ) SET(obs-stream-effects_SOURCES "${PROJECT_SOURCE_DIR}/source/plugin.cpp" @@ -73,7 +73,7 @@ SET(obs-stream-effects_SOURCES "${PROJECT_SOURCE_DIR}/source/gs-vertexbuffer.cpp" "${PROJECT_SOURCE_DIR}/source/util-math.cpp" "${PROJECT_SOURCE_DIR}/source/util-memory.cpp" - "${PROJECT_SOURCE_DIR}/source/util-source-texture.cpp" + "${PROJECT_SOURCE_DIR}/source/gfx-source-texture.cpp" ) SET(obs-stream-effects_LOCALE "${PROJECT_SOURCE_DIR}/data/locale/en-US.ini" diff --git a/source/util-source-texture.cpp b/source/gfx-source-texture.cpp similarity index 79% rename from source/util-source-texture.cpp rename to source/gfx-source-texture.cpp index 670ddbf5..d8c9b2d4 100644 --- a/source/util-source-texture.cpp +++ b/source/gfx-source-texture.cpp @@ -15,9 +15,9 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -#include "util-source-texture.h" +#include "gfx-source-texture.h" -util::SourceTexture::~SourceTexture() { +gfx::SourceTexture::~SourceTexture() { if (m_source) { obs_source_release(m_source); m_source = nullptr; @@ -25,31 +25,31 @@ util::SourceTexture::~SourceTexture() { m_rt = nullptr; } -util::SourceTexture::SourceTexture() { +gfx::SourceTexture::SourceTexture() { m_rt = std::make_shared(GS_RGBA, GS_ZS_NONE); } -obs_source_t* util::SourceTexture::GetObject() { +obs_source_t* gfx::SourceTexture::GetObject() { return m_source; } -util::SourceTexture::SourceTexture(const char* name) : SourceTexture() { +gfx::SourceTexture::SourceTexture(const char* name) : SourceTexture() { m_source = obs_get_source_by_name(name); if (!m_source) { throw std::invalid_argument("No such source."); } } -util::SourceTexture::SourceTexture(std::string name) : SourceTexture(name.c_str()) {} +gfx::SourceTexture::SourceTexture(std::string name) : SourceTexture(name.c_str()) {} -util::SourceTexture::SourceTexture(obs_source_t* src) : SourceTexture() { +gfx::SourceTexture::SourceTexture(obs_source_t* src) : SourceTexture() { m_source = src; if (!m_source) { throw std::invalid_argument("No such source."); } } -std::shared_ptr util::SourceTexture::Render(size_t width, size_t height) { +std::shared_ptr gfx::SourceTexture::Render(size_t width, size_t height) { if (!m_source) { throw std::invalid_argument("Missing source to render."); } diff --git a/source/util-source-texture.h b/source/gfx-source-texture.h similarity index 98% rename from source/util-source-texture.h rename to source/gfx-source-texture.h index 8422fe51..db32cdd0 100644 --- a/source/util-source-texture.h +++ b/source/gfx-source-texture.h @@ -22,7 +22,7 @@ #include "gs-texture.h" #include "gs-rendertarget.h" -namespace util { +namespace gfx { class SourceTexture { obs_source_t* m_source; std::shared_ptr m_rt; diff --git a/source/source-mirror.cpp b/source/source-mirror.cpp index 0a1ef78b..2bedee20 100644 --- a/source/source-mirror.cpp +++ b/source/source-mirror.cpp @@ -233,7 +233,7 @@ void Source::Mirror::update(obs_data_t* data) { const char* sourceName = obs_data_get_string(data, P_SOURCE); if (sourceName != m_mirrorName) { try { - m_mirrorSource = std::make_unique(sourceName); + m_mirrorSource = std::make_unique(sourceName); m_mirrorName = sourceName; } catch (...) { } diff --git a/source/source-mirror.h b/source/source-mirror.h index 2fb9e461..fc5a9636 100644 --- a/source/source-mirror.h +++ b/source/source-mirror.h @@ -21,7 +21,7 @@ #include "plugin.h" #include "gs-rendertarget.h" #include "gs-sampler.h" -#include "util-source-texture.h" +#include "gfx-source-texture.h" #include namespace Source { @@ -62,7 +62,7 @@ namespace Source { std::shared_ptr m_sampler; gs_effect_t* m_scalingEffect = nullptr; - std::unique_ptr m_mirrorSource; + std::unique_ptr m_mirrorSource; std::string m_mirrorName; public: