cats-oss / android-gpuimage

Android filters based on OpenGL (idea from GPUImage for iOS)
8.98k stars 2.26k forks source link

Fixed an error in bitmap padding adding for width to have even value #476

Closed artem-mi closed 4 years ago

artem-mi commented 4 years ago

What does this change?

In setImageBitmap method of GPUImageRenderer the bitmap is resized to have even width. A canvas is constructed to draw to newly created bitmap with additional row: first canvas is fiiled with black and then original bitmap is drawn. The problem is that a density of the created bitmap is implicitly set to the density of the current display (according to the createBitmap method docs) and canvas receives bitmap's density while source bitmap has its own density and is automatically scaled when drawBitmap method called (as stated in drawBitmap docs). This results in that only piece of the source image is drawn to canvas. The workaround is to set resized bitmap density to be equal to source bitmap density.

What is the value of this and can you measure success?

As a result of the fix a padding row is added correctly.

CLAassistant commented 4 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

:white_check_mark: wasabeef
:x: Artem Matskevich


Artem Matskevich seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.