public void update_tile(int _tile_ind, utils.ETileViewType _view_type, tiles_data _tiles_data, Graphics _gfx, Image _img, data_sets_manager.EScreenDataType _scr_type) { #if DEF_TILE_DRAW_FAST Image block_img; #else ushort[] blocks_arr = null; byte[] CHR_data = null; // draw a block from CHR bank sprites if (_tiles_data != null) { blocks_arr = _tiles_data.blocks; CHR_data = _tiles_data.CHR_bank; } #endif //DEF_TILE_DRAW_FAST Image img; if (_img != null) { img = _img; } else { img = m_imagelist_tiles.Images[_tile_ind]; } Graphics gfx; if (_gfx != null) { gfx = _gfx; } else { gfx = Graphics.FromImage(img); } gfx.InterpolationMode = InterpolationMode.NearestNeighbor; gfx.PixelOffsetMode = PixelOffsetMode.None; #if DEF_TILE_DRAW_FAST for (int j = 0; j < utils.CONST_TILE_SIZE; j++) { block_img = m_imagelist_blocks.Images[_tiles_data.get_tile_block(_tile_ind, j)]; gfx.DrawImage(block_img, ((j % 2) << 5), ((j >> 1) << 5), block_img.Width, block_img.Height); } #else // draw a block from CHR bank sprites for (int j = 0; j < utils.CONST_TILE_SIZE; j++) { utils.update_block_gfx(_tiles_data.get_tile_block(_tile_ind, j), blocks_arr, CHR_data, gfx, utils.CONST_BLOCKS_IMG_SIZE >> 1, utils.CONST_BLOCKS_IMG_SIZE >> 1, ((j % 2) << 5), ((j >> 1) << 5)); } #endif //DEF_TILE_DRAW_FAST if (_scr_type == data_sets_manager.EScreenDataType.sdt_Tiles4x4) { if (_view_type == utils.ETileViewType.tvt_Number) // tile id { draw_tile_info(String.Format("{0:X2}", _tile_ind), gfx); } else if (_view_type == utils.ETileViewType.tvt_TilesUsage) // usage { draw_tile_info(String.Format("{0}", _tiles_data.get_tile_usage(( ushort )_tile_ind, _scr_type)), gfx); } } if (_img == null) { m_imagelist_tiles.Images[_tile_ind] = img; } if (_gfx == null) { gfx.Dispose(); } }