From c08e5d094a3bd7e6c3b9d6475a30aa8883429a89 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sat, 21 Jan 2023 03:40:09 +0200 Subject: [PATCH] [hb-draw] Fix MSVC warning warning C4305: 'initializing': truncation from 'double' to 'float' --- src/hb-cairo-utils.cc | 4 ++-- test/api/test-paint.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hb-cairo-utils.cc b/src/hb-cairo-utils.cc index 10a811bdf..4c2a4cbd8 100644 --- a/src/hb-cairo-utils.cc +++ b/src/hb-cairo-utils.cc @@ -526,8 +526,8 @@ _hb_cairo_add_sweep_gradient_patches1 (float cx, float cy, float radius, C0 = _hb_cairo_sum (A, _hb_cairo_scale (U, _hb_cairo_dot (_hb_cairo_difference (p0, A), p0) / _hb_cairo_dot (U, p0))); C1 = _hb_cairo_sum (A, _hb_cairo_scale (U, _hb_cairo_dot (_hb_cairo_difference (p1, A), p1) / _hb_cairo_dot (U, p1))); - patch.c0 = _hb_cairo_sum (center, _hb_cairo_scale (_hb_cairo_sum (C0, _hb_cairo_scale (_hb_cairo_difference (C0, p0), 0.33333)), radius)); - patch.c1 = _hb_cairo_sum (center, _hb_cairo_scale (_hb_cairo_sum (C1, _hb_cairo_scale (_hb_cairo_difference (C1, p1), 0.33333)), radius)); + patch.c0 = _hb_cairo_sum (center, _hb_cairo_scale (_hb_cairo_sum (C0, _hb_cairo_scale (_hb_cairo_difference (C0, p0), 0.33333f)), radius)); + patch.c1 = _hb_cairo_sum (center, _hb_cairo_scale (_hb_cairo_sum (C1, _hb_cairo_scale (_hb_cairo_difference (C1, p1), 0.33333f)), radius)); _hb_cairo_add_patch (pattern, ¢er, &patch); diff --git a/test/api/test-paint.c b/test/api/test-paint.c index 84258c2cc..480f8bf83 100644 --- a/test/api/test-paint.c +++ b/test/api/test-paint.c @@ -326,7 +326,7 @@ typedef struct { static paint_test_t paint_tests[] = { /* COLRv1 */ { NOTO_HAND, 0., 10, 0, "hand-10" }, - { NOTO_HAND, 0.2, 10, 0, "hand-10.2" }, + { NOTO_HAND, 0.2f,10, 0, "hand-10.2" }, { TEST_GLYPHS, 0, 6, 0, "test-6" }, // linear gradient { TEST_GLYPHS, 0, 10, 0, "test-10" }, // sweep gradient @@ -351,8 +351,8 @@ static paint_test_t paint_tests[] = { { BAD_COLRV1, 0, 154, 0, "bad-154" }, // recursion /* COLRv0 */ - { ROCHER_ABC, 0.3, 1, 0, "rocher-1" }, - { ROCHER_ABC, 0.3, 2, 2, "rocher-2" }, + { ROCHER_ABC, 0.3f, 1, 0, "rocher-1" }, + { ROCHER_ABC, 0.3f, 2, 2, "rocher-2" }, { ROCHER_ABC, 0, 3, 200, "rocher-3" }, };