MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / draw

Method draw

plugins/Cardinal/src/AIDA-X.cpp:809–828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

807 }
808
809 void draw(const DrawArgs& args) override
810 {
811 if (image.get() == nullptr)
812 image = APP->window->loadImage(asset::plugin(pluginInstance, "res/aida-x-logo.png"));
813
814 if (Image* const img = image.get())
815 {
816 const float pixelRatio = hasModule ? APP->window->pixelRatio : 1.0f;
817 const float boxscale = std::min(box.size.x / 111, box.size.y / 25);
818 const float imgHeight = (25 / pixelRatio) * boxscale;
819 nvgBeginPath(args.vg);
820 nvgRect(args.vg, 0, 0, box.size.x, box.size.y);
821 nvgFillPaint(args.vg, nvgImagePattern(args.vg,
822 0,
823 (box.size.y / pixelRatio) * 0.5f - imgHeight * 0.5f,
824 box.size.x / pixelRatio,
825 imgHeight, 0, img->handle, 1.0f));
826 nvgFill(args.vg);
827 }
828 }
829};
830
831struct AidaKnob : app::SvgKnob {

Callers

nothing calls this directly

Calls 8

nvgBeginPathFunction · 0.85
nvgRectFunction · 0.85
nvgFillPaintFunction · 0.85
nvgImagePatternFunction · 0.85
nvgFillFunction · 0.85
pluginFunction · 0.50
getMethod · 0.45
loadImageMethod · 0.45

Tested by

no test coverage detected