Commit 190ed585 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Code refactoring.

parent 790a1f85
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ unsigned int CAIRO_COMPOSITOR::GetBuffer()
{
    // Pixel storage
    BitmapPtr bitmap( new unsigned int[m_bufferSize] );

    memset( bitmap.get(), 0x00, m_bufferSize * sizeof(int) );

    // Create the Cairo surface
@@ -105,6 +106,7 @@ void CAIRO_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
        m_current = aBufferHandle - 1;
        *m_currentContext = m_buffers[m_current].context;
    }

#ifdef __WXDEBUG__
    else
        wxLogDebug( wxT( "Tried to use a not existing buffer" ) );
@@ -141,6 +143,7 @@ void CAIRO_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
        // Restore the transformation matrix
        cairo_set_matrix( m_mainContext, &m_matrix );
    }

#ifdef __WXDEBUG__
    else
        wxLogDebug( wxT( "Tried to use a not existing buffer" ) );
+271 −303

File changed.

Preview size limit exceeded, changes collapsed.

+29 −2
Original line number Diff line number Diff line
@@ -63,6 +63,33 @@ GAL::~GAL()
}


void GAL::ComputeWorldScreenMatrix()
{
    ComputeWorldScale();

    worldScreenMatrix.SetIdentity();

    MATRIX3x3D translation;
    translation.SetIdentity();
    translation.SetTranslation( 0.5 * screenSize );

    MATRIX3x3D scale;
    scale.SetIdentity();
    scale.SetScale( VECTOR2D( worldScale, worldScale ) );

    MATRIX3x3D flip;
    flip.SetIdentity();
    flip.SetScale( VECTOR2D( 1.0, 1.0 ) );

    MATRIX3x3D lookat;
    lookat.SetIdentity();
    lookat.SetTranslation( -lookAtPoint );

    worldScreenMatrix = translation * flip * scale * lookat * worldScreenMatrix;
}



void GAL::DrawGrid()
{
    if( !gridVisibility )
@@ -136,7 +163,7 @@ void GAL::DrawGrid()
            if( ( j % gridTick == 0 && gridScreenSizeCoarse > gridDrawThreshold )
                || gridScreenSizeDense > gridDrawThreshold )
            {
                DrawGridLine( VECTOR2D( gridStartX * gridSize.x, j * gridSize.y ),
                drawGridLine( VECTOR2D( gridStartX * gridSize.x, j * gridSize.y ),
                              VECTOR2D( gridEndX * gridSize.x,   j * gridSize.y ) );
            }
        }
@@ -155,7 +182,7 @@ void GAL::DrawGrid()
            if( ( i % gridTick == 0 && gridScreenSizeCoarse > gridDrawThreshold )
                || gridScreenSizeDense > gridDrawThreshold )
            {
                DrawGridLine( VECTOR2D( i * gridSize.x, gridStartY * gridSize.y ),
                drawGridLine( VECTOR2D( i * gridSize.x, gridStartY * gridSize.y ),
                              VECTOR2D( i * gridSize.x, gridEndY * gridSize.y ) );
            }
        }
+3 −1
Original line number Diff line number Diff line
@@ -229,9 +229,11 @@ void OPENGL_COMPOSITOR::clean()
    {
        glDeleteTextures( 1, &it->textureTarget );
    }

    m_buffers.clear();

    m_initialized = false;
}


GLuint OPENGL_COMPOSITOR::m_currentFbo = 0;
+429 −542

File changed.

Preview size limit exceeded, changes collapsed.

Loading