| 1434 | } |
| 1435 | |
| 1436 | QImage splitViewWidget::getScreenshot(bool fullItem) |
| 1437 | { |
| 1438 | QImage::Format fmt = dynamic_cast<QImage *>(backingStore()->paintDevice())->format(); |
| 1439 | |
| 1440 | if (fullItem) |
| 1441 | { |
| 1442 | // Get the playlist item to draw |
| 1443 | auto item = playlist->getSelectedItems(); |
| 1444 | if (item[0] == nullptr) |
| 1445 | return QImage(); |
| 1446 | |
| 1447 | // Create an image buffer with the size of the item. |
| 1448 | QImage screenshot(item[0]->getSize(), fmt); |
| 1449 | QPainter painter(&screenshot); |
| 1450 | |
| 1451 | // Get the current frame to draw |
| 1452 | int frame = playback->getCurrentFrame(); |
| 1453 | |
| 1454 | // Translate the painter to the position where we want the item to be |
| 1455 | QPoint center = QRect(QPoint(0, 0), item[0]->getSize()).center(); |
| 1456 | painter.translate(center); |
| 1457 | |
| 1458 | // TODO: What if loading is still in progress? |
| 1459 | |
| 1460 | // Draw the item at position (0,0) |
| 1461 | item[0]->drawItem(&painter, frame, 1, showRawData()); |
| 1462 | |
| 1463 | // Do the inverse translation of the painter |
| 1464 | painter.resetTransform(); |
| 1465 | |
| 1466 | return screenshot; |
| 1467 | } |
| 1468 | else |
| 1469 | { |
| 1470 | QImage screenshot(size(), fmt); |
| 1471 | render(&screenshot); |
| 1472 | return screenshot; |
| 1473 | } |
| 1474 | } |
| 1475 | |
| 1476 | void splitViewWidget::playbackStarted(int nextFrameIdx) |
| 1477 | { |
no test coverage detected