summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-06-05 23:46:37 +0200
committerCarl Hetherington <cth@carlh.net>2022-06-05 23:46:37 +0200
commit6c5328f07362510a41c8518ced62d74b2eff25cc (patch)
tree308edc86eecd688a45740a03356a15d685a774c5
parent872000f46a36849433219c0a20b11262f9f9a031 (diff)
Make size_in_pixels() more accurate.v1.8.20
-rw-r--r--src/subtitle_string.cc4
-rw-r--r--src/subtitle_string.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/subtitle_string.cc b/src/subtitle_string.cc
index 5e2c6251..e70a849f 100644
--- a/src/subtitle_string.cc
+++ b/src/subtitle_string.cc
@@ -90,7 +90,7 @@ SubtitleString::SubtitleString (
}
-int
+float
SubtitleString::size_in_pixels (int screen_height) const
{
/* Size in the subtitle file is given in points as if the screen
@@ -98,7 +98,7 @@ SubtitleString::size_in_pixels (int screen_height) const
height.
*/
- return _size * screen_height / (11 * 72);
+ return _size * static_cast<float>(screen_height) / (11.0f * 72.0f);
}
diff --git a/src/subtitle_string.h b/src/subtitle_string.h
index f6d0974b..f6c39836 100644
--- a/src/subtitle_string.h
+++ b/src/subtitle_string.h
@@ -142,7 +142,7 @@ public:
return _size;
}
- int size_in_pixels (int screen_height) const;
+ float size_in_pixels (int screen_height) const;
float space_before () const {
return _space_before;