GAL: fix grid origin and grid rendering in flipped view mode
This commit is contained in:
parent
90a39582b5
commit
daf103d7e4
|
@ -122,7 +122,6 @@ void GAL::ComputeWorldScreenMatrix()
|
||||||
screenWorldMatrix = worldScreenMatrix.Inverse();
|
screenWorldMatrix = worldScreenMatrix.Inverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GAL::DrawGrid()
|
void GAL::DrawGrid()
|
||||||
{
|
{
|
||||||
if( !gridVisibility )
|
if( !gridVisibility )
|
||||||
|
@ -153,11 +152,19 @@ void GAL::DrawGrid()
|
||||||
int gridEndY = KiROUND( worldEndPoint.y / gridSize.y );
|
int gridEndY = KiROUND( worldEndPoint.y / gridSize.y );
|
||||||
|
|
||||||
// Correct the index, else some lines are not correctly painted
|
// Correct the index, else some lines are not correctly painted
|
||||||
gridStartX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
|
|
||||||
gridStartY -= std::abs( gridOrigin.y / gridSize.y ) + 1;
|
gridStartY -= std::abs( gridOrigin.y / gridSize.y ) + 1;
|
||||||
gridEndX += std::abs( gridOrigin.x / gridSize.x ) + 1;
|
|
||||||
gridEndY += std::abs( gridOrigin.y / gridSize.y ) + 1;
|
gridEndY += std::abs( gridOrigin.y / gridSize.y ) + 1;
|
||||||
|
|
||||||
|
if ( gridStartX <= gridEndX )
|
||||||
|
{
|
||||||
|
gridStartX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
|
||||||
|
gridEndX += std::abs( gridOrigin.x / gridSize.x ) + 1;
|
||||||
|
} else {
|
||||||
|
gridStartX += std::abs( gridOrigin.x / gridSize.x ) + 1;
|
||||||
|
gridEndX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
int dirX = gridEndX >= gridStartX ? 1 : -1;
|
int dirX = gridEndX >= gridStartX ? 1 : -1;
|
||||||
int dirY = gridEndY >= gridStartY ? 1 : -1;
|
int dirY = gridEndY >= gridStartY ? 1 : -1;
|
||||||
|
|
||||||
|
|
|
@ -880,11 +880,18 @@ void OPENGL_GAL::DrawGrid()
|
||||||
int gridEndY = KiROUND( worldEndPoint.y / gridSize.y );
|
int gridEndY = KiROUND( worldEndPoint.y / gridSize.y );
|
||||||
|
|
||||||
// Correct the index, else some lines are not correctly painted
|
// Correct the index, else some lines are not correctly painted
|
||||||
gridStartX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
|
|
||||||
gridStartY -= std::abs( gridOrigin.y / gridSize.y ) + 1;
|
gridStartY -= std::abs( gridOrigin.y / gridSize.y ) + 1;
|
||||||
gridEndX += std::abs( gridOrigin.x / gridSize.x ) + 1;
|
|
||||||
gridEndY += std::abs( gridOrigin.y / gridSize.y ) + 1;
|
gridEndY += std::abs( gridOrigin.y / gridSize.y ) + 1;
|
||||||
|
|
||||||
|
if ( gridStartX <= gridEndX )
|
||||||
|
{
|
||||||
|
gridStartX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
|
||||||
|
gridEndX += std::abs( gridOrigin.x / gridSize.x ) + 1;
|
||||||
|
} else {
|
||||||
|
gridStartX += std::abs( gridOrigin.x / gridSize.x ) + 1;
|
||||||
|
gridEndX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
int dirX = gridStartX >= gridEndX ? -1 : 1;
|
int dirX = gridStartX >= gridEndX ? -1 : 1;
|
||||||
int dirY = gridStartY >= gridEndY ? -1 : 1;
|
int dirY = gridStartY >= gridEndY ? -1 : 1;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ void ORIGIN_VIEWITEM::ViewDraw( int, VIEW* aView ) const
|
||||||
|
|
||||||
// Draw a circle around the marker's centre point if the style demands it
|
// Draw a circle around the marker's centre point if the style demands it
|
||||||
if( ( m_style == CIRCLE_CROSS ) || ( m_style == CIRCLE_DOT ) || ( m_style == CIRCLE_X ) )
|
if( ( m_style == CIRCLE_CROSS ) || ( m_style == CIRCLE_DOT ) || ( m_style == CIRCLE_X ) )
|
||||||
gal->DrawCircle( m_position, scaledSize.x );
|
gal->DrawCircle( m_position, fabs( scaledSize.x ) );
|
||||||
|
|
||||||
switch( m_style )
|
switch( m_style )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue