| 298 | |
| 299 | |
| 300 | void Widget::drawChild(Widget* child, const DrawArgs& args, int layer) { |
| 301 | DrawArgs childArgs = args; |
| 302 | // Intersect child clip box with self |
| 303 | childArgs.clipBox = childArgs.clipBox.intersect(child->box); |
| 304 | // Offset clip box by child pos |
| 305 | childArgs.clipBox.pos = childArgs.clipBox.pos.minus(child->box.pos); |
| 306 | |
| 307 | nvgSave(args.vg); |
| 308 | nvgTranslate(args.vg, child->box.pos.x, child->box.pos.y); |
| 309 | |
| 310 | if (layer == 0) { |
| 311 | child->draw(childArgs); |
| 312 | #pragma GCC diagnostic push |
| 313 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 314 | // Call deprecated draw function, which does nothing by default |
| 315 | child->draw(args.vg); |
| 316 | #pragma GCC diagnostic pop |
| 317 | } |
| 318 | else { |
| 319 | child->drawLayer(childArgs, layer); |
| 320 | } |
| 321 | |
| 322 | nvgRestore(args.vg); |
| 323 | } |
| 324 | |
| 325 | |
| 326 | } // namespace widget |