Takes a bitmap and blits it to the screen using linear frame buffer stuff X and Y are the destination X,Y
| 3161 | // Takes a bitmap and blits it to the screen using linear frame buffer stuff |
| 3162 | // X and Y are the destination X,Y |
| 3163 | void d3d_CopyBitmapToFramebuffer(int bm_handle, int x, int y) { |
| 3164 | renderer_lfb lfb; |
| 3165 | |
| 3166 | ASSERT(d3d_Framebuffer_ready); |
| 3167 | |
| 3168 | lfb.data = NULL; |
| 3169 | lfb.type = LFB_LOCK_WRITE; |
| 3170 | |
| 3171 | d3d_GetLFBLock(&lfb); |
| 3172 | |
| 3173 | if (lfb.data == NULL) |
| 3174 | return; // No copy! |
| 3175 | |
| 3176 | int w = bm_w(bm_handle, 0); |
| 3177 | int h = bm_h(bm_handle, 0); |
| 3178 | |
| 3179 | uint16_t *dptr = lfb.data; |
| 3180 | uint16_t *sptr = (uint16_t *)bm_data(bm_handle, 0); |
| 3181 | |
| 3182 | dptr += (y * (lfb.bytes_per_row / 2)); |
| 3183 | dptr += x; |
| 3184 | |
| 3185 | int i, t; |
| 3186 | |
| 3187 | for (i = 0; i < h; i++, dptr += (lfb.bytes_per_row / 2)) { |
| 3188 | for (t = 0; t < w; t++, sptr++) { |
| 3189 | dptr[t] = d3d_Framebuffer_translate[(*sptr & ~OPAQUE_FLAG)]; |
| 3190 | } |
| 3191 | } |
| 3192 | |
| 3193 | d3d_ReleaseLFBLock(&lfb); |
| 3194 | } |
| 3195 | |
| 3196 | // Takes a screenshot of the frontbuffer and puts it into the passed bitmap handle |
| 3197 | void d3d_Screenshot(int bm_handle) { |
no test coverage detected