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;
64 return pRenderView->getViewportRect();
66 return pRenderView->getViewPortRect();
82 const fsF32 retinaScale =
static_cast<fsF32>(pRenderView->getRetinaFactor());
83 if (retinaScale > 0.0f)
85 pScaleX = retinaScale;
86 pScaleY = retinaScale;
90 const auto visibleSize = pRenderView->getVisibleSize();
92 const auto frameSize = pRenderView->getWindowSize();
94 const auto frameSize = pRenderView->getFrameSize();
96 if (visibleSize.width > 0.0f && frameSize.width > 0.0f)
98 const fsF32 frameScaleX =
static_cast<fsF32>(frameSize.width / visibleSize.width);
99 if (frameScaleX > pScaleX)
101 pScaleX = frameScaleX;
104 if (visibleSize.height > 0.0f && frameSize.height > 0.0f)
106 const fsF32 frameScaleY =
static_cast<fsF32>(frameSize.height / visibleSize.height);
107 if (frameScaleY > pScaleY)
109 pScaleY = frameScaleY;
114 if (pRenderView->getRenderScale() > 0.0f)
116 pScaleX = pRenderView->getRenderScale();
117 pScaleY = pRenderView->getRenderScale();
float fsF32
Definition fsBaseTypes.h:28
Definition fsNAxmolRenderView.h:21
void pixelScaleGet(fsTRenderView *const pRenderView, fsF32 &pScaleX, fsF32 &pScaleY)
Definition fsNAxmolRenderView.h:70
ax::RenderView fsTRenderView
Definition fsNAxmolRenderView.h:25
const ax::Rect & viewportRectGet(fsTRenderView *const pRenderView)
Definition fsNAxmolRenderView.h:61
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