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

Invalid color conversion done in UG_DrawBMP for a BMP 565 format screen #22

Open
ajaiantilal opened this issue Sep 21, 2016 · 2 comments

Comments

@ajaiantilal
Copy link

In UG_DrawBMP(),
invalid color conversion done when BMP format is 565.

just before this line the color is set to 888 format, but that causes wrong colors to be displayed on a 565 format screen
https://github.com/achimdoebler/UGUI/blob/master/ugui.c#L5840

a possible fix:

         tmp = *p++;
         #ifdef USE_COLOR_RGB565
            UG_DrawPixel( xp++ , yp , tmp );
         #else
            /* Convert RGB565 to RGB888 */
            r = (tmp>>11)&0x1F;
            r<<=3;
            g = (tmp>>5)&0x3F;
            g<<=2;
            b = (tmp)&0x1F;
            b<<=3;
            c = ((UG_COLOR)r<<16) | ((UG_COLOR)g<<8) | (UG_COLOR)b;
            UG_DrawPixel( xp++ , yp , c );
         #endif

@andreygursky
Copy link

@achimdoebler:

BTW: No, the project is still alive! [06.08.2017]

Good news, thanks! So please commit this fix or explain in short why it doesn't fit.

@roman200918715
Copy link

I had tested this fix, and the results are success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants