Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
56 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ set(CMAKE_AUTOMOC ON) | |
|
||
set(SRCS | ||
AboutDialog.cpp | ||
DPI.cpp | ||
Host.cpp | ||
InDevelopmentWarning.cpp | ||
Main.cpp | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2017 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#include "DolphinQt2/DPI.h" | ||
|
||
#include <QPaintDevice> | ||
#include <QSize> | ||
|
||
double DPI::GetScale(const QPaintDevice* device) | ||
{ | ||
return (static_cast<double>(device->logicalDpiX()) + static_cast<double>(device->logicalDpiY())) / | ||
2 / 100; | ||
} | ||
|
||
QPixmap DPI::GetScaledPixmap(const QPaintDevice* device, const QString& path) | ||
{ | ||
const auto scale = GetScale(device); | ||
QPixmap pixmap(path); | ||
return pixmap.scaled(pixmap.size() * scale, Qt::KeepAspectRatio, Qt::SmoothTransformation); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2017 Dolphin Emulator Project | ||
// Licensed under GPLv2+ | ||
// Refer to the license.txt file included. | ||
|
||
#pragma once | ||
|
||
#include <QPixmap> | ||
#include <QString> | ||
|
||
class QPaintDevice; | ||
|
||
namespace DPI | ||
{ | ||
double GetScale(const QPaintDevice* device); | ||
QPixmap GetScaledPixmap(const QPaintDevice* device, const QString& path); | ||
} |
This file contains 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
This file contains 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
This file contains 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