9#ifndef fsNAxmolRenderViewhdr
10#define fsNAxmolRenderViewhdr
13 #include <platform/RenderViewCore.h>
15 #include <platform/RenderView.h>
42 if (pContainerW <= 0.0f || pContainerH <= 0.0f || pTargetAspect <= 0.0f)
47 const fsF32 containerAspect = pContainerW / pContainerH;
48 if (containerAspect < pTargetAspect)
50 rect.
h = pContainerW / pTargetAspect;
51 rect.
y = (pContainerH - rect.
h) / 2.0f;
53 else if (containerAspect > pTargetAspect)
55 rect.
w = pContainerH * pTargetAspect;
56 rect.
x = (pContainerW - rect.
w) / 2.0f;
68 const ax::Vec2& pViewPoint,
const fsF32 pDesignW,
71 if (!pRenderView || pDesignW <= 0.0f || pDesignH <= 0.0f)
76 const auto visibleSize = pRenderView->getVisibleSize();
77 const auto fit =
aspectFitRectGet(pDesignW / pDesignH, visibleSize.width, visibleSize.height);
78 if (fit.w <= 0.0f || fit.h <= 0.0f)
83 return ax::Vec2((pViewPoint.x - fit.x) / fit.w * pDesignW,
84 pDesignH - (pViewPoint.y - fit.y) / fit.h * pDesignH);
90 return pRenderView->getViewportRect();
92 return pRenderView->getViewPortRect();
108 const fsF32 retinaScale =
static_cast<fsF32>(pRenderView->getRetinaFactor());
109 if (retinaScale > 0.0f)
111 pScaleX = retinaScale;
112 pScaleY = retinaScale;
116 const auto visibleSize = pRenderView->getVisibleSize();
118 const auto frameSize = pRenderView->getWindowSize();
120 const auto frameSize = pRenderView->getFrameSize();
122 if (visibleSize.width > 0.0f && frameSize.width > 0.0f)
124 const fsF32 frameScaleX =
static_cast<fsF32>(frameSize.width / visibleSize.width);
125 if (frameScaleX > pScaleX)
127 pScaleX = frameScaleX;
130 if (visibleSize.height > 0.0f && frameSize.height > 0.0f)
132 const fsF32 frameScaleY =
static_cast<fsF32>(frameSize.height / visibleSize.height);
133 if (frameScaleY > pScaleY)
135 pScaleY = frameScaleY;
140 if (pRenderView->getRenderScale() > 0.0f)
142 pScaleX = pRenderView->getRenderScale();
143 pScaleY = pRenderView->getRenderScale();
float fsF32
Definition fsBaseTypes.h:28
Definition fsNAxmolRenderView.h:21
ax::Vec2 fixedAspectViewPointToDesignPointGet(fsTRenderView *const pRenderView, const ax::Vec2 &pViewPoint, const fsF32 pDesignW, const fsF32 pDesignH)
Definition fsNAxmolRenderView.h:67
void pixelScaleGet(fsTRenderView *const pRenderView, fsF32 &pScaleX, fsF32 &pScaleY)
Definition fsNAxmolRenderView.h:96
ax::RenderView fsTRenderView
Definition fsNAxmolRenderView.h:25
const ax::Rect & viewportRectGet(fsTRenderView *const pRenderView)
Definition fsNAxmolRenderView.h:87
fsSAspectFitRect aspectFitRectGet(const fsF32 pTargetAspect, const fsF32 pContainerW, const fsF32 pContainerH)
Definition fsNAxmolRenderView.h:37
Definition fsNAxmolRenderView.h:29
fsF32 w
Definition fsNAxmolRenderView.h:32
fsF32 y
Definition fsNAxmolRenderView.h:31
fsF32 h
Definition fsNAxmolRenderView.h:33
fsF32 x
Definition fsNAxmolRenderView.h:30