From 5fbf10969453d823ebe85e39573712669695ef41 Mon Sep 17 00:00:00 2001 From: Oliver Woodman Date: Mon, 20 Feb 2017 13:03:03 +0000 Subject: [PATCH] Use Math.round instead of floor. --- .../com/google/android/exoplayer2/ui/SubtitlePainter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer2/ui/SubtitlePainter.java b/library/src/main/java/com/google/android/exoplayer2/ui/SubtitlePainter.java index 04a6bafd3d..6a1f31d270 100644 --- a/library/src/main/java/com/google/android/exoplayer2/ui/SubtitlePainter.java +++ b/library/src/main/java/com/google/android/exoplayer2/ui/SubtitlePainter.java @@ -307,11 +307,11 @@ import com.google.android.exoplayer2.util.Util; int parentHeight = parentBottom - parentTop; float anchorX = parentLeft + (parentWidth * cuePosition); float anchorY = parentTop + (parentHeight * cueLine); - int width = (int) (parentWidth * cueSize); - int height = (int) (width * ((float) cueBitmap.getHeight() / cueBitmap.getWidth())); - int x = (int) (cueLineAnchor == Cue.ANCHOR_TYPE_END ? (anchorX - width) + int width = Math.round(parentWidth * cueSize); + int height = Math.round(width * ((float) cueBitmap.getHeight() / cueBitmap.getWidth())); + int x = Math.round(cueLineAnchor == Cue.ANCHOR_TYPE_END ? (anchorX - width) : cueLineAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorX - (width / 2)) : anchorX); - int y = (int) (cuePositionAnchor == Cue.ANCHOR_TYPE_END ? (anchorY - height) + int y = Math.round(cuePositionAnchor == Cue.ANCHOR_TYPE_END ? (anchorY - height) : cuePositionAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorY - (height / 2)) : anchorY); bitmapRect = new Rect(x, y, x + width, y + height); }