Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
31513202
authored
Feb 20, 2017
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix subtitle painter issues
parent
21923ae1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
library/src/main/java/com/google/android/exoplayer2/ui/SubtitlePainter.java
library/src/main/java/com/google/android/exoplayer2/ui/SubtitlePainter.java
View file @
31513202
...
...
@@ -65,9 +65,9 @@ import com.google.android.exoplayer2.util.Util;
private
final
Paint
paint
;
// Previous input variables.
private
Bitmap
cueBitmap
;
private
CharSequence
cueText
;
private
Alignment
cueTextAlignment
;
private
Bitmap
cueBitmap
;
private
float
cueLine
;
@Cue
.
LineType
private
int
cueLineType
;
...
...
@@ -148,12 +148,14 @@ import com.google.android.exoplayer2.util.Util;
boolean
isTextCue
=
cue
.
bitmap
==
null
;
CharSequence
cueText
=
null
;
Bitmap
cueBitmap
=
null
;
int
windowColor
=
Color
.
BLACK
;
if
(
isTextCue
)
{
cueText
=
cue
.
text
;
if
(
TextUtils
.
isEmpty
(
cueText
))
{
// Nothing to draw.
return
;
}
windowColor
=
cue
.
windowColorSet
?
cue
.
windowColor
:
style
.
windowColor
;
if
(!
applyEmbeddedStyles
)
{
// Strip out any embedded styling.
cueText
=
cueText
.
toString
();
...
...
@@ -174,7 +176,7 @@ import com.google.android.exoplayer2.util.Util;
&&
this
.
applyEmbeddedStyles
==
applyEmbeddedStyles
&&
this
.
foregroundColor
==
style
.
foregroundColor
&&
this
.
backgroundColor
==
style
.
backgroundColor
&&
this
.
windowColor
==
style
.
windowColor
&&
this
.
windowColor
==
windowColor
&&
this
.
edgeType
==
style
.
edgeType
&&
this
.
edgeColor
==
style
.
edgeColor
&&
Util
.
areEqual
(
this
.
textPaint
.
getTypeface
(),
style
.
typeface
)
...
...
@@ -275,7 +277,7 @@ import com.google.android.exoplayer2.util.Util;
if
(
cueLine
>=
0
)
{
anchorPosition
=
Math
.
round
(
cueLine
*
firstLineHeight
)
+
parentTop
;
}
else
{
anchorPosition
=
Math
.
round
(
cueLine
*
firstLineHeight
)
+
parentBottom
;
anchorPosition
=
Math
.
round
(
(
cueLine
+
1
)
*
firstLineHeight
)
+
parentBottom
;
}
}
textTop
=
cueLineAnchor
==
Cue
.
ANCHOR_TYPE_END
?
anchorPosition
-
textHeight
...
...
@@ -309,8 +311,8 @@ import com.google.android.exoplayer2.util.Util;
int
height
=
(
int
)
(
width
*
((
float
)
cueBitmap
.
getHeight
()
/
cueBitmap
.
getWidth
()));
int
x
=
(
int
)
(
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
-
width
)
:
cuePositionAnchor
==
Cue
.
ANCHOR_TYPE_MIDDLE
?
(
anchorY
-
(
width
/
2
))
:
anchorY
);
int
y
=
(
int
)
(
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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment