mirror of
https://github.com/samsonjs/media.git
synced 2026-04-11 12:15:47 +00:00
Use anti-aliasing and bitmap filtering for bitmap subtitles
issue:#6950 PiperOrigin-RevId: 307411067
This commit is contained in:
parent
a697905cfb
commit
d9703358ac
2 changed files with 21 additions and 8 deletions
|
|
@ -1,3 +1,4 @@
|
|||
<<<<<<< HEAD
|
||||
# Release notes #
|
||||
|
||||
### Next release ###
|
||||
|
|
@ -15,6 +16,9 @@
|
|||
marked with the `C.ROLE_FLAG_TRICK_PLAY` flag.
|
||||
* MPEG-TS: Fix issue where SEI NAL units were incorrectly dropped from H.265
|
||||
samples ([#7113](https://github.com/google/ExoPlayer/issues/7113)).
|
||||
* Text
|
||||
* Use anti-aliasing and bitmap filtering when displaying bitmap subtitles
|
||||
([#6950](https://github.com/google/ExoPlayer/pull/6950)).
|
||||
|
||||
### 2.11.4 (2020-04-08) ###
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||
private final float spacingAdd;
|
||||
|
||||
private final TextPaint textPaint;
|
||||
private final Paint paint;
|
||||
private final Paint windowPaint;
|
||||
private final Paint bitmapPaint;
|
||||
|
||||
// Previous input variables.
|
||||
@Nullable private CharSequence cueText;
|
||||
|
|
@ -122,9 +123,13 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||
textPaint.setAntiAlias(true);
|
||||
textPaint.setSubpixelText(true);
|
||||
|
||||
paint = new Paint();
|
||||
paint.setAntiAlias(true);
|
||||
paint.setStyle(Style.FILL);
|
||||
windowPaint = new Paint();
|
||||
windowPaint.setAntiAlias(true);
|
||||
windowPaint.setStyle(Style.FILL);
|
||||
|
||||
bitmapPaint = new Paint();
|
||||
bitmapPaint.setAntiAlias(true);
|
||||
bitmapPaint.setFilterBitmap(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -415,9 +420,13 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||
canvas.translate(textLeft, textTop);
|
||||
|
||||
if (Color.alpha(windowColor) > 0) {
|
||||
paint.setColor(windowColor);
|
||||
canvas.drawRect(-textPaddingX, 0, layout.getWidth() + textPaddingX, layout.getHeight(),
|
||||
paint);
|
||||
windowPaint.setColor(windowColor);
|
||||
canvas.drawRect(
|
||||
-textPaddingX,
|
||||
0,
|
||||
textLayout.getWidth() + textPaddingX,
|
||||
textLayout.getHeight(),
|
||||
windowPaint);
|
||||
}
|
||||
|
||||
if (edgeType == CaptionStyleCompat.EDGE_TYPE_OUTLINE) {
|
||||
|
|
@ -451,7 +460,7 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||
|
||||
@RequiresNonNull({"cueBitmap", "bitmapRect"})
|
||||
private void drawBitmapLayout(Canvas canvas) {
|
||||
canvas.drawBitmap(cueBitmap, /* src= */ null, bitmapRect, /* paint= */ null);
|
||||
canvas.drawBitmap(cueBitmap, /* src= */ null, bitmapRect, bitmapPaint);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue