mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: GetFitSize double version
git-svn-id: svn://ultimatepp.org/upp/trunk@7987 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
3fdb544517
commit
42eb0f3997
3 changed files with 14 additions and 1 deletions
|
|
@ -101,6 +101,16 @@ Size GetFitSize(Size sz, int cx, int cy)
|
|||
return iscale(sz, cx, sz.cx);
|
||||
}
|
||||
|
||||
Sizef GetFitSize(Sizef sz, double cx, double cy)
|
||||
{
|
||||
if(cx <= 0 || cy <= 0 || sz.cx <= 0 || sz.cy <= 0)
|
||||
return Size(0, 0);
|
||||
if(cx * sz.cy >= cy * sz.cx) // too high
|
||||
return sz * cy / sz.cy;
|
||||
else
|
||||
return sz * cx / sz.cx;
|
||||
}
|
||||
|
||||
double SquareDist(const Pointf& p1, const Pointf& p2)
|
||||
{
|
||||
return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);
|
||||
|
|
|
|||
|
|
@ -722,6 +722,9 @@ Size GetRatioSize(Size stdsize, int cx, int cy);
|
|||
Size GetFitSize(Size objsize, int cx, int cy);
|
||||
inline Size GetFitSize(Size objsize, Size intosize) { return GetFitSize(objsize, intosize.cx, intosize.cy); }
|
||||
|
||||
Sizef GetFitSize(Sizef sz, double cx, double cy);
|
||||
inline Sizef GetFitSize(Sizef objsize, Sizef intosize) { return GetFitSize(objsize, intosize.cx, intosize.cy); }
|
||||
|
||||
Pointf Mid(const Pointf& a, const Pointf& b);
|
||||
Pointf Orthogonal(const Pointf& p);
|
||||
double Squared(const Pointf& p);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define _CtrlLib_icpp_init_stub
|
||||
#include "CtrlCore/init"
|
||||
#include "PdfDraw/init"
|
||||
#define BLITZ_INDEX__ F2a95805f3896075b0a556396aabaf515
|
||||
#define BLITZ_INDEX__ Fa588a2a7bb40a3ed36760f6c2bef5026
|
||||
#include "CtrlLib.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue