This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/doric/plugin/DoricShaderPlugin.cpp

29 lines
902 B
C++
Raw Normal View History

2021-02-04 16:59:58 +08:00
#include <QDebug>
#include "../shader/DoricRootNode.h"
#include "DoricShaderPlugin.h"
2021-02-04 16:59:58 +08:00
void DoricShaderPlugin::render(QJSValue jsValue, QString callbackId) {
2021-02-09 10:38:27 +08:00
getContext()->getDriver()->asyncCall(
[this, jsValue] {
try {
QString viewId = jsValue.property("id").toString();
DoricRootNode *rootNode = getContext()->getRootNode();
if (rootNode->getId().isEmpty() &&
jsValue.property("type").toString() == "Root") {
rootNode->setId(viewId);
rootNode->blend(jsValue.property("props"));
} else {
DoricViewNode *viewNode = getContext()->targetViewNode(viewId);
if (viewNode != nullptr) {
viewNode->blend(jsValue.property("props"));
}
}
} catch (...) {
qCritical() << "render exception";
}
2021-02-09 10:38:27 +08:00
},
DoricThreadMode::UI);
2021-02-04 16:59:58 +08:00
}