* generate a large piece of the world * @param vp Viewport area to draw * @param buf Videobuffer with same bitdepth as current blitter * @param y First line to render * @param pitch Pitch of the videobuffer * @param n Number of lines to render */
| 86 | * @param n Number of lines to render |
| 87 | */ |
| 88 | static void LargeWorldCallback(Viewport &vp, void *buf, uint y, uint pitch, uint n) |
| 89 | { |
| 90 | DrawPixelInfo dpi{ |
| 91 | .dst_ptr = buf, |
| 92 | .left = 0, |
| 93 | .top = static_cast<int>(y), |
| 94 | .width = vp.width, |
| 95 | .height = static_cast<int>(n), |
| 96 | .pitch = static_cast<int>(pitch), |
| 97 | .zoom = ZoomLevel::WorldScreenshot |
| 98 | }; |
| 99 | |
| 100 | /* We are no longer rendering to the screen */ |
| 101 | AutoRestoreBackup screen_backup(_screen, { |
| 102 | .dst_ptr = buf, |
| 103 | .left = 0, |
| 104 | .top = 0, |
| 105 | .width = static_cast<int>(pitch), |
| 106 | .height = static_cast<int>(n), |
| 107 | .pitch = static_cast<int>(pitch), |
| 108 | .zoom = ZoomLevel::Min |
| 109 | }); |
| 110 | AutoRestoreBackup disable_anim_backup(_screen_disable_anim, true); |
| 111 | AutoRestoreBackup dpi_backup(_cur_dpi, &dpi); |
| 112 | |
| 113 | /* Render viewport in blocks of 1600 pixels width */ |
| 114 | int left = 0; |
| 115 | while (vp.width - left != 0) { |
| 116 | int wx = std::min(vp.width - left, 1600); |
| 117 | left += wx; |
| 118 | |
| 119 | ViewportDoDraw(vp, |
| 120 | ScaleByZoom(left - wx - vp.left, vp.zoom) + vp.virtual_left, |
| 121 | ScaleByZoom(y - vp.top, vp.zoom) + vp.virtual_top, |
| 122 | ScaleByZoom(left - vp.left, vp.zoom) + vp.virtual_left, |
| 123 | ScaleByZoom((y + n) - vp.top, vp.zoom) + vp.virtual_top |
| 124 | ); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Construct a pathname for a screenshot file. |
no test coverage detected