* Given a username, return a pixmap of the cached skin (if it exists), QPixmap() otherwise */
| 29 | * Given a username, return a pixmap of the cached skin (if it exists), QPixmap() otherwise |
| 30 | */ |
| 31 | QPixmap getFaceFromCache(QString username, int height, int width) |
| 32 | { |
| 33 | QFile fskin(APPLICATION->metacache()->resolveEntry("skins", username + ".png")->getFullPath()); |
| 34 | |
| 35 | if (fskin.exists()) |
| 36 | { |
| 37 | QPixmap skinTexture(fskin.fileName()); |
| 38 | if(!skinTexture.isNull()) |
| 39 | { |
| 40 | QPixmap skin = QPixmap(8, 8); |
| 41 | QPainter painter(&skin); |
| 42 | painter.drawPixmap(0, 0, skinTexture.copy(8, 8, 8, 8)); |
| 43 | painter.drawPixmap(0, 0, skinTexture.copy(40, 8, 8, 8)); |
| 44 | return skin.scaled(height, width, Qt::KeepAspectRatio); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | return QPixmap(); |
| 49 | } |
| 50 | } |
nothing calls this directly
no test coverage detected