From 71eb37f44ebdd526f55aa6f65f2f937da256952d Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 23 Jul 2017 21:29:24 -0500 Subject: [PATCH] gpu - small refinements to BPP-setting interfaces --- desmume/src/GPU.cpp | 9 +++++++++ desmume/src/GPU.h | 1 + 2 files changed, 10 insertions(+) diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index f6fb264c8..9b23ba00d 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -8125,6 +8125,10 @@ void GPUSubsystem::SetCustomFramebufferSize(size_t w, size_t h) void GPUSubsystem::SetColorFormat(const NDSColorFormat outputFormat) { + //check for no-op + if(this->_displayInfo.colorFormat == outputFormat) + return; + this->_displayInfo.colorFormat = outputFormat; this->_displayInfo.pixelBytes = (outputFormat == NDSColorFormat_BGR555_Rev) ? sizeof(u16) : sizeof(FragmentColor); @@ -8136,6 +8140,11 @@ void GPUSubsystem::SetColorFormat(const NDSColorFormat outputFormat) this->_AllocateFramebuffers(this->_displayInfo.colorFormat, this->_displayInfo.customWidth, this->_displayInfo.customHeight); } +NDSColorFormat GPUSubsystem::GetColorFormat() const +{ + return this->_displayInfo.colorFormat; +} + void GPUSubsystem::_AllocateFramebuffers(NDSColorFormat outputFormat, size_t w, size_t h) { void *oldMasterFramebuffer = this->_masterFramebuffer; diff --git a/desmume/src/GPU.h b/desmume/src/GPU.h index 966897bf2..b92802f3c 100644 --- a/desmume/src/GPU.h +++ b/desmume/src/GPU.h @@ -1716,6 +1716,7 @@ public: size_t GetCustomFramebufferHeight() const; void SetCustomFramebufferSize(size_t w, size_t h); void SetColorFormat(const NDSColorFormat outputFormat); + NDSColorFormat GetColorFormat() const; bool GetWillFrameSkip() const; void SetWillFrameSkip(const bool willFrameSkip);