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

Method internalRepaintIdle

hi_scripting/scripting/api/ScriptingApiContent.cpp:4350–4404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4348
4349
4350bool ScriptingApi::Content::ScriptPanel::internalRepaintIdle(bool forceRepaint, Result& r)
4351{
4352 jassert_locked_script_thread(dynamic_cast<Processor*>(getScriptProcessor())->getMainController());
4353
4354 uint64_t lastId = 0;
4355
4356#if PERFETTO
4357 lastId = flowManager.flushAllButLastOne("paint callback", getName());
4358#endif
4359
4360 const bool parentHasMovedOn = !isChildPanel && !parent->hasComponent(this);
4361
4362 if (parentHasMovedOn || !parent->asyncFunctionsAllowed())
4363 {
4364 return true;
4365 }
4366
4367 HiseJavascriptEngine* engine = dynamic_cast<JavascriptProcessor*>(getScriptProcessor())->getScriptEngine();
4368
4369 if (engine == nullptr)
4370 return true;
4371
4372 auto imageBounds = getBoundsForImage();
4373
4374 int canvasWidth = imageBounds.getWidth();
4375 int canvasHeight = imageBounds.getHeight();
4376
4377 if ((!forceRepaint && !isShowing()) || canvasWidth <= 0 || canvasHeight <= 0)
4378 {
4379 return true;
4380 }
4381
4382 var thisObject(this);
4383 var arguments = var(graphics.get());
4384 var::NativeFunctionArgs args(thisObject, &arguments, 1);
4385
4386
4387 Result::ok();
4388
4389 if (!engine->isInitialising())
4390 {
4391 engine->maximumExecutionTime = HiseJavascriptEngine::getDefaultTimeOut();
4392 }
4393
4394 engine->callExternalFunction(paintRoutine, args, &r);
4395
4396 if (r.failed())
4397 {
4398 debugError(dynamic_cast<Processor*>(getScriptProcessor()), r.getErrorMessage());
4399 }
4400
4401 graphics->getDrawHandler().flush(lastId);
4402
4403 return true;
4404}
4405
4406void ScriptingApi::Content::ScriptPanel::setLoadingCallback(var loadingCallback)
4407{

Callers 1

internalRepaintMethod · 0.80

Calls 15

varFunction · 0.85
getDefaultTimeOutFunction · 0.85
hasComponentMethod · 0.80
asyncFunctionsAllowedMethod · 0.80
getScriptEngineMethod · 0.80
callExternalFunctionMethod · 0.80
getNameFunction · 0.50
getMainControllerMethod · 0.45
flushAllButLastOneMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected