Created
June 22, 2017 09:17
-
-
Save taeguk/66e815e9460265f5e170b3c43befaffd to your computer and use it in GitHub Desktop.
haha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Added by taeguk. | |
| static void fb_fake_for_taeguk(private_handle_t const* hnd, private_module_t* m) | |
| { | |
| static int called_cnt = 0; | |
| int width = m->info.xres; | |
| int height = m->info.yres; | |
| int bpp = m->info.bits_per_pixel / 8; | |
| int xoffset = m->info.xoffset; | |
| int yoffset = m->info.yoffset; | |
| char* fb_ptr = reinterpret_cast<char *>(hnd->base); | |
| ++called_cnt; | |
| ALOGE("[@@TAEGUK@@] <%s,%d> #%d# fb_fake_for_taeguk() called!\n", __FUNCTION__, __LINE__, called_cnt); | |
| ALOGE("[@@TAEGUK@@] <%s,%d> #%d# width = %d, height = %d, bpp = %d, xoffset = %d, yoffset = %d, line_length = %d\n", __FUNCTION__, __LINE__, called_cnt, width, height, bpp, xoffset, yoffset, m->finfo.line_length); | |
| if (m->info.bits_per_pixel == 32) | |
| { | |
| /* | |
| * RGBA 8/8/8/8 | |
| */ | |
| for (int y=0; y<height / 2; ++y) | |
| { | |
| char* fb_pixel_ptr = fb_ptr + (y + yoffset) * m->finfo.line_length + xoffset * bpp; | |
| for (int x=0; x<width; ++x, fb_pixel_ptr += bpp) | |
| { | |
| fb_pixel_ptr[0] = 0; // R | |
| //fb_pixel_ptr[1] = 0; // G | |
| //fb_pixel_ptr[2] = 0; // B | |
| //fb_pixel_ptr[3] = 0; // A | |
| } | |
| } | |
| } | |
| else | |
| { | |
| for (int y=0; y<height / 2; ++y) | |
| { | |
| char* fb_pixel_ptr = fb_ptr + (y + yoffset) * m->finfo.line_length + xoffset * bpp; | |
| for (int x=0; x<width; ++x, fb_pixel_ptr += bpp) | |
| { | |
| /* | |
| * RGB 5/6/5 | |
| */ | |
| unsigned short* pixel = reinterpret_cast<unsigned short*>(fb_pixel_ptr); | |
| *pixel = *pixel & (0xFFFF >> 5); // Remove Red. | |
| } | |
| } | |
| } | |
| ALOGE("[@@TAEGUK@@] <%s,%d> #%d# fb_fake_for_taeguk() finished!\n", __FUNCTION__, __LINE__, called_cnt); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment