- for (int y = 0; y < geom.button_size; ++y, src += w - geom.button_size)
- for (int x = 0; x < geom.button_size; ++x, ++dest, ++src)
+ int xd = s->size().width();
+ int yd = s->size().height();
+ for (int y = 0; y < yd; ++y, src += w - xd)
+ for (int x = 0; x < xd; ++x, ++dest, ++src)