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

wants to merge 1 commit into from


Copy link

@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

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
Copy link

@facebook-github-bot facebook-github-bot commented May 25, 2018

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 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 Thanks!

Copy link

@facebook-github-bot facebook-github-bot commented May 25, 2018

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
Copy link

@oprisnik oprisnik left a comment

Thanks! Looks good to me.

Copy link

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

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

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

Successfully merging this pull request may close these issues.

None yet

3 participants