Skip to content
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

Set bitmap to canvas before translating canvas #2118

Closed
wants to merge 1 commit into from

Conversation

chibatching
Copy link
Contributor

@chibatching chibatching commented May 25, 2018

Motivation (required)

On Android Oreo and building with target SDK 26 or above, PlatformBitmapFactory#createScaledBitmap doesn't work correctly.
Because, Canvas#setBitmap behavior was changed on SDK 26. Calling setBitmap causes reset translation of canvas.
So, we should call setBitmap before translating canvas.

This behavior changes are mentioned at javadoc of Canvas#setBitmap
ref: https://github.com/aosp-mirror/platform_frameworks_base/blob/oreo-release/graphics/java/android/graphics/Canvas.java#L160-L172

Test Plan (required)

Tested on Sample app on target SDK 26 and Oreo device

original scaling
before api_26_original_before api_26_scaling_before
fixed api_26_original_after api_26_scaling_after

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@oprisnik oprisnik self-requested a review May 30, 2018 09:22
Copy link
Contributor

@oprisnik oprisnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good to me.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oprisnik has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@chibatching chibatching deleted the fix_bitmap_factory branch May 31, 2018 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants