mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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 width = Math.round(parentWidth * cueSize);
|
||||||
int height = cueBitmapHeight != Cue.DIMEN_UNSET ? Math.round(parentHeight * cueBitmapHeight)
|
int height = cueBitmapHeight != Cue.DIMEN_UNSET ? Math.round(parentHeight * cueBitmapHeight)
|
||||||
: Math.round(width * ((float) cueBitmap.getHeight() / cueBitmap.getWidth()));
|
: Math.round(width * ((float) cueBitmap.getHeight() / cueBitmap.getWidth()));
|
||||||
int x = Math.round(cueLineAnchor == Cue.ANCHOR_TYPE_END ? (anchorX - width)
|
int x =
|
||||||
: cueLineAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorX - (width / 2)) : anchorX);
|
Math.round(
|
||||||
int y = Math.round(cuePositionAnchor == Cue.ANCHOR_TYPE_END ? (anchorY - height)
|
cuePositionAnchor == Cue.ANCHOR_TYPE_END
|
||||||
: cuePositionAnchor == Cue.ANCHOR_TYPE_MIDDLE ? (anchorY - (height / 2)) : anchorY);
|
? (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);
|
bitmapRect = new Rect(x, y, x + width, y + height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue