MCPcopy Create free account
hub / github.com/ccMSC/ckb / readProcess

Method readProcess

src/ckb/animscript.cpp:397–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395}
396
397void AnimScript::readProcess(){
398 while(process->canReadLine()){
399 QByteArray line = process->readLine().trimmed();
400 if(!inFrame){
401 // Ignore anything not between "begin frame" and "end frame", except for "end run", which indicates that the program is done.
402 if(line == "begin frame")
403 inFrame = true;
404 else if(line == "end run"){
405 stopped = true;
406 return;
407 }
408 continue;
409 }
410 if(line.startsWith("argb ")){
411 // Add a color to the buffer
412 char keyName[31];
413 QRgb keyColor = 0;
414 if(sscanf(line, "argb %30s %x", keyName, &keyColor) != 2)
415 continue;
416 QRgb* inMap = _colorBuffer.colorForName(keyName);
417 if(!inMap)
418 continue;
419 *inMap = keyColor;
420 }
421 if(line == "end frame"){
422 // Frame is finished. Copy color buffer back to the atomic map
423 memcpy(_colors.colors(), _colorBuffer.colors(), sizeof(QRgb) * _colors.count());
424 inFrame = false;
425 readFrame = readAnyFrame = true;
426 }
427 }
428}
429
430void AnimScript::frame(quint64 timestamp){
431 if(!initialized || stopped)

Callers

nothing calls this directly

Calls 3

colorForNameMethod · 0.80
colorsMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected