mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
Use anti-aliasing and bitmap filtering for bitmap subtitles
issue:#6950 PiperOrigin-RevId: 307411067
This commit is contained in:
parent
8d0d31e15c
commit
6a36574af3
2 changed files with 18 additions and 7 deletions
|
|
@ -95,6 +95,8 @@
|
|||
(a
|
||||
[previous draft](https://www.w3.org/TR/2014/WD-webvtt1-20141111/#dfn-webvtt-text-position-cue-setting)
|
||||
used `start`, `middle` and `end`).
|
||||
* Use anti-aliasing and bitmap filtering when displaying bitmap subtitles
|
||||
([#6950](https://github.com/google/ExoPlayer/pull/6950)).
|
||||
* DRM:
|
||||
* Add support for attaching DRM sessions to clear content in the demo app.
|
||||
* Remove `DrmSessionManager` references from all renderers.
|
||||
|
|
|
|||
|
|
@ -65,7 +65,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;
|
||||
|
|
@ -124,9 +125,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -442,9 +447,13 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
|
|||
canvas.translate(textLeft, textTop);
|
||||
|
||||
if (Color.alpha(windowColor) > 0) {
|
||||
paint.setColor(windowColor);
|
||||
windowPaint.setColor(windowColor);
|
||||
canvas.drawRect(
|
||||
-textPaddingX, 0, textLayout.getWidth() + textPaddingX, textLayout.getHeight(), paint);
|
||||
-textPaddingX,
|
||||
0,
|
||||
textLayout.getWidth() + textPaddingX,
|
||||
textLayout.getHeight(),
|
||||
windowPaint);
|
||||
}
|
||||
|
||||
if (edgeType == CaptionStyleCompat.EDGE_TYPE_OUTLINE) {
|
||||
|
|
@ -478,7 +487,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