mirror of
https://github.com/samsonjs/media.git
synced 2026-03-30 10:15:48 +00:00
Fix anchor usage in SubtitlePainter's setupBitmapLayout
According to Cue's constructor (for bitmaps) documentation: + cuePositionAnchor does horizontal anchoring. + cueLineAnchor does vertical anchoring. Usage is currently inverted. Issue:#5633 PiperOrigin-RevId: 250253002
This commit is contained in:
parent
9b104f6ec0
commit
42ffc5215f
1 changed files with 10 additions and 4 deletions
|
|
@ -362,10 +362,16 @@ import com.google.android.exoplayer2.util.Util;
|
|||
int width = Math.round(parentWidth * cueSize);
|
||||
int height = cueBitmapHeight != Cue.DIMEN_UNSET ? Math.round(parentHeight * cueBitmapHeight)
|
||||
: 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 = Math.round(cuePositionAnchor == Cue.ANCHOR_TYPE_END ? (anchorY - height)
|
||||
: cuePositionAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorY - (height / 2)) : anchorY);
|
||||
int x =
|
||||
Math.round(
|
||||
cuePositionAnchor == Cue.ANCHOR_TYPE_END
|
||||
? (anchorX - width)
|
||||
: cuePositionAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorX - (width / 2)) : anchorX);
|
||||
int y =
|
||||
Math.round(
|
||||
cueLineAnchor == Cue.ANCHOR_TYPE_END
|
||||
? (anchorY - height)
|
||||
: cueLineAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorY - (height / 2)) : anchorY);
|
||||
bitmapRect = new Rect(x, y, x + width, y + height);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue