mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added more unique_ptr use, for functions that create LowLevelGraphicsContext or ImageType objects.
This commit is contained in:
parent
62ead7dc7d
commit
f58eacc135
16 changed files with 88 additions and 69 deletions
|
|
@ -1804,31 +1804,31 @@ static void clearOpenGLGlyphCacheCallback()
|
|||
SavedState::GlyphCacheType::getInstance().reset();
|
||||
}
|
||||
|
||||
static LowLevelGraphicsContext* createOpenGLContext (const Target& target)
|
||||
static std::unique_ptr<LowLevelGraphicsContext> createOpenGLContext (const Target& target)
|
||||
{
|
||||
clearOpenGLGlyphCache = clearOpenGLGlyphCacheCallback;
|
||||
|
||||
if (target.context.areShadersAvailable())
|
||||
return new ShaderContext (target);
|
||||
return std::make_unique<ShaderContext> (target);
|
||||
|
||||
Image tempImage (Image::ARGB, target.bounds.getWidth(), target.bounds.getHeight(), true, SoftwareImageType());
|
||||
return new NonShaderContext (target, tempImage);
|
||||
return std::make_unique<NonShaderContext> (target, tempImage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext& context, int width, int height)
|
||||
std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext& context, int width, int height)
|
||||
{
|
||||
return createOpenGLGraphicsContext (context, context.getFrameBufferID(), width, height);
|
||||
}
|
||||
|
||||
LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext& context, OpenGLFrameBuffer& target)
|
||||
std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext& context, OpenGLFrameBuffer& target)
|
||||
{
|
||||
return OpenGLRendering::createOpenGLContext (OpenGLRendering::Target (context, target, {}));
|
||||
}
|
||||
|
||||
LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext& context, unsigned int frameBufferID, int width, int height)
|
||||
std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext& context, unsigned int frameBufferID, int width, int height)
|
||||
{
|
||||
return OpenGLRendering::createOpenGLContext (OpenGLRendering::Target (context, frameBufferID, width, height));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,20 +30,20 @@ namespace juce
|
|||
/** Creates a graphics context object that will render into the given OpenGL target.
|
||||
The caller is responsible for deleting this object when no longer needed.
|
||||
*/
|
||||
LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext&, int width, int height);
|
||||
std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext&, int width, int height);
|
||||
|
||||
/** Creates a graphics context object that will render into the given OpenGL framebuffer.
|
||||
The caller is responsible for deleting this object when no longer needed.
|
||||
*/
|
||||
LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext&, OpenGLFrameBuffer&);
|
||||
std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext&, OpenGLFrameBuffer&);
|
||||
|
||||
/** Creates a graphics context object that will render into the given OpenGL framebuffer,
|
||||
with the given size.
|
||||
The caller is responsible for deleting this object when no longer needed.
|
||||
*/
|
||||
LowLevelGraphicsContext* createOpenGLGraphicsContext (OpenGLContext&,
|
||||
unsigned int frameBufferID,
|
||||
int width, int height);
|
||||
std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext&,
|
||||
unsigned int frameBufferID,
|
||||
int width, int height);
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -43,13 +43,13 @@ public:
|
|||
return frameBuffer.initialise (context, width, height);
|
||||
}
|
||||
|
||||
LowLevelGraphicsContext* createLowLevelContext() override
|
||||
std::unique_ptr<LowLevelGraphicsContext> createLowLevelContext() override
|
||||
{
|
||||
sendDataChangeMessage();
|
||||
return createOpenGLGraphicsContext (context, frameBuffer);
|
||||
}
|
||||
|
||||
ImageType* createType() const override { return new OpenGLImageType(); }
|
||||
std::unique_ptr<ImageType> createType() const override { return std::make_unique<OpenGLImageType>(); }
|
||||
|
||||
ImagePixelData::Ptr clone() override
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue