| 395 | } |
| 396 | |
| 397 | void 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 | |
| 430 | void AnimScript::frame(quint64 timestamp){ |
| 431 | if(!initialized || stopped) |
nothing calls this directly
no test coverage detected