Add HB_ALWAYS_INLINE

With MSVC implementation as well.
This commit is contained in:
Behdad Esfahbod 2023-06-29 14:41:21 -06:00
parent 0a00dc0c71
commit ca44c38c52
4 changed files with 18 additions and 12 deletions

View file

@ -297,7 +297,7 @@ struct glyf_accelerator_t
if (extents) bounds = contour_bounds_t ();
}
__attribute__((always_inline))
HB_ALWAYS_INLINE
void consume_point (const contour_point_t &point) { bounds.add (point); }
void points_end () { bounds.get_extents (font, extents, scaled); }

View file

@ -37,7 +37,7 @@ struct path_builder_t
* https://stackoverflow.com/a/20772557
*
* Cubic support added. */
__attribute__((always_inline))
HB_ALWAYS_INLINE
void consume_point (const contour_point_t &point)
{
bool is_on_curve = point.flag & glyf_impl::SimpleGlyph::FLAG_ON_CURVE;

View file

@ -94,7 +94,7 @@ struct hb_draw_funcs_t
void
__attribute__((__always_inline__))
HB_ALWAYS_INLINE
move_to (void *draw_data, hb_draw_state_t &st,
float to_x, float to_y)
{
@ -104,7 +104,7 @@ struct hb_draw_funcs_t
}
void
__attribute__((__always_inline__))
HB_ALWAYS_INLINE
line_to (void *draw_data, hb_draw_state_t &st,
float to_x, float to_y)
{
@ -115,7 +115,7 @@ struct hb_draw_funcs_t
}
void
__attribute__((__always_inline__))
HB_ALWAYS_INLINE
quadratic_to (void *draw_data, hb_draw_state_t &st,
float control_x, float control_y,
float to_x, float to_y)
@ -127,7 +127,7 @@ struct hb_draw_funcs_t
}
void
__attribute__((__always_inline__))
HB_ALWAYS_INLINE
cubic_to (void *draw_data, hb_draw_state_t &st,
float control1_x, float control1_y,
float control2_x, float control2_y,
@ -140,7 +140,7 @@ struct hb_draw_funcs_t
}
void
__attribute__((__always_inline__))
HB_ALWAYS_INLINE
close_path (void *draw_data, hb_draw_state_t &st)
{
if (likely (st.path_open))
@ -175,7 +175,7 @@ struct hb_draw_session_t
~hb_draw_session_t () { close_path (); }
__attribute__((__always_inline__))
HB_ALWAYS_INLINE
void move_to (float to_x, float to_y)
{
if (likely (not_slanted))
@ -185,7 +185,7 @@ struct hb_draw_session_t
funcs->move_to (draw_data, st,
to_x + to_y * slant, to_y);
}
__attribute__((__always_inline__))
HB_ALWAYS_INLINE
void line_to (float to_x, float to_y)
{
if (likely (not_slanted))
@ -196,7 +196,7 @@ struct hb_draw_session_t
to_x + to_y * slant, to_y);
}
void
__attribute__((__always_inline__))
HB_ALWAYS_INLINE
quadratic_to (float control_x, float control_y,
float to_x, float to_y)
{
@ -210,7 +210,7 @@ struct hb_draw_session_t
to_x + to_y * slant, to_y);
}
void
__attribute__((__always_inline__))
HB_ALWAYS_INLINE
cubic_to (float control1_x, float control1_y,
float control2_x, float control2_y,
float to_x, float to_y)
@ -226,7 +226,7 @@ struct hb_draw_session_t
control2_x + control2_y * slant, control2_y,
to_x + to_y * slant, to_y);
}
__attribute__((__always_inline__))
HB_ALWAYS_INLINE
void close_path ()
{
funcs->close_path (draw_data, st);

View file

@ -315,6 +315,12 @@ extern "C" void hb_free_impl(void *ptr);
#define __restrict
#endif
#if defined(_MSC_VER)
#define HB_ALWAYS_INLINE __forceinline
#else
#define HB_ALWAYS_INLINE __attribute__((always_inline)) inline
#endif
/*
* Borrowed from https://bugzilla.mozilla.org/show_bug.cgi?id=1215411
* HB_FALLTHROUGH is an annotation to suppress compiler warnings about switch