MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / DrawMenuPicture

Method DrawMenuPicture

PanzerChasm/menu_drawer_soft.cpp:238–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238void MenuDrawerSoft::DrawMenuPicture(
239 const int start_x, const int start_y,
240 const MenuPicture picture,
241 const PictureColor* const rows_colors )
242{
243 const PaletteTransformed& palette= *rendering_context_.palette_transformed;
244 uint32_t* const dst_pixels= rendering_context_.window_surface_data;
245 const int dst_row_pixels= rendering_context_.row_pixels;
246
247 const Picture& pic= menu_pictures_[ static_cast<size_t>(picture) ] ;
248
249 const int picture_height= pic.size[1] / MenuParams::menu_pictures_shifts_count;
250 const int row_count= int( pic.size[1] / ( MenuParams::menu_picture_row_height * MenuParams::menu_pictures_shifts_count ) );
251
252 for( int row= 0; row < row_count; row++ )
253 {
254 const unsigned char* const src= pic.data.data() + int(pic.size[0]) * picture_height * int(rows_colors[row]);
255
256 for( int y= row * int(MenuParams::menu_picture_row_height); y < (row+1) * int(MenuParams::menu_picture_row_height); y++ )
257 {
258 for( int x= 0; x < int(pic.size[0]); x++ )
259 {
260 const unsigned char color_index= src[ x + y * int(pic.size[0]) ];
261 if( color_index == 0 )
262 continue;
263 const uint32_t color= palette[ color_index ];
264
265 for( int sy= 0; sy < int(menu_scale_); sy++ )
266 {
267 const int dst_y= start_y + y * int(menu_scale_) + sy;
268 PC_ASSERT( dst_y >= 0 && dst_y < int(rendering_context_.viewport_size.Height()) );
269
270 for( int sx= 0; sx < int(menu_scale_); sx++ )
271 {
272 const int dst_x= start_x + x * int(menu_scale_) + sx;
273 PC_ASSERT( dst_x >= 0 && dst_x < int(rendering_context_.viewport_size.Width()) );
274 dst_pixels[ dst_x + dst_y * dst_row_pixels ]= color;
275 }
276 }
277 }
278 }
279 }
280}
281
282void MenuDrawerSoft::DrawConsoleBackground( const float console_pos )
283{

Callers

nothing calls this directly

Calls 2

HeightMethod · 0.80
WidthMethod · 0.80

Tested by

no test coverage detected