Skip to content

Conversation

@copybara-service
Copy link

Use Bitmap.copyPixelsFromBuffer to copy image data ImageReader in HW rendering

When HardwareRenderer is used, the underlying Bitmap data is stored as
premultiplied alpha. Previously, when that data is copied to an Android Bitmap
object, Bitmap.setPixels was used, which assumed the int array passed was
un-premultiplied data. Update to use Bitmap.copyPixelsFromBuffer, which does
not make any assumptions about the underlying data. By default Android bitmaps
are stored as premultiplied alpha.

This fixes an issue with alpha blending in HW rendering.

@copybara-service copybara-service bot force-pushed the piper_624246707 branch 2 times, most recently from fc2d5f0 to dbb8be7 Compare April 14, 2024 18:12
…rendering

When HardwareRenderer is used, the underlying Bitmap data is stored as
premultiplied alpha. Previously, when that data is copied to an Android Bitmap
object, Bitmap.setPixels was used, which assumed the int array passed was
un-premultiplied data. Update to use Bitmap.copyPixelsFromBuffer, which does
not make any assumptions about the underlying data. By default Android bitmaps
are stored as premultiplied alpha.

This fixes an issue with alpha blending in HW rendering.

PiperOrigin-RevId: 624739361
@copybara-service copybara-service bot merged commit c0c8e98 into google Apr 14, 2024
@copybara-service copybara-service bot deleted the piper_624246707 branch April 14, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants