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
base: master
from

Conversation

Projects
None yet
3 participants
@chibatching
Contributor

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

This comment has been minimized.

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

This comment has been minimized.

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

@oprisnik

Thanks! Looks good to me.

@facebook-github-bot

@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