mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-28 09:05:52 +00:00
canvas: fix for SwCanvas Unit Test
Fixed to fail canvas generation if engines are not initialized.
This commit is contained in:
parent
314b96651b
commit
eda022365f
6 changed files with 16 additions and 0 deletions
|
@ -257,6 +257,12 @@ int GlRenderer::init(uint32_t threads)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t GlRenderer::init()
|
||||||
|
{
|
||||||
|
return initEngineCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int GlRenderer::term()
|
int GlRenderer::term()
|
||||||
{
|
{
|
||||||
if ((--initEngineCnt) > 0) return true;
|
if ((--initEngineCnt) > 0) return true;
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
|
|
||||||
static GlRenderer* gen();
|
static GlRenderer* gen();
|
||||||
static int init(TVG_UNUSED uint32_t threads);
|
static int init(TVG_UNUSED uint32_t threads);
|
||||||
|
static int32_t init();
|
||||||
static int term();
|
static int term();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -622,6 +622,12 @@ bool SwRenderer::init(uint32_t threads)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32_t SwRenderer::init()
|
||||||
|
{
|
||||||
|
return initEngineCnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SwRenderer::term()
|
bool SwRenderer::term()
|
||||||
{
|
{
|
||||||
if ((--initEngineCnt) > 0) return true;
|
if ((--initEngineCnt) > 0) return true;
|
||||||
|
|
|
@ -57,6 +57,7 @@ public:
|
||||||
|
|
||||||
static SwRenderer* gen();
|
static SwRenderer* gen();
|
||||||
static bool init(uint32_t threads);
|
static bool init(uint32_t threads);
|
||||||
|
static int32_t init();
|
||||||
static bool term();
|
static bool term();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -80,6 +80,7 @@ Result GlCanvas::target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t
|
||||||
unique_ptr<GlCanvas> GlCanvas::gen() noexcept
|
unique_ptr<GlCanvas> GlCanvas::gen() noexcept
|
||||||
{
|
{
|
||||||
#ifdef THORVG_GL_RASTER_SUPPORT
|
#ifdef THORVG_GL_RASTER_SUPPORT
|
||||||
|
if (GlRenderer::init() <= 0) return nullptr;
|
||||||
return unique_ptr<GlCanvas>(new GlCanvas);
|
return unique_ptr<GlCanvas>(new GlCanvas);
|
||||||
#endif
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -98,6 +98,7 @@ Result SwCanvas::target(uint32_t* buffer, uint32_t stride, uint32_t w, uint32_t
|
||||||
unique_ptr<SwCanvas> SwCanvas::gen() noexcept
|
unique_ptr<SwCanvas> SwCanvas::gen() noexcept
|
||||||
{
|
{
|
||||||
#ifdef THORVG_SW_RASTER_SUPPORT
|
#ifdef THORVG_SW_RASTER_SUPPORT
|
||||||
|
if (SwRenderer::init() <= 0) return nullptr;
|
||||||
return unique_ptr<SwCanvas>(new SwCanvas);
|
return unique_ptr<SwCanvas>(new SwCanvas);
|
||||||
#endif
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue