MCPcopy Create free account
hub / github.com/VCVRack/Rack / drawChild

Method drawChild

src/widget/Widget.cpp:300–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298
299
300void 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

Callers

nothing calls this directly

Calls 4

intersectMethod · 0.80
minusMethod · 0.80
drawMethod · 0.45
drawLayerMethod · 0.45

Tested by

no test coverage detected