dwrite: Consistently use explicit float literals.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-01-11 16:15:53 +03:00 committed by Alexandre Julliard
parent 3a653fb84a
commit 74f00fa17d
6 changed files with 95 additions and 95 deletions

View File

@ -1056,8 +1056,8 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2
a = 0; a = 0;
advances[i] = get_scaled_advance_width(a, emSize, &metrics); advances[i] = get_scaled_advance_width(a, emSize, &metrics);
offsets[i].advanceOffset = 0.0; offsets[i].advanceOffset = 0.0f;
offsets[i].ascenderOffset = 0.0; offsets[i].ascenderOffset = 0.0f;
} }
/* FIXME: actually apply features */ /* FIXME: actually apply features */
@ -1105,11 +1105,11 @@ static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWrite
hr = IDWriteFontFace1_GetGdiCompatibleGlyphAdvances(fontface1, emSize, ppdip, hr = IDWriteFontFace1_GetGdiCompatibleGlyphAdvances(fontface1, emSize, ppdip,
transform, use_gdi_natural, is_sideways, 1, &glyphs[i], &a); transform, use_gdi_natural, is_sideways, 1, &glyphs[i], &a);
if (FAILED(hr)) if (FAILED(hr))
advances[i] = 0.0; advances[i] = 0.0f;
else else
advances[i] = floorf(a * emSize * ppdip / metrics.designUnitsPerEm + 0.5f) / ppdip; advances[i] = floorf(a * emSize * ppdip / metrics.designUnitsPerEm + 0.5f) / ppdip;
offsets[i].advanceOffset = 0.0; offsets[i].advanceOffset = 0.0f;
offsets[i].ascenderOffset = 0.0; offsets[i].ascenderOffset = 0.0f;
} }
/* FIXME: actually apply features */ /* FIXME: actually apply features */
@ -1120,7 +1120,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWrite
static inline FLOAT get_cluster_advance(const FLOAT *advances, UINT32 start, UINT32 end) static inline FLOAT get_cluster_advance(const FLOAT *advances, UINT32 start, UINT32 end)
{ {
FLOAT advance = 0.0; FLOAT advance = 0.0f;
for (; start < end; start++) for (; start < end; start++)
advance += advances[start]; advance += advances[start];
return advance; return advance;
@ -1130,9 +1130,9 @@ static void apply_single_glyph_spacing(FLOAT leading_spacing, FLOAT trailing_spa
FLOAT min_advance_width, UINT32 g, FLOAT const *advances, DWRITE_GLYPH_OFFSET const *offsets, FLOAT min_advance_width, UINT32 g, FLOAT const *advances, DWRITE_GLYPH_OFFSET const *offsets,
DWRITE_SHAPING_GLYPH_PROPERTIES const *props, FLOAT *modified_advances, DWRITE_GLYPH_OFFSET *modified_offsets) DWRITE_SHAPING_GLYPH_PROPERTIES const *props, FLOAT *modified_advances, DWRITE_GLYPH_OFFSET *modified_offsets)
{ {
BOOL reduced = leading_spacing < 0.0 || trailing_spacing < 0.0; BOOL reduced = leading_spacing < 0.0f || trailing_spacing < 0.0f;
FLOAT advance = advances[g]; FLOAT advance = advances[g];
FLOAT origin = 0.0; FLOAT origin = 0.0f;
if (props[g].isZeroWidthSpace) { if (props[g].isZeroWidthSpace) {
modified_advances[g] = advances[g]; modified_advances[g] = advances[g];
@ -1141,32 +1141,32 @@ static void apply_single_glyph_spacing(FLOAT leading_spacing, FLOAT trailing_spa
} }
/* first apply negative spacing and check if we hit minimum width */ /* first apply negative spacing and check if we hit minimum width */
if (leading_spacing < 0.0) { if (leading_spacing < 0.0f) {
advance += leading_spacing; advance += leading_spacing;
origin -= leading_spacing; origin -= leading_spacing;
} }
if (trailing_spacing < 0.0) if (trailing_spacing < 0.0f)
advance += trailing_spacing; advance += trailing_spacing;
if (advance < min_advance_width) { if (advance < min_advance_width) {
FLOAT half = (min_advance_width - advance) / 2.0; FLOAT half = (min_advance_width - advance) / 2.0f;
if (!reduced) if (!reduced)
origin -= half; origin -= half;
else if (leading_spacing < 0.0 && trailing_spacing < 0.0) else if (leading_spacing < 0.0f && trailing_spacing < 0.0f)
origin -= half; origin -= half;
else if (leading_spacing < 0.0) else if (leading_spacing < 0.0f)
origin -= min_advance_width - advance; origin -= min_advance_width - advance;
advance = min_advance_width; advance = min_advance_width;
} }
/* now apply positive spacing adjustments */ /* now apply positive spacing adjustments */
if (leading_spacing > 0.0) { if (leading_spacing > 0.0f) {
advance += leading_spacing; advance += leading_spacing;
origin -= leading_spacing; origin -= leading_spacing;
} }
if (trailing_spacing > 0.0) if (trailing_spacing > 0.0f)
advance += trailing_spacing; advance += trailing_spacing;
modified_advances[g] = advance; modified_advances[g] = advance;
@ -1180,21 +1180,21 @@ static void apply_cluster_spacing(FLOAT leading_spacing, FLOAT trailing_spacing,
UINT32 start, UINT32 end, FLOAT const *advances, DWRITE_GLYPH_OFFSET const *offsets, UINT32 start, UINT32 end, FLOAT const *advances, DWRITE_GLYPH_OFFSET const *offsets,
FLOAT *modified_advances, DWRITE_GLYPH_OFFSET *modified_offsets) FLOAT *modified_advances, DWRITE_GLYPH_OFFSET *modified_offsets)
{ {
BOOL reduced = leading_spacing < 0.0 || trailing_spacing < 0.0; BOOL reduced = leading_spacing < 0.0f || trailing_spacing < 0.0f;
FLOAT advance = get_cluster_advance(advances, start, end); FLOAT advance = get_cluster_advance(advances, start, end);
FLOAT origin = 0.0; FLOAT origin = 0.0f;
UINT16 g; UINT16 g;
modified_advances[start] = advances[start]; modified_advances[start] = advances[start];
modified_advances[end-1] = advances[end-1]; modified_advances[end-1] = advances[end-1];
/* first apply negative spacing and check if we hit minimum width */ /* first apply negative spacing and check if we hit minimum width */
if (leading_spacing < 0.0) { if (leading_spacing < 0.0f) {
advance += leading_spacing; advance += leading_spacing;
modified_advances[start] += leading_spacing; modified_advances[start] += leading_spacing;
origin -= leading_spacing; origin -= leading_spacing;
} }
if (trailing_spacing < 0.0) { if (trailing_spacing < 0.0f) {
advance += trailing_spacing; advance += trailing_spacing;
modified_advances[end-1] += trailing_spacing; modified_advances[end-1] += trailing_spacing;
} }
@ -1209,12 +1209,12 @@ static void apply_cluster_spacing(FLOAT leading_spacing, FLOAT trailing_spacing,
modified_advances[start] += half; modified_advances[start] += half;
modified_advances[end-1] += half; modified_advances[end-1] += half;
} }
else if (leading_spacing < 0.0 && trailing_spacing < 0.0) { else if (leading_spacing < 0.0f && trailing_spacing < 0.0f) {
origin -= half; origin -= half;
modified_advances[start] += half; modified_advances[start] += half;
modified_advances[end-1] += half; modified_advances[end-1] += half;
} }
else if (leading_spacing < 0.0) { else if (leading_spacing < 0.0f) {
origin -= advance; origin -= advance;
modified_advances[start] += advance; modified_advances[start] += advance;
} }
@ -1223,11 +1223,11 @@ static void apply_cluster_spacing(FLOAT leading_spacing, FLOAT trailing_spacing,
} }
/* now apply positive spacing adjustments */ /* now apply positive spacing adjustments */
if (leading_spacing > 0.0) { if (leading_spacing > 0.0f) {
modified_advances[start] += leading_spacing; modified_advances[start] += leading_spacing;
origin -= leading_spacing; origin -= leading_spacing;
} }
if (trailing_spacing > 0.0) if (trailing_spacing > 0.0f)
modified_advances[end-1] += trailing_spacing; modified_advances[end-1] += trailing_spacing;
for (g = start; g < end; g++) { for (g = start; g < end; g++) {
@ -1305,13 +1305,13 @@ static HRESULT WINAPI dwritetextanalyzer1_ApplyCharacterSpacing(IDWriteTextAnaly
TRACE("(%.2f %.2f %.2f %u %u %p %p %p %p %p %p)\n", leading_spacing, trailing_spacing, min_advance_width, TRACE("(%.2f %.2f %.2f %u %u %p %p %p %p %p %p)\n", leading_spacing, trailing_spacing, min_advance_width,
len, glyph_count, clustermap, advances, offsets, props, modified_advances, modified_offsets); len, glyph_count, clustermap, advances, offsets, props, modified_advances, modified_offsets);
if (min_advance_width < 0.0) { if (min_advance_width < 0.0f) {
memset(modified_advances, 0, glyph_count*sizeof(*modified_advances)); memset(modified_advances, 0, glyph_count*sizeof(*modified_advances));
return E_INVALIDARG; return E_INVALIDARG;
} }
/* minimum advance is not applied if no adjustments were made */ /* minimum advance is not applied if no adjustments were made */
if (leading_spacing == 0.0 && trailing_spacing == 0.0) { if (leading_spacing == 0.0f && trailing_spacing == 0.0f) {
memmove(modified_advances, advances, glyph_count*sizeof(*advances)); memmove(modified_advances, advances, glyph_count*sizeof(*advances));
memmove(modified_offsets, offsets, glyph_count*sizeof(*offsets)); memmove(modified_offsets, offsets, glyph_count*sizeof(*offsets));
return S_OK; return S_OK;
@ -1469,10 +1469,10 @@ static HRESULT WINAPI dwritetextanalyzer2_GetGlyphOrientationTransform(IDWriteTe
DWRITE_GLYPH_ORIENTATION_ANGLE angle, BOOL is_sideways, FLOAT originX, FLOAT originY, DWRITE_MATRIX *m) DWRITE_GLYPH_ORIENTATION_ANGLE angle, BOOL is_sideways, FLOAT originX, FLOAT originY, DWRITE_MATRIX *m)
{ {
static const DWRITE_MATRIX transforms[] = { static const DWRITE_MATRIX transforms[] = {
{ 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 }, { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f },
{ 0.0, 1.0, -1.0, 0.0, 0.0, 0.0 }, { 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f },
{ -1.0, 0.0, 0.0, -1.0, 0.0, 0.0 }, { -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f },
{ 0.0, -1.0, 1.0, 0.0, 0.0, 0.0 } { 0.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f }
}; };
TRACE("(%d %d %.2f %.2f %p)\n", angle, is_sideways, originX, originY, m); TRACE("(%d %d %.2f %.2f %p)\n", angle, is_sideways, originX, originY, m);
@ -1506,7 +1506,7 @@ static HRESULT WINAPI dwritetextanalyzer2_GetGlyphOrientationTransform(IDWriteTe
/* shift components represent transform necessary to get from original point to /* shift components represent transform necessary to get from original point to
rotated one in new coordinate system */ rotated one in new coordinate system */
if ((originX != 0.0 || originY != 0.0) && angle != DWRITE_GLYPH_ORIENTATION_ANGLE_0_DEGREES) { if ((originX != 0.0f || originY != 0.0f) && angle != DWRITE_GLYPH_ORIENTATION_ANGLE_0_DEGREES) {
m->dx = originX - (m->m11 * originX + m->m21 * originY); m->dx = originX - (m->m11 * originX + m->m21 * originY);
m->dy = originY - (m->m12 * originX + m->m22 * originY); m->dy = originY - (m->m12 * originX + m->m22 * originY);
} }

View File

@ -608,7 +608,7 @@ HRESULT new_glyph_outline(UINT32 count, struct glyph_outline **ret)
outline->points = points; outline->points = points;
outline->tags = tags; outline->tags = tags;
outline->count = count; outline->count = count;
outline->advance = 0.0; outline->advance = 0.0f;
*ret = outline; *ret = outline;
return S_OK; return S_OK;
@ -659,7 +659,7 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace2 *iface,
UINT32 count, BOOL is_sideways, BOOL is_rtl, IDWriteGeometrySink *sink) UINT32 count, BOOL is_sideways, BOOL is_rtl, IDWriteGeometrySink *sink)
{ {
struct dwrite_fontface *This = impl_from_IDWriteFontFace2(iface); struct dwrite_fontface *This = impl_from_IDWriteFontFace2(iface);
FLOAT advance = 0.0; FLOAT advance = 0.0f;
HRESULT hr; HRESULT hr;
UINT32 g; UINT32 g;
@ -676,7 +676,7 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace2 *iface,
ID2D1SimplifiedGeometrySink_SetFillMode(sink, D2D1_FILL_MODE_WINDING); ID2D1SimplifiedGeometrySink_SetFillMode(sink, D2D1_FILL_MODE_WINDING);
for (g = 0; g < count; g++) { for (g = 0; g < count; g++) {
FLOAT xoffset = 0.0, yoffset = 0.0; FLOAT xoffset = 0.0f, yoffset = 0.0f;
struct glyph_outline *outline; struct glyph_outline *outline;
/* FIXME: cache outlines */ /* FIXME: cache outlines */
@ -692,7 +692,7 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace2 *iface,
} }
if (g == 0) if (g == 0)
advance = is_rtl ? -outline->advance : 0.0; advance = is_rtl ? -outline->advance : 0.0f;
xoffset += advance; xoffset += advance;
translate_glyph_outline(outline, xoffset, yoffset); translate_glyph_outline(outline, xoffset, yoffset);
@ -845,13 +845,13 @@ static HRESULT WINAPI dwritefontface1_GetGdiCompatibleMetrics(IDWriteFontFace2 *
TRACE("(%p)->(%.2f %.2f %p %p)\n", This, em_size, pixels_per_dip, m, metrics); TRACE("(%p)->(%.2f %.2f %p %p)\n", This, em_size, pixels_per_dip, m, metrics);
if (em_size <= 0.0 || pixels_per_dip <= 0.0) { if (em_size <= 0.0f || pixels_per_dip <= 0.0f) {
memset(metrics, 0, sizeof(*metrics)); memset(metrics, 0, sizeof(*metrics));
return E_INVALIDARG; return E_INVALIDARG;
} }
em_size *= pixels_per_dip; em_size *= pixels_per_dip;
if (m && m->m22 != 0.0) if (m && m->m22 != 0.0f)
em_size *= fabs(m->m22); em_size *= fabs(m->m22);
scale = em_size / design->designUnitsPerEm; scale = em_size / design->designUnitsPerEm;
@ -947,13 +947,13 @@ static HRESULT WINAPI dwritefontface1_GetGdiCompatibleGlyphAdvances(IDWriteFontF
TRACE("(%p)->(%.2f %.2f %p %d %d %u %p %p)\n", This, em_size, ppdip, m, TRACE("(%p)->(%.2f %.2f %p %d %d %u %p %p)\n", This, em_size, ppdip, m,
use_gdi_natural, is_sideways, glyph_count, glyphs, advances); use_gdi_natural, is_sideways, glyph_count, glyphs, advances);
if (em_size < 0.0 || ppdip <= 0.0) { if (em_size < 0.0f || ppdip <= 0.0f) {
memset(advances, 0, sizeof(*advances) * glyph_count); memset(advances, 0, sizeof(*advances) * glyph_count);
return E_INVALIDARG; return E_INVALIDARG;
} }
em_size *= ppdip; em_size *= ppdip;
if (em_size == 0.0) { if (em_size == 0.0f) {
memset(advances, 0, sizeof(*advances) * glyph_count); memset(advances, 0, sizeof(*advances) * glyph_count);
return S_OK; return S_OK;
} }

View File

@ -269,8 +269,8 @@ BOOL freetype_is_monospaced(IDWriteFontFace2 *fontface)
static inline void ft_vector_to_d2d_point(const FT_Vector *v, D2D1_POINT_2F *p) static inline void ft_vector_to_d2d_point(const FT_Vector *v, D2D1_POINT_2F *p)
{ {
p->x = v->x / 64.0; p->x = v->x / 64.0f;
p->y = v->y / 64.0; p->y = v->y / 64.0f;
} }
/* Convert the quadratic Beziers to cubic Beziers. */ /* Convert the quadratic Beziers to cubic Beziers. */

View File

@ -461,7 +461,7 @@ static HRESULT WINAPI rendertarget_SetPixelsPerDip(IDWriteBitmapRenderTarget1 *i
TRACE("(%p)->(%.2f)\n", This, ppdip); TRACE("(%p)->(%.2f)\n", This, ppdip);
if (ppdip <= 0.0) if (ppdip <= 0.0f)
return E_INVALIDARG; return E_INVALIDARG;
This->ppdip = ppdip; This->ppdip = ppdip;

View File

@ -573,7 +573,7 @@ static inline void init_cluster_metrics(const struct dwrite_textlayout *layout,
/* For clusters made of control chars we report zero glyphs, and we need zero cluster /* For clusters made of control chars we report zero glyphs, and we need zero cluster
width as well; advances are already computed at this point and are not necessary zero. */ width as well; advances are already computed at this point and are not necessary zero. */
metrics->width = 0.0; metrics->width = 0.0f;
if (run->run.glyphCount) { if (run->run.glyphCount) {
for (j = start_glyph; j < stop_glyph; j++) for (j = start_glyph; j < stop_glyph; j++)
metrics->width += run->run.glyphAdvances[j]; metrics->width += run->run.glyphAdvances[j];
@ -732,7 +732,7 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout)
struct layout_cluster *c = &layout->clusters[cluster]; struct layout_cluster *c = &layout->clusters[cluster];
DWRITE_INLINE_OBJECT_METRICS inlinemetrics; DWRITE_INLINE_OBJECT_METRICS inlinemetrics;
metrics->width = 0.0; metrics->width = 0.0f;
metrics->length = r->u.object.length; metrics->length = r->u.object.length;
metrics->canWrapLineAfter = FALSE; metrics->canWrapLineAfter = FALSE;
metrics->isWhitespace = FALSE; metrics->isWhitespace = FALSE;
@ -956,7 +956,7 @@ static HRESULT layout_compute(struct dwrite_textlayout *layout)
static inline FLOAT get_cluster_range_width(struct dwrite_textlayout *layout, UINT32 start, UINT32 end) static inline FLOAT get_cluster_range_width(struct dwrite_textlayout *layout, UINT32 start, UINT32 end)
{ {
FLOAT width = 0.0; FLOAT width = 0.0f;
for (; start < end; start++) for (; start < end; start++)
width += layout->clustermetrics[start].width; width += layout->clustermetrics[start].width;
return width; return width;
@ -1005,8 +1005,8 @@ static HRESULT layout_add_effective_run(struct dwrite_textlayout *layout, const
inlineobject->object = r->u.object.object; inlineobject->object = r->u.object.object;
inlineobject->width = get_cluster_range_width(layout, first_cluster, first_cluster + cluster_count); inlineobject->width = get_cluster_range_width(layout, first_cluster, first_cluster + cluster_count);
inlineobject->origin_x = is_rtl ? origin_x - inlineobject->width : origin_x; inlineobject->origin_x = is_rtl ? origin_x - inlineobject->width : origin_x;
inlineobject->origin_y = 0.0; /* set after line is built */ inlineobject->origin_y = 0.0f; /* set after line is built */
inlineobject->align_dx = 0.0; inlineobject->align_dx = 0.0f;
/* It's not clear how these two are set, possibly directionality /* It's not clear how these two are set, possibly directionality
is derived from surrounding text (replaced text could have is derived from surrounding text (replaced text could have
@ -1050,8 +1050,8 @@ static HRESULT layout_add_effective_run(struct dwrite_textlayout *layout, const
else else
run->origin_x = origin_x; run->origin_x = origin_x;
run->origin_y = 0.0; /* set after line is built */ run->origin_y = 0.0f; /* set after line is built */
run->align_dx = 0.0; run->align_dx = 0.0f;
run->line = line; run->line = line;
if (r->u.regular.run.glyphCount) { if (r->u.regular.run.glyphCount) {
@ -1169,7 +1169,7 @@ static inline struct layout_effective_inline *layout_get_next_inline_run(struct
static FLOAT layout_get_line_width(struct dwrite_textlayout *layout, static FLOAT layout_get_line_width(struct dwrite_textlayout *layout,
struct layout_effective_run *erun, struct layout_effective_inline *inrun, UINT32 line) struct layout_effective_run *erun, struct layout_effective_inline *inrun, UINT32 line)
{ {
FLOAT width = 0.0; FLOAT width = 0.0f;
while (erun && erun->line == line) { while (erun && erun->line == line) {
width += erun->width; width += erun->width;
@ -1235,16 +1235,16 @@ static void layout_apply_leading_alignment(struct dwrite_textlayout *layout)
inrun = layout_get_next_inline_run(layout, NULL); inrun = layout_get_next_inline_run(layout, NULL);
while (erun) { while (erun) {
erun->align_dx = 0.0; erun->align_dx = 0.0f;
erun = layout_get_next_erun(layout, erun); erun = layout_get_next_erun(layout, erun);
} }
while (inrun) { while (inrun) {
inrun->align_dx = 0.0; inrun->align_dx = 0.0f;
inrun = layout_get_next_inline_run(layout, inrun); inrun = layout_get_next_inline_run(layout, inrun);
} }
layout->metrics.left = is_rtl ? layout->metrics.layoutWidth - layout->metrics.width : 0.0; layout->metrics.left = is_rtl ? layout->metrics.layoutWidth - layout->metrics.width : 0.0f;
} }
static void layout_apply_trailing_alignment(struct dwrite_textlayout *layout) static void layout_apply_trailing_alignment(struct dwrite_textlayout *layout)
@ -1262,7 +1262,7 @@ static void layout_apply_trailing_alignment(struct dwrite_textlayout *layout)
FLOAT shift = layout->metrics.layoutWidth - width; FLOAT shift = layout->metrics.layoutWidth - width;
if (is_rtl) if (is_rtl)
shift *= -1.0; shift *= -1.0f;
while (erun && erun->line == line) { while (erun && erun->line == line) {
erun->align_dx = shift; erun->align_dx = shift;
@ -1275,14 +1275,14 @@ static void layout_apply_trailing_alignment(struct dwrite_textlayout *layout)
} }
} }
layout->metrics.left = is_rtl ? 0.0 : layout->metrics.layoutWidth - layout->metrics.width; layout->metrics.left = is_rtl ? 0.0f : layout->metrics.layoutWidth - layout->metrics.width;
} }
static inline FLOAT layout_get_centered_shift(struct dwrite_textlayout *layout, BOOL skiptransform, static inline FLOAT layout_get_centered_shift(struct dwrite_textlayout *layout, BOOL skiptransform,
FLOAT width, FLOAT det) FLOAT width, FLOAT det)
{ {
if (is_layout_gdi_compatible(layout)) { if (is_layout_gdi_compatible(layout)) {
struct dwrite_vec vec = { layout->metrics.layoutWidth - width, 0.0 }; struct dwrite_vec vec = { layout->metrics.layoutWidth - width, 0.0f};
layout_apply_snapping(&vec, skiptransform, layout->ppdip, &layout->transform, det); layout_apply_snapping(&vec, skiptransform, layout->ppdip, &layout->transform, det);
return floorf(vec.x / 2.0f); return floorf(vec.x / 2.0f);
} }
@ -1309,7 +1309,7 @@ static void layout_apply_centered_alignment(struct dwrite_textlayout *layout)
FLOAT shift = layout_get_centered_shift(layout, skiptransform, width, det); FLOAT shift = layout_get_centered_shift(layout, skiptransform, width, det);
if (is_rtl) if (is_rtl)
shift *= -1.0; shift *= -1.0f;
while (erun && erun->line == line) { while (erun && erun->line == line) {
erun->align_dx = shift; erun->align_dx = shift;
@ -1322,7 +1322,7 @@ static void layout_apply_centered_alignment(struct dwrite_textlayout *layout)
} }
} }
layout->metrics.left = (layout->metrics.layoutWidth - layout->metrics.width) / 2.0; layout->metrics.left = (layout->metrics.layoutWidth - layout->metrics.width) / 2.0f;
} }
static void layout_apply_text_alignment(struct dwrite_textlayout *layout) static void layout_apply_text_alignment(struct dwrite_textlayout *layout)
@ -1350,7 +1350,7 @@ static void layout_apply_par_alignment(struct dwrite_textlayout *layout)
{ {
struct layout_effective_inline *inrun; struct layout_effective_inline *inrun;
struct layout_effective_run *erun; struct layout_effective_run *erun;
FLOAT origin_y = 0.0; FLOAT origin_y = 0.0f;
UINT32 line; UINT32 line;
/* alignment mode defines origin, after that all run origins are updated /* alignment mode defines origin, after that all run origins are updated
@ -1359,13 +1359,13 @@ static void layout_apply_par_alignment(struct dwrite_textlayout *layout)
switch (layout->format.paralign) switch (layout->format.paralign)
{ {
case DWRITE_PARAGRAPH_ALIGNMENT_NEAR: case DWRITE_PARAGRAPH_ALIGNMENT_NEAR:
origin_y = 0.0; origin_y = 0.0f;
break; break;
case DWRITE_PARAGRAPH_ALIGNMENT_FAR: case DWRITE_PARAGRAPH_ALIGNMENT_FAR:
origin_y = layout->metrics.layoutHeight - layout->metrics.height; origin_y = layout->metrics.layoutHeight - layout->metrics.height;
break; break;
case DWRITE_PARAGRAPH_ALIGNMENT_CENTER: case DWRITE_PARAGRAPH_ALIGNMENT_CENTER:
origin_y = (layout->metrics.layoutHeight - layout->metrics.height) / 2.0; origin_y = (layout->metrics.layoutHeight - layout->metrics.height) / 2.0f;
break; break;
default: default:
; ;
@ -1410,13 +1410,13 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
return hr; return hr;
layout->metrics.lineCount = 0; layout->metrics.lineCount = 0;
origin_x = is_rtl ? layout->metrics.layoutWidth : 0.0; origin_x = is_rtl ? layout->metrics.layoutWidth : 0.0f;
line = 0; line = 0;
run = layout->clusters[0].run; run = layout->clusters[0].run;
memset(&metrics, 0, sizeof(metrics)); memset(&metrics, 0, sizeof(metrics));
s[0] = s[1] = layout_get_strikethrough_from_pos(layout, 0); s[0] = s[1] = layout_get_strikethrough_from_pos(layout, 0);
for (i = 0, start = 0, textpos = 0, width = 0.0; i < layout->cluster_count; i++) { for (i = 0, start = 0, textpos = 0, width = 0.0f; i < layout->cluster_count; i++) {
BOOL overflow; BOOL overflow;
s[1] = layout_get_strikethrough_from_pos(layout, textpos); s[1] = layout_get_strikethrough_from_pos(layout, textpos);
@ -1462,7 +1462,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
trailing properties for current line */ trailing properties for current line */
strlength = metrics.length; strlength = metrics.length;
index = last_cluster; index = last_cluster;
trailingspacewidth = 0.0; trailingspacewidth = 0.0f;
while (strlength) { while (strlength) {
DWRITE_CLUSTER_METRICS *cluster = &layout->clustermetrics[index]; DWRITE_CLUSTER_METRICS *cluster = &layout->clustermetrics[index];
@ -1486,8 +1486,8 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
/* look for max baseline and descent for this line */ /* look for max baseline and descent for this line */
strlength = metrics.length; strlength = metrics.length;
index = last_cluster; index = last_cluster;
metrics.baseline = 0.0; metrics.baseline = 0.0f;
descent = 0.0; descent = 0.0f;
while (strlength) { while (strlength) {
DWRITE_CLUSTER_METRICS *cluster = &layout->clustermetrics[index]; DWRITE_CLUSTER_METRICS *cluster = &layout->clustermetrics[index];
const struct layout_run *cur = layout->clusters[index].run; const struct layout_run *cur = layout->clusters[index].run;
@ -1516,7 +1516,7 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
width = layout->clustermetrics[i].width; width = layout->clustermetrics[i].width;
memset(&metrics, 0, sizeof(metrics)); memset(&metrics, 0, sizeof(metrics));
origin_x = is_rtl ? layout->metrics.layoutWidth : 0.0; origin_x = is_rtl ? layout->metrics.layoutWidth : 0.0f;
start = i; start = i;
} }
else { else {
@ -1529,15 +1529,15 @@ static HRESULT layout_compute_effective_runs(struct dwrite_textlayout *layout)
} }
layout->metrics.left = is_rtl ? layout->metrics.layoutWidth - layout->metrics.width : 0; layout->metrics.left = is_rtl ? layout->metrics.layoutWidth - layout->metrics.width : 0;
layout->metrics.top = 0.0; layout->metrics.top = 0.0f;
layout->metrics.maxBidiReorderingDepth = 1; /* FIXME */ layout->metrics.maxBidiReorderingDepth = 1; /* FIXME */
layout->metrics.height = 0.0; layout->metrics.height = 0.0f;
/* Now all line info is here, update effective runs positions in flow direction */ /* Now all line info is here, update effective runs positions in flow direction */
erun = layout_get_next_erun(layout, NULL); erun = layout_get_next_erun(layout, NULL);
inrun = layout_get_next_inline_run(layout, NULL); inrun = layout_get_next_inline_run(layout, NULL);
origin_y = 0.0; origin_y = 0.0f;
for (line = 0; line < layout->metrics.lineCount; line++) { for (line = 0; line < layout->metrics.lineCount; line++) {
origin_y += layout->lines[line].baseline; origin_y += layout->lines[line].baseline;
@ -1734,9 +1734,9 @@ static struct layout_range_header *alloc_layout_range(struct dwrite_textlayout *
range = heap_alloc(sizeof(*range)); range = heap_alloc(sizeof(*range));
if (!range) return NULL; if (!range) return NULL;
range->leading = 0.0; range->leading = 0.0f;
range->trailing = 0.0; range->trailing = 0.0f;
range->min_advance = 0.0; range->min_advance = 0.0f;
h = &range->h; h = &range->h;
break; break;
} }
@ -2455,7 +2455,7 @@ static HRESULT WINAPI dwritetextlayout_SetMaxWidth(IDWriteTextLayout2 *iface, FL
TRACE("(%p)->(%.2f)\n", This, maxWidth); TRACE("(%p)->(%.2f)\n", This, maxWidth);
if (maxWidth < 0.0) if (maxWidth < 0.0f)
return E_INVALIDARG; return E_INVALIDARG;
This->metrics.layoutWidth = maxWidth; This->metrics.layoutWidth = maxWidth;
@ -2468,7 +2468,7 @@ static HRESULT WINAPI dwritetextlayout_SetMaxHeight(IDWriteTextLayout2 *iface, F
TRACE("(%p)->(%.2f)\n", This, maxHeight); TRACE("(%p)->(%.2f)\n", This, maxHeight);
if (maxHeight < 0.0) if (maxHeight < 0.0f)
return E_INVALIDARG; return E_INVALIDARG;
This->metrics.layoutHeight = maxHeight; This->metrics.layoutHeight = maxHeight;
@ -2551,7 +2551,7 @@ static HRESULT WINAPI dwritetextlayout_SetFontSize(IDWriteTextLayout2 *iface, FL
TRACE("(%p)->(%.2f %s)\n", This, size, debugstr_range(&range)); TRACE("(%p)->(%.2f %s)\n", This, size, debugstr_range(&range));
if (size <= 0.0) if (size <= 0.0f)
return E_INVALIDARG; return E_INVALIDARG;
value.range = range; value.range = range;
@ -2844,7 +2844,7 @@ static inline FLOAT renderer_apply_snapping(FLOAT coord, BOOL skiptransform, FLO
if (!skiptransform) { if (!skiptransform) {
/* apply transform */ /* apply transform */
vec[0] = 0.0; vec[0] = 0.0f;
vec[1] = coord * ppdip; vec[1] = coord * ppdip;
vec2[0] = m->m11 * vec[0] + m->m21 * vec[1] + m->dx; vec2[0] = m->m11 * vec[0] + m->m21 * vec[1] + m->dx;
@ -2872,7 +2872,7 @@ static HRESULT WINAPI dwritetextlayout_Draw(IDWriteTextLayout2 *iface,
struct layout_effective_inline *inlineobject; struct layout_effective_inline *inlineobject;
struct layout_effective_run *run; struct layout_effective_run *run;
struct layout_strikethrough *s; struct layout_strikethrough *s;
FLOAT det = 0.0, ppdip = 0.0; FLOAT det = 0.0f, ppdip = 0.0f;
DWRITE_MATRIX m = { 0 }; DWRITE_MATRIX m = { 0 };
HRESULT hr; HRESULT hr;
@ -2896,9 +2896,9 @@ static HRESULT WINAPI dwritetextlayout_Draw(IDWriteTextLayout2 *iface,
return hr; return hr;
/* it's only allowed to have a diagonal/antidiagonal transform matrix */ /* it's only allowed to have a diagonal/antidiagonal transform matrix */
if (ppdip <= 0.0 || if (ppdip <= 0.0f ||
(m.m11 * m.m22 != 0.0 && (m.m12 != 0.0 || m.m21 != 0.0)) || (m.m11 * m.m22 != 0.0f && (m.m12 != 0.0f || m.m21 != 0.0f)) ||
(m.m12 * m.m21 != 0.0 && (m.m11 != 0.0 || m.m22 != 0.0))) (m.m12 * m.m21 != 0.0f && (m.m11 != 0.0f || m.m22 != 0.0f)))
disabled = TRUE; disabled = TRUE;
else else
skiptransform = should_skip_transform(&m, &det); skiptransform = should_skip_transform(&m, &det);
@ -3055,7 +3055,7 @@ static HRESULT WINAPI dwritetextlayout_DetermineMinWidth(IDWriteTextLayout2 *ifa
if (!(This->recompute & RECOMPUTE_MINIMAL_WIDTH)) if (!(This->recompute & RECOMPUTE_MINIMAL_WIDTH))
goto width_done; goto width_done;
*min_width = 0.0; *min_width = 0.0f;
hr = layout_compute(This); hr = layout_compute(This);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
@ -3066,7 +3066,7 @@ static HRESULT WINAPI dwritetextlayout_DetermineMinWidth(IDWriteTextLayout2 *ifa
i++; i++;
} }
else { else {
width = 0.0; width = 0.0f;
while (!is_terminal_cluster(This, i)) { while (!is_terminal_cluster(This, i)) {
width += This->clustermetrics[i].width; width += This->clustermetrics[i].width;
i++; i++;
@ -3149,7 +3149,7 @@ static HRESULT WINAPI dwritetextlayout1_SetCharacterSpacing(IDWriteTextLayout2 *
TRACE("(%p)->(%.2f %.2f %.2f %s)\n", This, leading, trailing, min_advance, debugstr_range(&range)); TRACE("(%p)->(%.2f %.2f %.2f %s)\n", This, leading, trailing, min_advance, debugstr_range(&range));
if (min_advance < 0.0) if (min_advance < 0.0f)
return E_INVALIDARG; return E_INVALIDARG;
value.range = range; value.range = range;
@ -3497,7 +3497,7 @@ static FLOAT WINAPI dwritetextformat1_layout_GetIncrementalTabStop(IDWriteTextFo
{ {
struct dwrite_textlayout *This = impl_layout_form_IDWriteTextFormat1(iface); struct dwrite_textlayout *This = impl_layout_form_IDWriteTextFormat1(iface);
FIXME("(%p): stub\n", This); FIXME("(%p): stub\n", This);
return 0.0; return 0.0f;
} }
static HRESULT WINAPI dwritetextformat1_layout_GetTrimming(IDWriteTextFormat1 *iface, DWRITE_TRIMMING *options, static HRESULT WINAPI dwritetextformat1_layout_GetTrimming(IDWriteTextFormat1 *iface, DWRITE_TRIMMING *options,
@ -4015,7 +4015,7 @@ static HRESULT init_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat *
layout->clusters = NULL; layout->clusters = NULL;
layout->lines = NULL; layout->lines = NULL;
layout->line_alloc = 0; layout->line_alloc = 0;
layout->minwidth = 0.0; layout->minwidth = 0.0f;
list_init(&layout->eruns); list_init(&layout->eruns);
list_init(&layout->inlineobjects); list_init(&layout->inlineobjects);
list_init(&layout->strikethrough); list_init(&layout->strikethrough);
@ -4031,7 +4031,7 @@ static HRESULT init_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat *
layout->metrics.layoutHeight = maxheight; layout->metrics.layoutHeight = maxheight;
layout->measuringmode = DWRITE_MEASURING_MODE_NATURAL; layout->measuringmode = DWRITE_MEASURING_MODE_NATURAL;
layout->ppdip = 0.0; layout->ppdip = 0.0f;
memset(&layout->transform, 0, sizeof(layout->transform)); memset(&layout->transform, 0, sizeof(layout->transform));
layout->str = heap_strdupnW(str, len); layout->str = heap_strdupnW(str, len);
@ -4178,8 +4178,8 @@ static HRESULT WINAPI dwritetrimmingsign_GetMetrics(IDWriteInlineObject *iface,
} }
ret->width = metrics.width; ret->width = metrics.width;
ret->height = 0.0; ret->height = 0.0f;
ret->baseline = 0.0; ret->baseline = 0.0f;
ret->supportsSideways = FALSE; ret->supportsSideways = FALSE;
return S_OK; return S_OK;
} }
@ -4262,7 +4262,7 @@ HRESULT create_trimmingsign(IDWriteFactory2 *factory, IDWriteTextFormat *format,
This->IDWriteInlineObject_iface.lpVtbl = &dwritetrimmingsignvtbl; This->IDWriteInlineObject_iface.lpVtbl = &dwritetrimmingsignvtbl;
This->ref = 1; This->ref = 1;
hr = IDWriteFactory2_CreateTextLayout(factory, &ellipsisW, 1, format, 0.0, 0.0, &This->layout); hr = IDWriteFactory2_CreateTextLayout(factory, &ellipsisW, 1, format, 0.0f, 0.0f, &This->layout);
if (FAILED(hr)) { if (FAILED(hr)) {
heap_free(This); heap_free(This);
return hr; return hr;
@ -4388,7 +4388,7 @@ static HRESULT WINAPI dwritetextformat_SetLineSpacing(IDWriteTextFormat1 *iface,
TRACE("(%p)->(%d %f %f)\n", This, method, spacing, baseline); TRACE("(%p)->(%d %f %f)\n", This, method, spacing, baseline);
if (spacing < 0.0 || (UINT32)method > DWRITE_LINE_SPACING_METHOD_UNIFORM) if (spacing < 0.0f || (UINT32)method > DWRITE_LINE_SPACING_METHOD_UNIFORM)
return E_INVALIDARG; return E_INVALIDARG;
This->format.spacingmethod = method; This->format.spacingmethod = method;
@ -4436,7 +4436,7 @@ static FLOAT WINAPI dwritetextformat_GetIncrementalTabStop(IDWriteTextFormat1 *i
{ {
struct dwrite_textformat *This = impl_from_IDWriteTextFormat1(iface); struct dwrite_textformat *This = impl_from_IDWriteTextFormat1(iface);
FIXME("(%p): stub\n", This); FIXME("(%p): stub\n", This);
return 0.0; return 0.0f;
} }
static HRESULT WINAPI dwritetextformat_GetTrimming(IDWriteTextFormat1 *iface, DWRITE_TRIMMING *options, static HRESULT WINAPI dwritetextformat_GetTrimming(IDWriteTextFormat1 *iface, DWRITE_TRIMMING *options,
@ -4681,8 +4681,8 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle
This->format.flow = DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM; This->format.flow = DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM;
This->format.spacingmethod = DWRITE_LINE_SPACING_METHOD_DEFAULT; This->format.spacingmethod = DWRITE_LINE_SPACING_METHOD_DEFAULT;
This->format.vertical_orientation = DWRITE_VERTICAL_GLYPH_ORIENTATION_DEFAULT; This->format.vertical_orientation = DWRITE_VERTICAL_GLYPH_ORIENTATION_DEFAULT;
This->format.spacing = 0.0; This->format.spacing = 0.0f;
This->format.baseline = 0.0; This->format.baseline = 0.0f;
This->format.trimming.granularity = DWRITE_TRIMMING_GRANULARITY_NONE; This->format.trimming.granularity = DWRITE_TRIMMING_GRANULARITY_NONE;
This->format.trimming.delimiter = 0; This->format.trimming.delimiter = 0;
This->format.trimming.delimiterCount = 0; This->format.trimming.delimiterCount = 0;

View File

@ -921,7 +921,7 @@ static HRESULT WINAPI dwritefactory_CreateMonitorRenderingParams(IDWriteFactory2
if (!fixme_once++) if (!fixme_once++)
FIXME("(%p): monitor setting ignored\n", monitor); FIXME("(%p): monitor setting ignored\n", monitor);
hr = IDWriteFactory2_CreateCustomRenderingParams(iface, 0.0, 0.0, 1.0, 0.0, DWRITE_PIXEL_GEOMETRY_FLAT, DWRITE_RENDERING_MODE_DEFAULT, hr = IDWriteFactory2_CreateCustomRenderingParams(iface, 0.0f, 0.0f, 1.0f, 0.0f, DWRITE_PIXEL_GEOMETRY_FLAT, DWRITE_RENDERING_MODE_DEFAULT,
DWRITE_GRID_FIT_MODE_DEFAULT, &params2); DWRITE_GRID_FIT_MODE_DEFAULT, &params2);
*params = (IDWriteRenderingParams*)params2; *params = (IDWriteRenderingParams*)params2;
return hr; return hr;
@ -936,7 +936,7 @@ static HRESULT WINAPI dwritefactory_CreateCustomRenderingParams(IDWriteFactory2
TRACE("(%p)->(%f %f %f %d %d %p)\n", This, gamma, enhancedContrast, cleartype_level, geometry, mode, params); TRACE("(%p)->(%f %f %f %d %d %p)\n", This, gamma, enhancedContrast, cleartype_level, geometry, mode, params);
hr = IDWriteFactory2_CreateCustomRenderingParams(iface, gamma, enhancedContrast, 1.0, cleartype_level, geometry, hr = IDWriteFactory2_CreateCustomRenderingParams(iface, gamma, enhancedContrast, 1.0f, cleartype_level, geometry,
mode, DWRITE_GRID_FIT_MODE_DEFAULT, &params2); mode, DWRITE_GRID_FIT_MODE_DEFAULT, &params2);
*params = (IDWriteRenderingParams*)params2; *params = (IDWriteRenderingParams*)params2;
return hr; return hr;