20#ifndef RHI_STATIC_MARGIN_H
21#define RHI_STATIC_MARGIN_H
59 if( aMargin == 0 || w <= 0.0f || h <= 0.0f )
62 const float sx = w / ( w + 2.0f * aMargin );
63 const float sy = h / ( h + 2.0f * aMargin );
66 for(
int col = 0; col < 4; ++col )
72 wide.
viewport[0] = w + 2.0f * aMargin;
73 wide.
viewport[1] = h + 2.0f * aMargin;
85 if( aMargin == 0 || w <= 0.0f || h <= 0.0f )
88 const float sx = w / ( w + 2.0f * aMargin );
89 const float sy = h / ( h + 2.0f * aMargin );
92 for(
int row = 0; row < 4; ++row )
98 wide.
viewport[0] = w + 2.0f * aMargin;
99 wide.
viewport[1] = h + 2.0f * aMargin;
110 for(
int ii = 0; ii < 16; ++ii )
112 if( ii == 12 || ii == 13 )
140 constexpr double tolerance = 0.02;
142 if(
std::abs( x - std::round( x ) ) > tolerance ||
std::abs( y - std::round( y ) ) > tolerance )
145 return RHI_VIEW_SHIFT{
static_cast<int>( std::lround( x ) ),
static_cast<int>( std::lround( y ) ) };
155 for(
int ii = 0; ii < 16; ++ii )
163 moved.invProjection[ii] = b;
166 return moved == aNow;
The Cairo implementation of the graphics abstraction layer.
bool RhiViewMovedOnly(const FRAME_UBO_DATA &aDrawn, const FRAME_UBO_DATA &aNow)
std::optional< RHI_VIEW_SHIFT > RhiViewShift(const FRAME_UBO_DATA &aDrawn, const FRAME_UBO_DATA &aNow)
FRAME_UBO_DATA RhiWidenFrame(const FRAME_UBO_DATA &aFrame, uint32_t aMargin)
bool RhiGridMovedOnly(const GRID_UBO_DATA &aDrawn, const GRID_UBO_DATA &aNow)
GRID_UBO_DATA RhiWidenGrid(const GRID_UBO_DATA &aGrid, uint32_t aMargin)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Per-frame uniform block matching FrameUBO in frame_ubo.glsl (std140).
float projection[16]
column-major for GLSL
Grid uniform block matching the GridUBO layout in grid.frag (std140).
How far the view has moved since the static target was drawn, in whole frame pixels.