@@ -423,14 +423,6 @@ static INLINE float _attr_as_number(const psx_svg_attr* a)
423423 return a->value .fval ;
424424}
425425
426- static psx_svg_player_options _default_options (void )
427- {
428- psx_svg_player_options opt;
429- opt.loop = false ;
430- opt.dpi = 96 ;
431- return opt;
432- }
433-
434426static INLINE const psx_svg_attr* _find_attr (const psx_svg_node* node, psx_svg_attr_type type)
435427{
436428 if (!node) {
@@ -2130,9 +2122,7 @@ static void _collect_anims(psx_svg_player* p, const psx_svg_node* node)
21302122extern " C" {
21312123#endif
21322124
2133- static psx_svg_player* _psx_svg_player_create_impl (const psx_svg_node* root,
2134- const psx_svg_player_options* opt_in,
2135- psx_result* out)
2125+ psx_svg_player* psx_svg_player_create (const psx_svg_node* root, psx_result* out)
21362126{
21372127 if (out) {
21382128 *out = S_OK ;
@@ -2144,8 +2134,6 @@ static psx_svg_player* _psx_svg_player_create_impl(const psx_svg_node* root,
21442134 return NULL ;
21452135 }
21462136
2147- psx_svg_player_options opt = opt_in ? *opt_in : _default_options ();
2148-
21492137 psx_svg_player* p = (psx_svg_player*)mem_malloc (sizeof (psx_svg_player));
21502138 if (!p) {
21512139 if (out) {
@@ -2156,8 +2144,8 @@ static psx_svg_player* _psx_svg_player_create_impl(const psx_svg_node* root,
21562144 memset (p, 0 , sizeof (psx_svg_player));
21572145
21582146 p->root = root;
2159- p->loop = opt. loop ;
2160- p->dpi = (opt. dpi > 0 ) ? opt. dpi : 96 ;
2147+ p->loop = false ;
2148+ p->dpi = 96 ; // default dpi
21612149
21622150 p->render_list = psx_svg_render_list_create (root);
21632151 if (!p->render_list ) {
@@ -2211,16 +2199,6 @@ static psx_svg_player* _psx_svg_player_create_impl(const psx_svg_node* root,
22112199 return p;
22122200}
22132201
2214- psx_svg_player* psx_svg_player_create (const psx_svg_node* root,
2215- const psx_svg_player_options* opt_in,
2216- psx_result* out)
2217- {
2218- // We may need non-const access internally for indices/caches, but we do not
2219- // mutate the DOM in this minimal implementation.
2220- return _psx_svg_player_create_impl ((psx_svg_node*)root, opt_in, out);
2221- }
2222-
2223-
22242202void psx_svg_player_destroy (psx_svg_player* p)
22252203{
22262204 if (!p) {
@@ -2428,6 +2406,19 @@ bool psx_svg_player_get_loop(const psx_svg_player* p)
24282406 return p ? p->loop : false ;
24292407}
24302408
2409+ void psx_svg_player_set_dpi (psx_svg_player* p, int32_t dpi)
2410+ {
2411+ if (!p) {
2412+ return ;
2413+ }
2414+ p->dpi = dpi;
2415+ }
2416+
2417+ int32_t psx_svg_player_get_dpi (const psx_svg_player* p)
2418+ {
2419+ return p ? p->dpi : 0 ;
2420+ }
2421+
24312422void psx_svg_player_draw (psx_svg_player* p, ps_context* ctx)
24322423{
24332424 if (!p || !ctx || !p->render_list ) {
@@ -2531,7 +2522,6 @@ const psx_svg_node* psx_svg_player_get_node_by_id(const psx_svg_player* p, const
25312522
25322523 // FIXME: change to tree travls
25332524
2534-
25352525 // Parser stores element id into node->content(). We do a simple DFS.
25362526 const psx_svg_node* stack[64 ];
25372527 uint32_t sp = 0 ;
0 commit comments