mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-24 17:01:56 +00:00
infra: add the partial rendering build option
allow users to set partial rendering as option to use, enabled by deault. -Dextra="partial_render, ..."
This commit is contained in:
parent
2aabddd5a5
commit
caec92ddd3
4 changed files with 68 additions and 39 deletions
|
@ -126,6 +126,12 @@ endif
|
||||||
|
|
||||||
|
|
||||||
#Extra
|
#Extra
|
||||||
|
partial_render = get_option('extra').contains('partial_render')
|
||||||
|
|
||||||
|
if partial_render
|
||||||
|
config_h.set10('THORVG_PARTIAL_RENDER_SUPPORT', true)
|
||||||
|
endif
|
||||||
|
|
||||||
lottie_expressions = lottie_loader and get_option('extra').contains('lottie_expressions')
|
lottie_expressions = lottie_loader and get_option('extra').contains('lottie_expressions')
|
||||||
|
|
||||||
if lottie_expressions
|
if lottie_expressions
|
||||||
|
@ -230,6 +236,7 @@ summary(
|
||||||
|
|
||||||
summary(
|
summary(
|
||||||
{
|
{
|
||||||
|
'Partial Rendering': partial_render,
|
||||||
'Lottie Expressions': lottie_expressions,
|
'Lottie Expressions': lottie_expressions,
|
||||||
'OpenGL Variant': gl_variant,
|
'OpenGL Variant': gl_variant,
|
||||||
},
|
},
|
||||||
|
|
|
@ -65,6 +65,6 @@ option('file',
|
||||||
|
|
||||||
option('extra',
|
option('extra',
|
||||||
type: 'array',
|
type: 'array',
|
||||||
choices: ['', 'opengl_es', 'lottie_expressions'],
|
choices: ['', 'partial_render', 'opengl_es', 'lottie_expressions'],
|
||||||
value: ['lottie_expressions'],
|
value: ['partial_render', 'lottie_expressions'],
|
||||||
description: '"Enable support for extra options')
|
description: '"Enable support for extra options')
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include "tvgMath.h"
|
#include "tvgMath.h"
|
||||||
#include "tvgRender.h"
|
#include "tvgRender.h"
|
||||||
|
|
||||||
|
@ -131,6 +130,9 @@ void RenderRegion::intersect(const RenderRegion& rhs)
|
||||||
if (max.y < min.y) max.y = min.y;
|
if (max.y < min.y) max.y = min.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef THORVG_PARTIAL_RENDER_SUPPORT
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
void RenderDirtyRegion::init(uint32_t w, uint32_t h)
|
void RenderDirtyRegion::init(uint32_t w, uint32_t h)
|
||||||
{
|
{
|
||||||
|
@ -311,6 +313,8 @@ void RenderDirtyRegion::commit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* RenderTrimPath Class Implementation */
|
/* RenderTrimPath Class Implementation */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
|
@ -155,9 +155,11 @@ struct RenderRegion
|
||||||
uint32_t h() const { return (uint32_t) sh(); }
|
uint32_t h() const { return (uint32_t) sh(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RenderDirtyRegion
|
|
||||||
{
|
#ifdef THORVG_PARTIAL_RENDER_SUPPORT
|
||||||
public:
|
struct RenderDirtyRegion
|
||||||
|
{
|
||||||
|
public:
|
||||||
static constexpr const int PARTITIONING = 16; //must be N*N
|
static constexpr const int PARTITIONING = 16; //must be N*N
|
||||||
|
|
||||||
void init(uint32_t w, uint32_t h);
|
void init(uint32_t w, uint32_t h);
|
||||||
|
@ -186,7 +188,7 @@ public:
|
||||||
return partitions[idx].list[partitions[idx].current];
|
return partitions[idx].list[partitions[idx].current];
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void subdivide(Array<RenderRegion>& targets, uint32_t idx, RenderRegion& lhs, RenderRegion& rhs);
|
void subdivide(Array<RenderRegion>& targets, uint32_t idx, RenderRegion& lhs, RenderRegion& rhs);
|
||||||
|
|
||||||
struct Partition
|
struct Partition
|
||||||
|
@ -199,7 +201,23 @@ private:
|
||||||
Key key;
|
Key key;
|
||||||
Partition partitions[PARTITIONING];
|
Partition partitions[PARTITIONING];
|
||||||
bool disabled = false;
|
bool disabled = false;
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
struct RenderDirtyRegion
|
||||||
|
{
|
||||||
|
static constexpr const int PARTITIONING = 16; //must be N*N
|
||||||
|
|
||||||
|
void init(uint32_t w, uint32_t h) {}
|
||||||
|
void commit() {}
|
||||||
|
void add(TVG_UNUSED const RenderRegion* prv, TVG_UNUSED const RenderRegion* cur) {}
|
||||||
|
void clear() {}
|
||||||
|
bool deactivate(TVG_UNUSED bool on) { return true; }
|
||||||
|
bool deactivated() { return true; }
|
||||||
|
const RenderRegion& partition(TVG_UNUSED int idx) { static RenderRegion tmp{}; return tmp; }
|
||||||
|
const Array<RenderRegion>& get(TVG_UNUSED int idx) { static Array<RenderRegion> tmp; return tmp; }
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct RenderPath
|
struct RenderPath
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue