diff --git a/src/hb-vector-draw.cc b/src/hb-vector-draw.cc index 983162dfd..1d4249d5e 100644 --- a/src/hb-vector-draw.cc +++ b/src/hb-vector-draw.cc @@ -491,7 +491,7 @@ hb_vector_draw_set_glyph_extents (hb_vector_draw_t *draw, const hb_glyph_extents_t *glyph_extents) { hb_bool_t has_extents = draw->has_extents; - hb_bool_t ret = hb_svg_set_glyph_extents_common (draw->transform, + hb_bool_t ret = hb_vector_set_glyph_extents_common (draw->transform, draw->x_scale_factor, draw->y_scale_factor, glyph_extents, @@ -562,7 +562,7 @@ hb_vector_draw_glyph (hb_vector_draw_t *draw, hb_transform_t<> extents_transform = {xx, yx, -xy, -yy, tx, ty}; hb_bool_t has_extents = draw->has_extents; - hb_svg_set_glyph_extents_common (extents_transform, + hb_vector_set_glyph_extents_common (extents_transform, draw->x_scale_factor, draw->y_scale_factor, &ge, diff --git a/src/hb-vector-draw.hh b/src/hb-vector-draw.hh index 6f7603c33..6d0309891 100644 --- a/src/hb-vector-draw.hh +++ b/src/hb-vector-draw.hh @@ -31,7 +31,7 @@ struct hb_vector_draw_t void append_xy (float x, float y) { float tx, ty; - hb_svg_transform_point (transform, x_scale_factor, y_scale_factor, x, y, &tx, &ty); + hb_vector_transform_point (transform, x_scale_factor, y_scale_factor, x, y, &tx, &ty); hb_buf_append_num (&path, tx, precision); switch (format) { diff --git a/src/hb-vector-paint-pdf.cc b/src/hb-vector-paint-pdf.cc index 9b7923573..d6236c914 100644 --- a/src/hb-vector-paint-pdf.cc +++ b/src/hb-vector-paint-pdf.cc @@ -1070,7 +1070,7 @@ hb_pdf_paint_sweep_gradient (hb_paint_funcs_t *, hb_vector_t mesh; mesh.alloc (256); - hb_sweep_gradient_tiles (stops, n_stops, extend, + hb_vector_sweep_gradient_tiles (stops, n_stops, extend, start_angle, end_angle, [&] (float a0, hb_color_t c0, float a1, hb_color_t c1) { hb_pdf_add_sweep_patch (&mesh, cx, cy, xlo, xhi, ylo, yhi, diff --git a/src/hb-vector-paint.cc b/src/hb-vector-paint.cc index bc42db0af..883aeacb8 100644 --- a/src/hb-vector-paint.cc +++ b/src/hb-vector-paint.cc @@ -42,7 +42,7 @@ hb_svg_paint_append_global_transform_prefix (hb_vector_paint_t *paint, hb_vector paint->x_scale_factor == 1.f && paint->y_scale_factor == 1.f) return; - unsigned sprec = hb_svg_scale_precision (paint->precision); + unsigned sprec = hb_vector_scale_precision (paint->precision); hb_buf_append_str (buf, "transform.xx / paint->x_scale_factor, sprec, true); hb_buf_append_c (buf, ','); @@ -69,8 +69,8 @@ hb_svg_paint_append_global_transform_suffix (hb_vector_paint_t *paint, hb_vector hb_buf_append_str (buf, "\n"); } -static inline hb_svg_color_glyph_cache_key_t -hb_svg_color_glyph_cache_key (hb_codepoint_t glyph, +static inline hb_vector_color_glyph_cache_key_t +hb_vector_color_glyph_cache_key (hb_codepoint_t glyph, unsigned palette, hb_color_t foreground) { @@ -78,7 +78,7 @@ hb_svg_color_glyph_cache_key (hb_codepoint_t glyph, } static hb_bool_t -hb_svg_get_color_stops (hb_vector_paint_t *paint, +hb_vector_get_color_stops (hb_vector_paint_t *paint, hb_color_line_t *color_line, hb_vector_t *stops) { @@ -118,7 +118,7 @@ hb_svg_extend_mode_str (hb_paint_extend_t ext) } static int -hb_svg_color_stop_cmp (const void *a, const void *b) +hb_vector_color_stop_cmp (const void *a, const void *b) { const hb_color_stop_t *x = (const hb_color_stop_t *) a; const hb_color_stop_t *y = (const hb_color_stop_t *) b; @@ -431,7 +431,7 @@ hb_vector_paint_push_transform (hb_paint_funcs_t *, return; auto &body = paint->current_body (); - unsigned sprec = hb_svg_scale_precision (paint->precision); + unsigned sprec = hb_vector_scale_precision (paint->precision); hb_buf_append_str (&body, " &stops = paint->color_stops_scratch; - if (!hb_svg_get_color_stops (paint, color_line, &stops) || !stops.length) + if (!hb_vector_get_color_stops (paint, color_line, &stops) || !stops.length) return; - qsort (stops.arrayZ, stops.length, sizeof (hb_color_stop_t), hb_svg_color_stop_cmp); + qsort (stops.arrayZ, stops.length, sizeof (hb_color_stop_t), hb_vector_color_stop_cmp); unsigned grad_id = paint->gradient_counter++; @@ -678,10 +678,10 @@ hb_vector_paint_radial_gradient (hb_paint_funcs_t *, return; hb_vector_t &stops = paint->color_stops_scratch; - if (!hb_svg_get_color_stops (paint, color_line, &stops) || !stops.length) + if (!hb_vector_get_color_stops (paint, color_line, &stops) || !stops.length) return; - qsort (stops.arrayZ, stops.length, sizeof (hb_color_stop_t), hb_svg_color_stop_cmp); + qsort (stops.arrayZ, stops.length, sizeof (hb_color_stop_t), hb_vector_color_stop_cmp); unsigned grad_id = paint->gradient_counter++; @@ -727,15 +727,15 @@ hb_vector_paint_sweep_gradient (hb_paint_funcs_t *, return; hb_vector_t &stops = paint->color_stops_scratch; - if (!hb_svg_get_color_stops (paint, color_line, &stops) || !stops.length) + if (!hb_vector_get_color_stops (paint, color_line, &stops) || !stops.length) return; - qsort (stops.arrayZ, stops.length, sizeof (hb_color_stop_t), hb_svg_color_stop_cmp); + qsort (stops.arrayZ, stops.length, sizeof (hb_color_stop_t), hb_vector_color_stop_cmp); auto *body = &paint->current_body (); unsigned precision = paint->precision; float radius = 32767.f; - hb_sweep_gradient_tiles (stops.arrayZ, stops.length, + hb_vector_sweep_gradient_tiles (stops.arrayZ, stops.length, hb_color_line_get_extend (color_line), start_angle, end_angle, [&] (float a0, hb_color_t c0, float a1, hb_color_t c1) @@ -1100,7 +1100,7 @@ hb_vector_paint_set_glyph_extents (hb_vector_paint_t *paint, const hb_glyph_extents_t *glyph_extents) { hb_bool_t has_extents = paint->has_extents; - hb_bool_t ret = hb_svg_set_glyph_extents_common (paint->transform, + hb_bool_t ret = hb_vector_set_glyph_extents_common (paint->transform, paint->x_scale_factor, paint->y_scale_factor, glyph_extents, @@ -1252,7 +1252,7 @@ hb_vector_paint_glyph (hb_vector_paint_t *paint, { hb_bool_t has_extents = paint->has_extents; hb_transform_t<> extents_transform = {xx, yx, -xy, -yy, tx, ty}; - hb_bool_t ret = hb_svg_set_glyph_extents_common (extents_transform, + hb_bool_t ret = hb_vector_set_glyph_extents_common (extents_transform, paint->x_scale_factor, paint->y_scale_factor, &ge, @@ -1298,7 +1298,7 @@ hb_vector_paint_glyph (hb_vector_paint_t *paint, case HB_VECTOR_FORMAT_SVG: { bool can_cache = !paint->flat; - hb_svg_color_glyph_cache_key_t cache_key = hb_svg_color_glyph_cache_key (glyph, + hb_vector_color_glyph_cache_key_t cache_key = hb_vector_color_glyph_cache_key (glyph, (unsigned) paint->palette, paint->foreground); if (can_cache) diff --git a/src/hb-vector-paint.hh b/src/hb-vector-paint.hh index 30882e66e..da367821c 100644 --- a/src/hb-vector-paint.hh +++ b/src/hb-vector-paint.hh @@ -10,17 +10,17 @@ #include "hb-vector-svg-utils.hh" #include "hb-vector-svg.hh" -struct hb_svg_color_glyph_cache_key_t +struct hb_vector_color_glyph_cache_key_t { hb_codepoint_t glyph = HB_CODEPOINT_INVALID; unsigned palette = 0; hb_color_t foreground = 0; - hb_svg_color_glyph_cache_key_t () = default; - hb_svg_color_glyph_cache_key_t (hb_codepoint_t g, unsigned p, hb_color_t f) + hb_vector_color_glyph_cache_key_t () = default; + hb_vector_color_glyph_cache_key_t (hb_codepoint_t g, unsigned p, hb_color_t f) : glyph (g), palette (p), foreground (f) {} - bool operator == (const hb_svg_color_glyph_cache_key_t &o) const + bool operator == (const hb_vector_color_glyph_cache_key_t &o) const { return glyph == o.glyph && palette == o.palette && @@ -67,7 +67,7 @@ struct hb_vector_paint_t hb_set_t *defined_outlines = nullptr; hb_set_t *defined_clips = nullptr; hb_set_t *active_color_glyphs = nullptr; - hb_hashmap_t defined_color_glyphs; + hb_hashmap_t defined_color_glyphs; hb_vector_t color_stops_scratch; hb_vector_t captured_scratch; hb_blob_t *recycled_blob = nullptr; diff --git a/src/hb-vector-svg-utils.cc b/src/hb-vector-svg-utils.cc index 766b98e7f..920bed091 100644 --- a/src/hb-vector-svg-utils.cc +++ b/src/hb-vector-svg-utils.cc @@ -31,21 +31,21 @@ #include -struct hb_svg_decimal_point_t +struct hb_vector_decimal_point_t { char value[8]; }; -static hb_svg_decimal_point_t hb_svg_decimal_point_default = {{'.', '\0'}}; +static hb_vector_decimal_point_t hb_vector_decimal_point_default = {{'.', '\0'}}; static inline void free_static_svg_decimal_point (); -static struct hb_svg_decimal_point_lazy_loader_t - : hb_lazy_loader_t +static struct hb_vector_decimal_point_lazy_loader_t + : hb_lazy_loader_t { - static hb_svg_decimal_point_t *create () + static hb_vector_decimal_point_t *create () { - auto *p = (hb_svg_decimal_point_t *) hb_calloc (1, sizeof (hb_svg_decimal_point_t)); + auto *p = (hb_vector_decimal_point_t *) hb_calloc (1, sizeof (hb_vector_decimal_point_t)); if (!p) return nullptr; @@ -72,11 +72,11 @@ static struct hb_svg_decimal_point_lazy_loader_t return p; } - static void destroy (hb_svg_decimal_point_t *p) + static void destroy (hb_vector_decimal_point_t *p) { hb_free (p); } - static const hb_svg_decimal_point_t *get_null () - { return &hb_svg_decimal_point_default; } + static const hb_vector_decimal_point_t *get_null () + { return &hb_vector_decimal_point_default; } } static_svg_decimal_point; static inline void @@ -86,7 +86,7 @@ free_static_svg_decimal_point () } const char * -hb_svg_decimal_point_get (void) +hb_vector_decimal_point_get (void) { return static_svg_decimal_point.get_unconst ()->value; } diff --git a/src/hb-vector-svg-utils.hh b/src/hb-vector-svg-utils.hh index c8fd9e76c..4fe6e0dae 100644 --- a/src/hb-vector-svg-utils.hh +++ b/src/hb-vector-svg-utils.hh @@ -34,7 +34,7 @@ #include HB_INTERNAL const char * -hb_svg_decimal_point_get (void); +hb_vector_decimal_point_get (void); static inline bool hb_buf_append_len (hb_vector_t *buf, @@ -93,7 +93,7 @@ hb_buf_append_num (hb_vector_t *buf, char out[128]; snprintf (out, sizeof (out), float_formats[effective_precision], (double) v); - const char *decimal_point = hb_svg_decimal_point_get (); + const char *decimal_point = hb_vector_decimal_point_get (); if (decimal_point[0] != '.' || decimal_point[1] != '\0') { @@ -121,7 +121,7 @@ hb_buf_append_num (hb_vector_t *buf, } static inline unsigned -hb_svg_scale_precision (unsigned precision) +hb_vector_scale_precision (unsigned precision) { return precision < 7 ? 7 : precision; } @@ -144,7 +144,7 @@ hb_color_lerp (hb_color_t c0, hb_color_t c1, float t) * pre-sorted by offset. */ template static inline void -hb_sweep_gradient_tiles (hb_color_stop_t *stops, +hb_vector_sweep_gradient_tiles (hb_color_stop_t *stops, unsigned n_stops, hb_paint_extend_t extend, float start_angle, diff --git a/src/hb-vector-svg.hh b/src/hb-vector-svg.hh index 8988c363a..04d916f13 100644 --- a/src/hb-vector-svg.hh +++ b/src/hb-vector-svg.hh @@ -78,7 +78,7 @@ hb_buf_append_base64 (hb_vector_t *buf, return true; } -struct hb_svg_blob_meta_t +struct hb_vector_blob_meta_t { char *data; int allocated; @@ -86,10 +86,10 @@ struct hb_svg_blob_meta_t bool in_replace; }; -static hb_user_data_key_t hb_svg_blob_meta_user_data_key; +static hb_user_data_key_t hb_vector_blob_meta_user_data_key; static inline void -hb_svg_blob_meta_set_buffer (hb_svg_blob_meta_t *meta, +hb_vector_blob_meta_set_buffer (hb_vector_blob_meta_t *meta, char *data, int allocated) { @@ -99,7 +99,7 @@ hb_svg_blob_meta_set_buffer (hb_svg_blob_meta_t *meta, } static inline void -hb_svg_blob_meta_release_buffer (hb_svg_blob_meta_t *meta) +hb_vector_blob_meta_release_buffer (hb_vector_blob_meta_t *meta) { if (!meta) return; @@ -111,10 +111,10 @@ hb_svg_blob_meta_release_buffer (hb_svg_blob_meta_t *meta) } static inline void -hb_svg_blob_meta_destroy (void *data) +hb_vector_blob_meta_destroy (void *data) { - auto *meta = (hb_svg_blob_meta_t *) data; - hb_svg_blob_meta_release_buffer (meta); + auto *meta = (hb_vector_blob_meta_t *) data; + hb_vector_blob_meta_release_buffer (meta); if (meta->in_replace) { meta->in_replace = false; @@ -139,11 +139,11 @@ hb_buf_blob_from (hb_blob_t **recycled_blob, bool reused_blob = blob && blob != hb_blob_get_empty (); bool new_meta = false; auto *meta = reused_blob - ? (hb_svg_blob_meta_t *) hb_blob_get_user_data (blob, &hb_svg_blob_meta_user_data_key) + ? (hb_vector_blob_meta_t *) hb_blob_get_user_data (blob, &hb_vector_blob_meta_user_data_key) : nullptr; if (!meta) { - meta = (hb_svg_blob_meta_t *) hb_malloc (sizeof (hb_svg_blob_meta_t)); + meta = (hb_vector_blob_meta_t *) hb_malloc (sizeof (hb_vector_blob_meta_t)); if (!meta) { hb_free (data); @@ -159,13 +159,13 @@ hb_buf_blob_from (hb_blob_t **recycled_blob, if (reused_blob) { meta->in_replace = true; - blob->replace_buffer (data, len, HB_MEMORY_MODE_WRITABLE, meta, hb_svg_blob_meta_destroy); - hb_svg_blob_meta_set_buffer (meta, data, allocated); + blob->replace_buffer (data, len, HB_MEMORY_MODE_WRITABLE, meta, hb_vector_blob_meta_destroy); + hb_vector_blob_meta_set_buffer (meta, data, allocated); } else { - hb_svg_blob_meta_set_buffer (meta, data, allocated); - blob = hb_blob_create_or_fail (data, len, HB_MEMORY_MODE_WRITABLE, meta, hb_svg_blob_meta_destroy); + hb_vector_blob_meta_set_buffer (meta, data, allocated); + blob = hb_blob_create_or_fail (data, len, HB_MEMORY_MODE_WRITABLE, meta, hb_vector_blob_meta_destroy); if (unlikely (!blob)) return nullptr; } @@ -180,7 +180,7 @@ hb_buf_blob_from (hb_blob_t **recycled_blob, if (new_meta && !hb_blob_set_user_data (blob, - &hb_svg_blob_meta_user_data_key, + &hb_vector_blob_meta_user_data_key, meta, nullptr, true)) @@ -203,7 +203,7 @@ hb_buf_recover_recycled (hb_blob_t *blob, if (!blob) return; - auto *meta = (hb_svg_blob_meta_t *) hb_blob_get_user_data (blob, &hb_svg_blob_meta_user_data_key); + auto *meta = (hb_vector_blob_meta_t *) hb_blob_get_user_data (blob, &hb_vector_blob_meta_user_data_key); if (!meta || meta->transferred || !meta->data) return; @@ -246,7 +246,7 @@ hb_buf_append_color (hb_vector_t *buf, } static inline void -hb_svg_transform_point (const hb_transform_t<> &t, +hb_vector_transform_point (const hb_transform_t<> &t, float x_scale_factor, float y_scale_factor, float x, float y, @@ -259,7 +259,7 @@ hb_svg_transform_point (const hb_transform_t<> &t, } static inline hb_bool_t -hb_svg_set_glyph_extents_common (const hb_transform_t<> &transform, +hb_vector_set_glyph_extents_common (const hb_transform_t<> &transform, float x_scale_factor, float y_scale_factor, const hb_glyph_extents_t *glyph_extents, @@ -275,13 +275,13 @@ hb_svg_set_glyph_extents_common (const hb_transform_t<> &transform, float py[4] = {y0, y1, y0, y1}; float tx, ty; - hb_svg_transform_point (transform, x_scale_factor, y_scale_factor, px[0], py[0], &tx, &ty); + hb_vector_transform_point (transform, x_scale_factor, y_scale_factor, px[0], py[0], &tx, &ty); float tx_min = tx, tx_max = tx; float ty_min = ty, ty_max = ty; for (unsigned i = 1; i < 4; i++) { - hb_svg_transform_point (transform, x_scale_factor, y_scale_factor, px[i], py[i], &tx, &ty); + hb_vector_transform_point (transform, x_scale_factor, y_scale_factor, px[i], py[i], &tx, &ty); tx_min = hb_min (tx_min, tx); tx_max = hb_max (tx_max, tx); ty_min = hb_min (ty_min, ty); @@ -316,7 +316,7 @@ hb_svg_append_instance_transform (hb_vector_t *out, float xy, float yy, float tx, float ty) { - unsigned sprec = hb_svg_scale_precision (precision); + unsigned sprec = hb_vector_scale_precision (precision); if (xx == 1.f && yx == 0.f && xy == 0.f && yy == 1.f) { float sx = 1.f / x_scale_factor;