-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ALPHA_8 format support for bitmap in Cue. #2058
base: release
Are you sure you want to change the base?
Fix ALPHA_8 format support for bitmap in Cue. #2058
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
@@ -835,6 +837,9 @@ public Cue build() { | |||
private static final String FIELD_MULTI_ROW_ALIGNMENT = Util.intToStringMaxRadix(2); | |||
private static final String FIELD_BITMAP_PARCELABLE = Util.intToStringMaxRadix(3); | |||
private static final String FIELD_BITMAP_BYTES = Util.intToStringMaxRadix(18); | |||
private static final String FIELD_BITMAP_ORIGIN_WIDTH = Util.intToStringMaxRadix(19); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the meaning of the word 'origin' here?
|
||
/** Tests for {@link Cue}. */ | ||
@RunWith(AndroidJUnit4.class) | ||
public class CueTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just move the whole of CueTest
to androidTest
instead of splitting it like this.
bitmap = Bitmap.createBitmap(bitmapWidth,bitmapHeight, Bitmap.Config.ALPHA_8); | ||
Buffer buffer = ByteBuffer.wrap(bitmapBytes); | ||
bitmap.copyPixelsFromBuffer(buffer); | ||
builder.setBitmap(bitmap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: de-duplicate the 3 builder.setBitmap
lines, so the code is instead:
@Nullable Bitmap bitmap = bundle.getParcelable(FIELD_BITMAP_PARCELABLE);
if (bitmap == null) {
// handle bytes case (both compressed and uncompressed) with
// existing code, but assigning `bitmap` each time instead of setting
// it on the builder.
}
builder.setBitmap(bitmap); // Passing null is fine here
Bitmap.compress not support ALPHA_8 format, so we just copy the pixel buffer.
This should fix #2054