mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Fixing QHD
This commit is contained in:
parent
69e851e87a
commit
b7f62fd938
3 changed files with 12 additions and 17 deletions
|
|
@ -112,8 +112,9 @@ inline Upp::Rect MakeRect(const CGRect& r, int dpi) {
|
|||
}
|
||||
|
||||
inline CGRect CGRectDPI(const Upp::Rect& r) {
|
||||
double sc = GetDPIUnScaleRatio();
|
||||
if(Upp::IsUHDMode())
|
||||
return CGRectMake(0.5 * r.left, 0.5 * r.top, 0.5 * r.GetWidth(), 0.5 * r.GetHeight());
|
||||
return CGRectMake(sc * r.left, sc * r.top, sc * r.GetWidth(), sc * r.GetHeight());
|
||||
else
|
||||
return CGRectMake(r.left, r.top, r.GetWidth(), r.GetHeight());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,15 +278,17 @@ enum {
|
|||
};
|
||||
|
||||
void SetDPIScale(int scale);
|
||||
int GetDPIScale();
|
||||
double GetDPIScaleRatio();
|
||||
void SyncDPIScale();
|
||||
|
||||
inline int DPI(int a) { extern int DPIScaleGlobal_; return (DPIScaleGlobal_ * a) >> 1; }
|
||||
inline double DPI(double a) { extern double DPIScaleGlobalF_; return DPIScaleGlobalF_ * a; }
|
||||
inline int GetDPIScale() { extern int DPIScaleGlobal_; return DPIScaleGlobal_; }
|
||||
inline double GetDPIScaleRatio() { extern double DPIScaleGlobalF_; return DPIScaleGlobalF_; }
|
||||
inline double GetDPIUnScaleRatio() { extern double IDPIScaleGlobalF_; return IDPIScaleGlobalF_; }
|
||||
|
||||
inline Size DPI(int cx, int cy) { return Size(DPI(cx), DPI(cy)); }
|
||||
inline Size DPI(Size sz) { return DPI(sz.cx, sz.cy); }
|
||||
inline int DPI(int a) { return (GetDPIScale() * a) >> 1; }
|
||||
inline double DPI(double a) { return GetDPIScaleRatio() * a; }
|
||||
|
||||
inline Size DPI(int cx, int cy) { return Size(DPI(cx), DPI(cy)); }
|
||||
inline Size DPI(Size sz) { return DPI(sz.cx, sz.cy); }
|
||||
|
||||
int ImlFlagsToDPIScale(int imlflags);
|
||||
int DPIScaleToImlFlags(int dpiscale);
|
||||
|
|
|
|||
|
|
@ -160,22 +160,14 @@ Image Downscale6x(const Image& src)
|
|||
|
||||
int DPIScaleGlobal_;
|
||||
double DPIScaleGlobalF_;
|
||||
double IDPIScaleGlobalF_;
|
||||
|
||||
void SetDPIScale(int scale)
|
||||
{
|
||||
Iml::ResetAll();
|
||||
DPIScaleGlobal_ = scale;
|
||||
DPIScaleGlobalF_ = 0.5 * scale;
|
||||
}
|
||||
|
||||
int GetDPIScale()
|
||||
{
|
||||
return DPIScaleGlobal_;
|
||||
}
|
||||
|
||||
double GetDPIScaleRatio()
|
||||
{
|
||||
return DPIScaleGlobalF_;
|
||||
IDPIScaleGlobalF_ = 1 / DPIScaleGlobalF_;
|
||||
}
|
||||
|
||||
void SyncDPIScale()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue