Skip to content

Commit

Permalink
SystemUI: Don't forcefully convert wallpaper to SRGB
Browse files Browse the repository at this point in the history
The issue occurs when the user tries to set as wallpaper an image that
is not SRGB.
Fix the issue by making sure the greyscale bitmap has the same
color space as the original image ( which would default to SRGB otherwise
and in some cases the R+G+B would overflow the 255 limit )

Test: https://drive.google.com/file/d/11rxzYvPcIOh_8GvS4XSC3YtbW3CecE-O/view

Change-Id: I2b0c40eef608f423dbbee4a80df55c271f9856c3
Signed-off-by: Anushek Prasal <anushekprasal@gmail.com>
  • Loading branch information
luca020400 authored and SKULSHADY committed Jun 4, 2020
1 parent d7055ac commit 4133ee4
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -116,7 +116,8 @@ private Bitmap toGrayscale(Bitmap bitmap) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();

Bitmap grayscale = Bitmap.createBitmap(width, height, bitmap.getConfig());
Bitmap grayscale = Bitmap.createBitmap(width, height,
bitmap.getConfig(), false, bitmap.getColorSpace());
Canvas canvas = new Canvas(grayscale);
ColorMatrix cm = new ColorMatrix(LUMINOSITY_MATRIX);
Paint paint = new Paint();
Expand Down

0 comments on commit 4133ee4

Please sign in to comment.