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:
Hermet Park 2025-06-23 15:37:47 +09:00 committed by Hermet Park
parent 2aabddd5a5
commit caec92ddd3
4 changed files with 68 additions and 39 deletions

View file

@ -126,6 +126,12 @@ endif
#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')
if lottie_expressions
@ -230,6 +236,7 @@ summary(
summary(
{
'Partial Rendering': partial_render,
'Lottie Expressions': lottie_expressions,
'OpenGL Variant': gl_variant,
},

View file

@ -65,6 +65,6 @@ option('file',
option('extra',
type: 'array',
choices: ['', 'opengl_es', 'lottie_expressions'],
value: ['lottie_expressions'],
choices: ['', 'partial_render', 'opengl_es', 'lottie_expressions'],
value: ['partial_render', 'lottie_expressions'],
description: '"Enable support for extra options')

View file

@ -20,7 +20,6 @@
* SOFTWARE.
*/
#include <algorithm>
#include "tvgMath.h"
#include "tvgRender.h"
@ -131,6 +130,9 @@ void RenderRegion::intersect(const RenderRegion& rhs)
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)
{
@ -311,6 +313,8 @@ void RenderDirtyRegion::commit()
}
}
#endif
/************************************************************************/
/* RenderTrimPath Class Implementation */
/************************************************************************/

View file

@ -155,6 +155,8 @@ struct RenderRegion
uint32_t h() const { return (uint32_t) sh(); }
};
#ifdef THORVG_PARTIAL_RENDER_SUPPORT
struct RenderDirtyRegion
{
public:
@ -200,6 +202,22 @@ private:
Partition partitions[PARTITIONING];
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
{