static void image_insert_tile_row(image& target, int32_t x, int32_t y, uint32_t width, uint32_t height, const image& other, uint32_t offx, uint32_t offy) { if (offx + width <= other.width) { target.insert_sub(x, y, other, offx, offy, width, height); return; } if (offx != 0) { target.insert_sub(x, y, other, offx, offy, other.width-offx, height); x += other.width-offx; width -= other.width-offx; } uint32_t xx = 0; if (width >= other.width) { for (xx = 0; xx < width-other.width; xx += other.width) { target.insert_sub(x+xx, y, other, 0, offy, other.width, height); } } if (xx < width) { target.insert_sub(x+xx, y, other, 0, offy, width-xx, height); } }
//this one requires height <= other.height static void image_insert_tile_row(image& target, int32_t x, int32_t y, uint32_t width, uint32_t height, const image& other) { uint32_t xx = 0; if (width >= other.width) { for (xx = 0; xx < width-other.width; xx += other.width) { target.insert_sub(x+xx, y, other, 0, 0, other.width, height); } } if (xx < width) { target.insert_sub(x+xx, y, other, 0, 0, width-xx, height); } }