mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-22 01:25:10 -07:00
[Client] Show horizontal art for plane and siege cards in the profile banner (#7118) (#7250)
Some checks are pending
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
Build Desktop / Configure (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Fedora 43 (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 26 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Docker / Servatrice (arm) (push) Waiting to run
Build Docker / Servatrice (x86) (push) Waiting to run
Build Docker / Publish multi-platform Servatrice image (push) Blocked by required conditions
Some checks are pending
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
Build Desktop / Configure (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Fedora 43 (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 26 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Docker / Servatrice (arm) (push) Waiting to run
Build Docker / Servatrice (x86) (push) Waiting to run
Build Docker / Publish multi-platform Servatrice image (push) Blocked by required conditions
Use the landscape orientation flag to rotate sideways-layout card art upright before cropping, so planes/sieges show their horizontal art as the server profile banner card instead of a rotated full card. - Curve cropCardArt around the card's landscapeOrientation flag with landscape-specific art margins (mirrors CardInfoPictureWidget) - Add shared CardArtUtils::rotateSidewaysLayoutArt helper and apply it to the playmat (game render and settings preview) and card info widget, replacing three duplicate 90-degree rotation blocks Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
8d30ac54f0
commit
b01e107908
9 changed files with 71 additions and 18 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "user_card_art_provider.h"
|
||||
|
||||
#include "../../../card_picture_loader/card_picture_loader.h"
|
||||
#include "../../cards/card_art_utils.h"
|
||||
|
||||
#include <QPointer>
|
||||
#include <libcockatrice/card/database/card_database_manager.h>
|
||||
|
|
@ -52,16 +53,25 @@ void UserCardArtProvider::requestCardArt(const QString &userName, const QString
|
|||
processQueue();
|
||||
}
|
||||
|
||||
QPixmap UserCardArtProvider::cropCardArt(const QPixmap &fullRes)
|
||||
QPixmap UserCardArtProvider::cropCardArt(const QPixmap &fullRes, const ExactCard &card)
|
||||
{
|
||||
const QSize sz = fullRes.size();
|
||||
QPixmap source = fullRes;
|
||||
|
||||
// Sideways-layout cards (plane, siege/battle, split) store their landscape
|
||||
// artwork rotated 90° inside a portrait frame. Rotate it upright first so
|
||||
// the crop below lands on the horizontal art, mirroring the way
|
||||
// CardInfoPictureWidget displays these cards.
|
||||
const bool landscape = card.getInfo().getUiAttributes().landscapeOrientation;
|
||||
source = CardArtUtils::rotateSidewaysLayoutArt(source, card);
|
||||
|
||||
const QSize sz = source.size();
|
||||
const int marginX = sz.width() * 0.07;
|
||||
const int topMargin = sz.height() * 0.11;
|
||||
const int bottomMargin = sz.height() * 0.45;
|
||||
const int topMargin = landscape ? sz.height() * 0.05 : sz.height() * 0.11;
|
||||
const int bottomMargin = landscape ? sz.height() * 0.42 : sz.height() * 0.45;
|
||||
|
||||
const QRect foilRect(marginX, topMargin, sz.width() - 2 * marginX, sz.height() - topMargin - bottomMargin);
|
||||
const QRect artRect(marginX, topMargin, sz.width() - 2 * marginX, sz.height() - topMargin - bottomMargin);
|
||||
|
||||
return fullRes.copy(foilRect.intersected(fullRes.rect()));
|
||||
return source.copy(artRect.intersected(source.rect()));
|
||||
}
|
||||
|
||||
void UserCardArtProvider::insertIntoCache(const QString &key, const QPixmap &pixmap)
|
||||
|
|
@ -111,7 +121,7 @@ void UserCardArtProvider::processQueue()
|
|||
|
||||
// Synchronous hit (already loaded/on disk)
|
||||
if (!fullRes.isNull()) {
|
||||
insertIntoCache(key, cropCardArt(fullRes));
|
||||
insertIntoCache(key, cropCardArt(fullRes, card));
|
||||
pending.remove(key);
|
||||
|
||||
emit cardArtUpdated(userName);
|
||||
|
|
@ -135,7 +145,7 @@ void UserCardArtProvider::processQueue()
|
|||
CardPictureLoader::getPixmap(fullRes, card, QSize(745, 1040));
|
||||
|
||||
if (!fullRes.isNull()) {
|
||||
self->insertIntoCache(key, self->cropCardArt(fullRes));
|
||||
self->insertIntoCache(key, self->cropCardArt(fullRes, card));
|
||||
}
|
||||
|
||||
self->pending.remove(key);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include <QPixmap>
|
||||
#include <QQueue>
|
||||
#include <QSet>
|
||||
#include <libcockatrice/card/printing/exact_card.h>
|
||||
|
||||
class UserCardArtProvider : public QObject
|
||||
{
|
||||
|
|
@ -16,7 +17,7 @@ public:
|
|||
|
||||
void requestCardArt(const QString &userName, const QString &cardName, const QString &providerId);
|
||||
const QMap<QString, QPixmap> &cache() const;
|
||||
static QPixmap cropCardArt(const QPixmap &fullRes);
|
||||
static QPixmap cropCardArt(const QPixmap &fullRes, const ExactCard &card);
|
||||
|
||||
signals:
|
||||
void cardArtUpdated(const QString &userName);
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ void UserCardArtSettingsDialog::reloadPreview()
|
|||
return;
|
||||
}
|
||||
|
||||
currentPixmap = UserCardArtProvider::cropCardArt(fullRes);
|
||||
currentPixmap = UserCardArtProvider::cropCardArt(fullRes, card);
|
||||
preview->setPixmap(currentPixmap);
|
||||
preview->setParams(currentParams);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue