| Summary: | Hardcoded srcA value in SDL_Blit_RGB888_RGB888_Blend_Scale function | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Nitz <nitin.j4> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sylvain.becker |
| Version: | 2.0.0 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
| Attachments: | patch | ||
Created attachment 3041 [details]
patch
not fully tested, but here's a patch to remove hardcoded constants.
Modified sdlgenblit.pl so that when: srcA = 0xFF; or A = 0xFF; It is initialised as const and/or inlined afterwards. Un-reacheable code is removed ! |
In Function static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info) { // Some Code srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF; dstpixel = *dst; dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF; if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) { /* This goes away if we ever use premultiplied alpha */ if (srcA < 255) { srcR = (srcR * srcA) / 255; srcG = (srcG * srcA) / 255; srcB = (srcB * srcA) / 255; } } //Some Code } In this code srcA and dstA value is hardcoded to 0xFF, because of which the if condition if (srcA < 255) { srcR = (srcR * srcA) / 255; srcG = (srcG * srcA) / 255; srcB = (srcB * srcA) / 255; } will never get executed. So either remove this code or change the hardcoded value of srcA and dstA. Thanks!