mirror of
https://github.com/SFML/SFML.git
synced 2025-02-23 14:56:02 +08:00
Remove pointer indirection
We don't need to heap allocate the context or use the pimpl idiom here.
This commit is contained in:
parent
1a06f6c395
commit
3d4a5f9399
@ -42,10 +42,6 @@ namespace sf::priv
|
||||
RenderTextureImplDefault::RenderTextureImplDefault() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderTextureImplDefault::~RenderTextureImplDefault() = default;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int RenderTextureImplDefault::getMaximumAntiAliasingLevel()
|
||||
{
|
||||
@ -63,7 +59,7 @@ bool RenderTextureImplDefault::create(Vector2u size, unsigned int, const Context
|
||||
m_size = size;
|
||||
|
||||
// Create the in-memory OpenGL context
|
||||
m_context = std::make_unique<Context>(settings, size);
|
||||
m_context = {settings, size};
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -72,14 +68,14 @@ bool RenderTextureImplDefault::create(Vector2u size, unsigned int, const Context
|
||||
////////////////////////////////////////////////////////////
|
||||
bool RenderTextureImplDefault::activate(bool active)
|
||||
{
|
||||
return m_context->setActive(active);
|
||||
return m_context.setActive(active);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool RenderTextureImplDefault::isSrgb() const
|
||||
{
|
||||
return m_context->getSettings().sRgbCapable;
|
||||
return m_context.getSettings().sRgbCapable;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,19 +29,11 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/RenderTextureImpl.hpp>
|
||||
|
||||
#include <SFML/Window/Context.hpp>
|
||||
#include <SFML/Window/GlResource.hpp>
|
||||
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
class Context;
|
||||
struct ContextSettings;
|
||||
|
||||
namespace priv
|
||||
namespace sf::priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default specialization of RenderTextureImpl,
|
||||
@ -57,12 +49,6 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderTextureImplDefault();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
~RenderTextureImplDefault() override;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the maximum anti-aliasing level supported by the system
|
||||
///
|
||||
@ -116,10 +102,8 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
std::unique_ptr<Context> m_context; //!< P-Buffer based context
|
||||
Vector2u m_size; //!< Width and height of the P-Buffer
|
||||
Context m_context; //!< P-Buffer based context
|
||||
Vector2u m_size; //!< Width and height of the P-Buffer
|
||||
};
|
||||
|
||||
} // namespace priv
|
||||
|
||||
} // namespace sf
|
||||
} // namespace sf::priv
|
||||
|
Loading…
x
Reference in New Issue
Block a user