summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-05-29 00:10:28 +0800
committerSebastian Rasmussen <sebras@gmail.com>2017-05-31 20:29:30 +0800
commit2d68de96c62c1e6d6a2b615336d99b671fc672b7 (patch)
treec309b8fdf623a0fd56aebc38c863b596e23c379f /platform
parent73d7b296bd549a7e985ea9df9f13e6ad3701ef89 (diff)
downloadmupdf-2d68de96c62c1e6d6a2b615336d99b671fc672b7.tar.xz
Avoid double literals causing casts to float.
Diffstat (limited to 'platform')
-rw-r--r--platform/gl/gl-main.c10
-rw-r--r--platform/x11/pdfapp.c10
-rw-r--r--platform/x11/win_main.c2
-rw-r--r--platform/x11/x11_main.c4
4 files changed, 13 insertions, 13 deletions
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
index 25b9d664..62de7fa0 100644
--- a/platform/gl/gl-main.c
+++ b/platform/gl/gl-main.c
@@ -260,8 +260,8 @@ void texture_from_pixmap(struct texture *tex, fz_pixmap *pix)
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w2, h2, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w, tex->h, pix->n == 4 ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, pix->samples);
- tex->s = (float)tex->w / w2;
- tex->t = (float)tex->h / h2;
+ tex->s = (float) tex->w / w2;
+ tex->t = (float) tex->h / h2;
}
}
@@ -811,12 +811,12 @@ static void toggle_outline(void)
static void auto_zoom_w(void)
{
- currentzoom = fz_clamp(currentzoom * canvas_w / (float)page_tex.w, MINRES, MAXRES);
+ currentzoom = fz_clamp(currentzoom * canvas_w / page_tex.w, MINRES, MAXRES);
}
static void auto_zoom_h(void)
{
- currentzoom = fz_clamp(currentzoom * canvas_h / (float)page_tex.h, MINRES, MAXRES);
+ currentzoom = fz_clamp(currentzoom * canvas_h / page_tex.h, MINRES, MAXRES);
}
static void auto_zoom(void)
@@ -1242,7 +1242,7 @@ static void run_main_loop(void)
ui.key = ui.mod = 0;
ui.down = ui.middle = ui.right = 0;
- while (glfwGetTime() < start_time + 0.2)
+ while (glfwGetTime() < start_time + 0.2f)
{
search_hit_count = fz_search_page_number(ctx, doc, search_page, search_needle,
search_hit_bbox, nelem(search_hit_bbox));
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c
index f1f28905..e5b7ed9e 100644
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -128,7 +128,7 @@ void pdfapp_init(fz_context *ctx, pdfapp_t *app)
app->layout_css = NULL;
app->layout_use_doc_css = 1;
- app->transition.duration = 0.25;
+ app->transition.duration = 0.25f;
app->transition.type = FZ_TRANSITION_FADE;
#if defined(_WIN32) || defined(_WIN64)
app->colorspace = fz_device_bgr(ctx);
@@ -1105,7 +1105,7 @@ void pdfapp_onresize(pdfapp_t *app, int w, int h)
void pdfapp_autozoom_vertical(pdfapp_t *app)
{
- app->resolution *= (double) app->winh / (double) fz_pixmap_height(app->ctx, app->image);
+ app->resolution *= (float) app->winh / fz_pixmap_height(app->ctx, app->image);
if (app->resolution > MAXRES)
app->resolution = MAXRES;
else if (app->resolution < MINRES)
@@ -1115,7 +1115,7 @@ void pdfapp_autozoom_vertical(pdfapp_t *app)
void pdfapp_autozoom_horizontal(pdfapp_t *app)
{
- app->resolution *= (double) app->winw / (double) fz_pixmap_width(app->ctx, app->image);
+ app->resolution *= (float) app->winw / fz_pixmap_width(app->ctx, app->image);
if (app->resolution > MAXRES)
app->resolution = MAXRES;
else if (app->resolution < MINRES)
@@ -1211,7 +1211,7 @@ void pdfapp_onkey(pdfapp_t *app, int c, int modifiers)
app->layout_em -= 2;
fz_layout_document(app->ctx, app->doc, app->layout_w, app->layout_h, app->layout_em);
app->pagecount = fz_count_pages(app->ctx, app->doc);
- app->pageno = app->pagecount * percent + 0.1;
+ app->pageno = app->pagecount * percent + 0.1f;
pdfapp_showpage(app, 1, 1, 1, 0, 0);
}
break;
@@ -1222,7 +1222,7 @@ void pdfapp_onkey(pdfapp_t *app, int c, int modifiers)
app->layout_em += 2;
fz_layout_document(app->ctx, app->doc, app->layout_w, app->layout_h, app->layout_em);
app->pagecount = fz_count_pages(app->ctx, app->doc);
- app->pageno = app->pagecount * percent + 0.1;
+ app->pageno = app->pagecount * percent + 0.1f;
pdfapp_showpage(app, 1, 1, 1, 0, 0);
}
break;
diff --git a/platform/x11/win_main.c b/platform/x11/win_main.c
index ae1c4255..860c6dbc 100644
--- a/platform/x11/win_main.c
+++ b/platform/x11/win_main.c
@@ -1203,7 +1203,7 @@ get_system_dpi(void)
hdpi = GetDeviceCaps(desktopDC, LOGPIXELSX);
vdpi = GetDeviceCaps(desktopDC, LOGPIXELSY);
/* hdpi,vdpi = 100 means 96dpi. */
- return ((hdpi + vdpi) * 96.0 + 0.5) / 200;
+ return ((hdpi + vdpi) * 96 + 0.5f) / 200;
}
static void usage(void)
diff --git a/platform/x11/x11_main.c b/platform/x11/x11_main.c
index 4c96ecc9..dc99878b 100644
--- a/platform/x11/x11_main.c
+++ b/platform/x11/x11_main.c
@@ -350,8 +350,8 @@ void cleanup(pdfapp_t *app)
static int winresolution()
{
- return DisplayWidth(xdpy, xscr) * 25.4 /
- DisplayWidthMM(xdpy, xscr) + 0.5;
+ return DisplayWidth(xdpy, xscr) * 25.4f /
+ DisplayWidthMM(xdpy, xscr) + 0.5f;
}
void wincursor(pdfapp_t *app, int curs)