Merge pull request #2195 from AsahiLinux/wayland-hidpi
Make HiDPI SVG rendering work on Wayland
This commit is contained in:
commit
1ca6b27afe
@ -192,7 +192,7 @@ CalamaresApplication::initBranding()
|
||||
::exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
new Calamares::Branding( brandingFile.absoluteFilePath(), this );
|
||||
new Calamares::Branding( brandingFile.absoluteFilePath(), this, devicePixelRatio() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -203,12 +203,13 @@ uploadServerFromMap( const QVariantMap& map )
|
||||
* documentation for details.
|
||||
*/
|
||||
|
||||
Branding::Branding( const QString& brandingFilePath, QObject* parent )
|
||||
Branding::Branding( const QString& brandingFilePath, QObject* parent, qreal devicePixelRatio )
|
||||
: QObject( parent )
|
||||
, m_descriptorPath( brandingFilePath )
|
||||
, m_slideshowAPI( 1 )
|
||||
, m_welcomeStyleCalamares( false )
|
||||
, m_welcomeExpandingLogo( true )
|
||||
, m_devicePixelRatio( devicePixelRatio )
|
||||
{
|
||||
cDebug() << "Using Calamares branding file at" << brandingFilePath;
|
||||
|
||||
@ -358,7 +359,8 @@ Branding::image( Branding::ImageEntry imageEntry, const QSize& size ) const
|
||||
const auto path = imagePath( imageEntry );
|
||||
if ( path.contains( '/' ) )
|
||||
{
|
||||
QPixmap pixmap = ImageRegistry::instance()->pixmap( path, size );
|
||||
QPixmap pixmap = ImageRegistry::instance()->pixmap( path, size * m_devicePixelRatio );
|
||||
pixmap.setDevicePixelRatio( m_devicePixelRatio );
|
||||
|
||||
Q_ASSERT( !pixmap.isNull() );
|
||||
return pixmap;
|
||||
|
@ -162,7 +162,7 @@ public:
|
||||
|
||||
static Branding* instance();
|
||||
|
||||
explicit Branding( const QString& brandingFilePath, QObject* parent = nullptr );
|
||||
explicit Branding( const QString& brandingFilePath, QObject* parent = nullptr, qreal devicePixelRatio = 1.0 );
|
||||
|
||||
/** @brief Complete path of the branding descriptor file. */
|
||||
QString descriptorPath() const { return m_descriptorPath; }
|
||||
@ -317,6 +317,8 @@ private:
|
||||
PanelFlavor m_navigationFlavor = PanelFlavor::Widget;
|
||||
PanelSide m_sidebarSide = PanelSide::Left;
|
||||
PanelSide m_navigationSide = PanelSide::Bottom;
|
||||
|
||||
qreal m_devicePixelRatio;
|
||||
};
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -24,7 +24,9 @@ void
|
||||
FixedAspectRatioLabel::setPixmap( const QPixmap& pixmap )
|
||||
{
|
||||
m_pixmap = pixmap;
|
||||
QLabel::setPixmap( pixmap.scaled( contentsRect().size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
||||
m_pixmap.setDevicePixelRatio( devicePixelRatio() );
|
||||
QLabel::setPixmap( m_pixmap.scaled(
|
||||
contentsRect().size() * m_pixmap.devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
||||
}
|
||||
|
||||
|
||||
@ -32,5 +34,6 @@ void
|
||||
FixedAspectRatioLabel::resizeEvent( QResizeEvent* event )
|
||||
{
|
||||
Q_UNUSED( event )
|
||||
QLabel::setPixmap( m_pixmap.scaled( contentsRect().size(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
||||
QLabel::setPixmap( m_pixmap.scaled(
|
||||
contentsRect().size() * m_pixmap.devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user