58 int tile_width = m_tile_manager->getTileWidth();
59 int tile_height = m_tile_manager->getTileHeight();
60 int tile_offset_x =
x % tile_width;
61 int tile_offset_y =
y % tile_height;
64 if (tile_offset_x + width <= tile_width && tile_offset_y + height <= tile_height) {
69 assert(tile !=
nullptr);
72 auto image = tile->getImage();
73 return image->getChunk(tile_offset_x, tile_offset_y, width, height);
81 int tile_w = m_tile_manager->getTileWidth();
82 int tile_h = m_tile_manager->getTileHeight();
84 int tile_start_x =
x / tile_w * tile_w;
85 int tile_start_y =
y / tile_h * tile_h;
86 int tile_end_x = (
x + width - 1) / tile_w * tile_w;
87 int tile_end_y = (
y + height - 1) / tile_h * tile_h;
89 for (
int iy = tile_start_y; iy <= tile_end_y; iy += tile_h) {
90 for (
int ix = tile_start_x; ix <= tile_end_x; ix += tile_w) {
92 copyOverlappingPixels(*tile, data,
x,
y, width, height, tile_w, tile_h);