Created
April 27, 2015 20:51
-
-
Save sejr/61cd8731c63a9de577f5 to your computer and use it in GitHub Desktop.
Segmentation Fault
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void OsdManager::SetText(int region, QString text) | |
| { | |
| QFont font; | |
| if (resolution == 'C') | |
| font = QFont("Arial", 12); | |
| else | |
| font = QFont("Arial", 16); | |
| QFontMetrics fm(font); | |
| int pixelsWide = fm.width(text); | |
| int pixelsHigh = fm.height(); | |
| QImage regionOverlay(pixelsWide, pixelsHigh, QImage::Format_RGB32); | |
| QRect regionRect(0, 0, pixelsWide, pixelsHigh); | |
| regionOverlay.fill(Qt::gray); | |
| QPoint destination; | |
| switch(region) { | |
| case 1: | |
| destination = QPoint(((width/2)-(pixelsWide/2)), 10); | |
| break; | |
| case 2: | |
| destination = QPoint(10, (height/10)); | |
| break; | |
| case 3: | |
| destination = QPoint(10, (2*(height/10))); | |
| break; | |
| case 4: | |
| destination = QPoint(10, (9*(height/10))); | |
| break; | |
| default: | |
| destination = QPoint(0,0); // This should never happen. | |
| } | |
| overlay.begin(®ionOverlay); | |
| overlay.setPen(QPen(QColor(Qt::white))); | |
| overlay.setFont(font); | |
| overlay.drawText(regionRect, Qt::AlignLeft, text); | |
| overlay.end(); | |
| overlay.begin(&display); | |
| overlay.drawImage(destination, regionOverlay); | |
| overlay.end(); | |
| std::string str; | |
| str.append(reinterpret_cast<const char*>(display.bits())); | |
| Logger::PrintDebug(AnsiColor::Blue,"Bits: %s", str); | |
| display.save("/home/intern/MEGAsync/OSDOverlaySimulation/Output/sampleOutput.bmp"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment