GAL: fix grid origin and grid rendering in flipped view mode

This commit is contained in:
Tomasz Włostowski 2016-12-08 22:55:06 +01:00 committed by Maciej Suminski
parent 90a39582b5
commit daf103d7e4
3 changed files with 20 additions and 6 deletions

View File

@ -122,7 +122,6 @@ void GAL::ComputeWorldScreenMatrix()
screenWorldMatrix = worldScreenMatrix.Inverse();
}
void GAL::DrawGrid()
{
if( !gridVisibility )
@ -153,11 +152,19 @@ void GAL::DrawGrid()
int gridEndY = KiROUND( worldEndPoint.y / gridSize.y );
// 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;
gridEndX += std::abs( gridOrigin.x / gridSize.x ) + 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 dirY = gridEndY >= gridStartY ? 1 : -1;

View File

@ -880,11 +880,18 @@ void OPENGL_GAL::DrawGrid()
int gridEndY = KiROUND( worldEndPoint.y / gridSize.y );
// 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;
gridEndX += std::abs( gridOrigin.x / gridSize.x ) + 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 dirY = gridStartY >= gridEndY ? -1 : 1;

View File

@ -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
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 )
{