diff --git a/RELEASENOTES.md b/RELEASENOTES.md index fef940b552..742b2828e7 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -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) ### diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/SubtitlePainter.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/SubtitlePainter.java index 76768804df..714d40ff9a 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/SubtitlePainter.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/SubtitlePainter.java @@ -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); } /**