MCPcopy Create free account
hub / github.com/christophhart/HISE / callWithGraphics

Method callWithGraphics

hi_scripting/scripting/api/ScriptingGraphics.cpp:2593–2725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2591}
2592
2593bool ScriptingObjects::ScriptedLookAndFeel::callWithGraphics(Graphics& g_, const Identifier& functionname, var argsObject, Component* c)
2594{
2595#if PERFETTO
2596
2597 dispatch::StringBuilder n;
2598
2599 if(c != nullptr)
2600 n << c->getName() << ".";
2601
2602 n << functionname << "()";
2603
2604 TRACE_SCRIPTING(DYNAMIC_STRING_BUILDER(n));
2605
2606#endif
2607
2608 // If this hits, you need to add that id to the array above.
2609 jassert(getAllFunctionNames().contains(functionname));
2610
2611
2612 if (!lastResult.wasOk())
2613 return false;
2614
2615 auto f = functions.getProperty(functionname, {});
2616
2617 if (HiseJavascriptEngine::isJavascriptFunction(f))
2618 {
2619 ReferenceCountedObjectPtr<GraphicsObject> g;
2620
2621 for(auto& gr: graphics)
2622 {
2623 if(gr.c == c && gr.functionName == functionname)
2624 {
2625 g = gr.g;
2626 break;
2627 }
2628 }
2629
2630 if(g == nullptr)
2631 {
2632 GraphicsWithComponent gr;
2633 gr.g = new GraphicsObject(getScriptProcessor(), this);
2634 gr.c = c;
2635 gr.functionName = functionname;
2636 graphics.add(gr);
2637 g = gr.g;
2638 }
2639
2640 var args[2];
2641
2642 args[0] = var(g.get());
2643 args[1] = argsObject;
2644
2645 var thisObject(this);
2646
2647
2648
2649 {
2650 if (auto sl = SimpleReadWriteLock::ScopedTryReadLock(getScriptProcessor()->getMainController_()->getJavascriptThreadPool().getLookAndFeelRenderLock()))

Callers 15

drawAlertBoxMethod · 0.80
drawFilterDragHandleMethod · 0.80
drawFilterBackgroundMethod · 0.80
drawFilterPathMethod · 0.80
drawFilterGridLinesMethod · 0.80
drawOscilloscopePathMethod · 0.80
drawAnalyserGridMethod · 0.80
drawPopupMenuItemMethod · 0.80
drawToggleButtonMethod · 0.80

Calls 15

varFunction · 0.85
ScopedTryReadLockClass · 0.85
getMainController_Method · 0.80
getScriptEngineMethod · 0.80
callExternalFunctionMethod · 0.80
getNameMethod · 0.65
containsMethod · 0.45
wasOkMethod · 0.45
getPropertyMethod · 0.45
addMethod · 0.45
getMethod · 0.45
setPropertyMethod · 0.45

Tested by

no test coverage detected