| 831 | if (!IsInMenu() && y1 < 5) |
| 832 | { |
| 833 | // scan bitmap to determine where y starts |
| 834 | uint8_t *tmp_bitmap; |
| 835 | int sy; |
| 836 | bool found = false; |
| 837 | for (sy = 0; sy < h && !found; ++sy) |
| 838 | { |
| 839 | for (int tmpx = 0; tmpx < w; ++tmpx) |
| 840 | { |
| 841 | const uint8_t color = bitmap[sy * w + tmpx]; |
| 842 | if (color > 0) |
| 843 | { |
| 844 | found = true; |
| 845 | break; |
| 846 | } |
| 847 | } |
| 848 | } |
| 849 | // reduce bitmap starting the new height |
| 850 | int newh = h - sy; |
| 851 | tmp_bitmap = (uint8_t*) av_malloc(w * newh); |
| 852 | memcpy(tmp_bitmap, bitmap + (w * sy), (w * newh)); |
| 853 | av_free(bitmap); |
| 854 | // change y and h setting. |
| 855 | y1 = sy + y1; |
| 856 | h = newh; |
| 857 | // assign new bitmap |
| 858 | bitmap = (uint8_t*) av_malloc(w * h); |
| 859 | memcpy(bitmap, tmp_bitmap, (w * h)); |
| 860 | av_free(tmp_bitmap); |
| 861 | } |