ector_software_rasterizer: Add default value for stroke's miter_limit

Summary:
Currently the default value of miter_limit is defined as 0.
miter_limit should be specified to a value other than 0. becuase it is affected by width.
See below for an explanation of this.
https://www.freetype.org/freetype2/docs/reference/ft2-glyph_stroker.html#ft_stroker_linejoin

There is no particular reason why the default value is 0x4.
It only refers to the standard of web svg.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-miterlimit

Test Plan:
   setenv("ECTOR_BACKEND", "default", 1);
   elm_init(argc, argv);
   Evas_Object *win = elm_win_util_standard_add(NULL, "test");
   evas_object_smart_callback_add(win, "delete,request", win_del, 0);
   elm_win_autodel_set(win, 1);
   Evas_Object *bg = elm_bg_add(win);
   elm_bg_color_set(bg, 255,255,255);
   evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_show(bg);

   Evas *evas = evas_object_evas_get(win);

   Evas_Object *vg = evas_object_vg_add(evas);
   evas_object_show(vg);
   Evas_Object *container = evas_vg_container_add(vg);

   Evas_Object *shape = evas_vg_shape_add(container); //Default is EFL_GFX_JOIN_MITER
   evas_vg_shape_append_rect(shape, 0, 0, 100 , 100, 0, 0);
   evas_vg_shape_stroke_color_set(shape, 255, 0, 0, 255);
   evas_vg_shape_stroke_width_set(shape, 10);
   evas_vg_node_origin_set(shape, 50, 150);

   shape = evas_vg_shape_add(container);
   evas_vg_shape_append_rect(shape, 0, 0, 100 , 100, 0, 0);
   evas_vg_shape_stroke_join_set(shape, EFL_GFX_JOIN_BEVEL);
   evas_vg_shape_stroke_color_set(shape, 255, 0, 0, 255);
   evas_vg_shape_stroke_width_set(shape, 10);
   evas_vg_node_origin_set(shape, 200, 150);

   shape = evas_vg_shape_add(container);
   evas_vg_shape_append_rect(shape, 0, 0, 100 , 100, 0, 0);
   evas_vg_shape_stroke_join_set(shape, EFL_GFX_JOIN_ROUND);
   evas_vg_shape_stroke_color_set(shape, 255, 0, 0, 255);
   evas_vg_shape_stroke_width_set(shape, 10);
   evas_vg_node_origin_set(shape, 350, 150);

   evas_object_vg_root_node_set(vg, container);
   elm_object_content_set(bg, vg);

   elm_win_resize_object_add(win, bg);
   evas_object_resize(win, WIDTH, HEIGHT);
   evas_object_show(win);
   elm_run();
   elm_shutdown();

Reviewers: smohanty, Hermet, kimcinoo

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9492
This commit is contained in:
junsu choi 2019-08-05 18:08:50 +09:00 committed by Hermet Park
parent 7869778d02
commit 949cf2750b
1 changed files with 6 additions and 2 deletions

View File

@ -664,7 +664,7 @@ void ector_software_thread_init(Ector_Software_Thread *thread)
SW_FT_Stroker_New(&thread->stroker);
SW_FT_Stroker_Set(thread->stroker, 1 << 6,
SW_FT_STROKER_LINECAP_BUTT, SW_FT_STROKER_LINEJOIN_MITER, 0);
SW_FT_STROKER_LINECAP_BUTT, SW_FT_STROKER_LINEJOIN_MITER, 0x4<<16);
}
void ector_software_rasterizer_init(Software_Rasterizer *rasterizer)
@ -692,6 +692,10 @@ void ector_software_rasterizer_stroke_set(Ector_Software_Thread *thread,
SW_FT_Stroker_LineJoin join;
int stroke_width;
double scale_factor = 1.0;
//TODO: The interface to change the value of the miter_limit is not yet ready.
SW_FT_Fixed miter_limit = 0x4<<16;
if (m)
{
// get the minimum scale factor from matrix
@ -728,7 +732,7 @@ void ector_software_rasterizer_stroke_set(Ector_Software_Thread *thread,
join = SW_FT_STROKER_LINEJOIN_MITER;
break;
}
SW_FT_Stroker_Set(thread->stroker, stroke_width, cap, join, 0);
SW_FT_Stroker_Set(thread->stroker, stroke_width, cap, join, miter_limit);
}
static void