Commit 74f00fa1 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Consistently use explicit float literals.

parent 3a653fb8
......@@ -1056,8 +1056,8 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2
a = 0;
advances[i] = get_scaled_advance_width(a, emSize, &metrics);
offsets[i].advanceOffset = 0.0;
offsets[i].ascenderOffset = 0.0;
offsets[i].advanceOffset = 0.0f;
offsets[i].ascenderOffset = 0.0f;
}
/* FIXME: actually apply features */
......@@ -1105,11 +1105,11 @@ static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWrite
hr = IDWriteFontFace1_GetGdiCompatibleGlyphAdvances(fontface1, emSize, ppdip,
transform, use_gdi_natural, is_sideways, 1, &glyphs[i], &a);
if (FAILED(hr))
advances[i] = 0.0;
advances[i] = 0.0f;
else
advances[i] = floorf(a * emSize * ppdip / metrics.designUnitsPerEm + 0.5f) / ppdip;
offsets[i].advanceOffset = 0.0;
offsets[i].ascenderOffset = 0.0;
offsets[i].advanceOffset = 0.0f;
offsets[i].ascenderOffset = 0.0f;
}
/* 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)
{
FLOAT advance = 0.0;
FLOAT advance = 0.0f;
for (; start < end; start++)
advance += advances[start];
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,
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 origin = 0.0;
FLOAT origin = 0.0f;
if (props[g].isZeroWidthSpace) {
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 */
if (leading_spacing < 0.0) {
if (leading_spacing < 0.0f) {
advance += leading_spacing;
origin -= leading_spacing;
}
if (trailing_spacing < 0.0)
if (trailing_spacing < 0.0f)
advance += trailing_spacing;
if (advance < min_advance_width) {
FLOAT half = (min_advance_width - advance) / 2.0;
FLOAT half = (min_advance_width - advance) / 2.0f;
if (!reduced)
origin -= half;
else if (leading_spacing < 0.0 && trailing_spacing < 0.0)
else if (leading_spacing < 0.0f && trailing_spacing < 0.0f)
origin -= half;
else if (leading_spacing < 0.0)
else if (leading_spacing < 0.0f)
origin -= min_advance_width - advance;
advance = min_advance_width;
}
/* now apply positive spacing adjustments */
if (leading_spacing > 0.0) {
if (leading_spacing > 0.0f) {
advance += leading_spacing;
origin -= leading_spacing;
}
if (trailing_spacing > 0.0)
if (trailing_spacing > 0.0f)
advance += trailing_spacing;
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,
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 origin = 0.0;
FLOAT origin = 0.0f;
UINT16 g;
modified_advances[start] = advances[start];
modified_advances[end-1] = advances[end-1];
/* first apply negative spacing and check if we hit minimum width */
if (leading_spacing < 0.0) {
if (leading_spacing < 0.0f) {
advance += leading_spacing;
modified_advances[start] += leading_spacing;
origin -= leading_spacing;
}
if (trailing_spacing < 0.0) {
if (trailing_spacing < 0.0f) {
advance += 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[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;
modified_advances[start] += half;
modified_advances[end-1] += half;
}
else if (leading_spacing < 0.0) {
else if (leading_spacing < 0.0f) {
origin -= 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 */
if (leading_spacing > 0.0) {
if (leading_spacing > 0.0f) {
modified_advances[start] += leading_spacing;
origin -= leading_spacing;
}
if (trailing_spacing > 0.0)
if (trailing_spacing > 0.0f)
modified_advances[end-1] += trailing_spacing;
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,
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));
return E_INVALIDARG;
}
/* 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_offsets, offsets, glyph_count*sizeof(*offsets));
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)
{
static const DWRITE_MATRIX transforms[] = {
{ 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 },
{ 0.0, 1.0, -1.0, 0.0, 0.0, 0.0 },
{ -1.0, 0.0, 0.0, -1.0, 0.0, 0.0 },
{ 0.0, -1.0, 1.0, 0.0, 0.0, 0.0 }
{ 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f },
{ -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f },
{ 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);
......@@ -1506,7 +1506,7 @@ static HRESULT WINAPI dwritetextanalyzer2_GetGlyphOrientationTransform(IDWriteTe
/* shift components represent transform necessary to get from original point to
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->dy = originY - (m->m12 * originX + m->m22 * originY);
}
......
......@@ -608,7 +608,7 @@ HRESULT new_glyph_outline(UINT32 count, struct glyph_outline **ret)
outline->points = points;
outline->tags = tags;
outline->count = count;
outline->advance = 0.0;
outline->advance = 0.0f;
*ret = outline;
return S_OK;
......@@ -659,7 +659,7 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace2 *iface,
UINT32 count, BOOL is_sideways, BOOL is_rtl, IDWriteGeometrySink *sink)
{
struct dwrite_fontface *This = impl_from_IDWriteFontFace2(iface);
FLOAT advance = 0.0;
FLOAT advance = 0.0f;
HRESULT hr;
UINT32 g;
......@@ -676,7 +676,7 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace2 *iface,
ID2D1SimplifiedGeometrySink_SetFillMode(sink, D2D1_FILL_MODE_WINDING);
for (g = 0; g < count; g++) {
FLOAT xoffset = 0.0, yoffset = 0.0;
FLOAT xoffset = 0.0f, yoffset = 0.0f;
struct glyph_outline *outline;
/* FIXME: cache outlines */
......@@ -692,7 +692,7 @@ static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace2 *iface,
}
if (g == 0)
advance = is_rtl ? -outline->advance : 0.0;
advance = is_rtl ? -outline->advance : 0.0f;
xoffset += advance;
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);
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));
return E_INVALIDARG;
}
em_size *= pixels_per_dip;
if (m && m->m22 != 0.0)
if (m && m->m22 != 0.0f)
em_size *= fabs(m->m22);
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,
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);
return E_INVALIDARG;
}
em_size *= ppdip;
if (em_size == 0.0) {
if (em_size == 0.0f) {
memset(advances, 0, sizeof(*advances) * glyph_count);
return S_OK;
}
......
......@@ -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)
{
p->x = v->x / 64.0;
p->y = v->y / 64.0;
p->x = v->x / 64.0f;
p->y = v->y / 64.0f;
}
/* Convert the quadratic Beziers to cubic Beziers. */
......
......@@ -461,7 +461,7 @@ static HRESULT WINAPI rendertarget_SetPixelsPerDip(IDWriteBitmapRenderTarget1 *i
TRACE("(%p)->(%.2f)\n", This, ppdip);
if (ppdip <= 0.0)
if (ppdip <= 0.0f)
return E_INVALIDARG;
This->ppdip = ppdip;
......
......@@ -921,7 +921,7 @@ static HRESULT WINAPI dwritefactory_CreateMonitorRenderingParams(IDWriteFactory2
if (!fixme_once++)
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);
*params = (IDWriteRenderingParams*)params2;
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);
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);
*params = (IDWriteRenderingParams*)params2;
return hr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment