Commit d27ea789 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Moved background color settings from GAL to RENDER_SETTINGS. Added...

Moved background color settings from GAL to RENDER_SETTINGS. Added RENDER_SETTINGS::TranslateColor() to convert between EDA_COLOR_T and COLOR4D.
parent 2cba91f9
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
/*
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 *
 * Copyright (C) 2013 CERN
 * Copyright (C) 2013-2014 CERN
 * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
 * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
 *
 *
 * This program is free software; you can redistribute it and/or
 * This program is free software; you can redistribute it and/or
@@ -124,7 +124,7 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )


        m_view->UpdateItems();
        m_view->UpdateItems();
        m_gal->BeginDrawing();
        m_gal->BeginDrawing();
        m_gal->ClearScreen();
        m_gal->ClearScreen( m_painter->GetSettings()->GetBackgroundColor() );


        if( m_view->IsDirty() )
        if( m_view->IsDirty() )
        {
        {
@@ -228,7 +228,6 @@ void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )


    wxSize size = GetClientSize();
    wxSize size = GetClientSize();
    m_gal->ResizeScreen( size.GetX(), size.GetY() );
    m_gal->ResizeScreen( size.GetX(), size.GetY() );
    m_gal->SetBackgroundColor( KIGFX::COLOR4D( 0.0, 0.0, 0.0, 1.0 ) );


    if( m_painter )
    if( m_painter )
        m_painter->SetGAL( m_gal );
        m_painter->SetGAL( m_gal );
+4 −4
Original line number Original line Diff line number Diff line
@@ -315,10 +315,10 @@ void CAIRO_GAL::Flush()
}
}




void CAIRO_GAL::ClearScreen()
void CAIRO_GAL::ClearScreen( const COLOR4D& aColor )
{
{
    cairo_set_source_rgb( currentContext,
    backgroundColor = aColor;
                          backgroundColor.r, backgroundColor.g, backgroundColor.b );
    cairo_set_source_rgb( currentContext, aColor.r, aColor.g, aColor.b );
    cairo_rectangle( currentContext, 0.0, 0.0, screenSize.x, screenSize.y );
    cairo_rectangle( currentContext, 0.0, 0.0, screenSize.x, screenSize.y );
    cairo_fill( currentContext );
    cairo_fill( currentContext );
}
}
@@ -973,7 +973,7 @@ void CAIRO_GAL::initSurface()
    cairo_set_antialias( context, CAIRO_ANTIALIAS_SUBPIXEL );
    cairo_set_antialias( context, CAIRO_ANTIALIAS_SUBPIXEL );


    // Clear the screen
    // Clear the screen
    ClearScreen();
    ClearScreen( backgroundColor );


    // Compute the world <-> screen transformations
    // Compute the world <-> screen transformations
    ComputeWorldScreenMatrix();
    ComputeWorldScreenMatrix();
+2 −2
Original line number Original line Diff line number Diff line
@@ -589,10 +589,10 @@ void OPENGL_GAL::Flush()
}
}




void OPENGL_GAL::ClearScreen()
void OPENGL_GAL::ClearScreen( const COLOR4D& aColor )
{
{
    // Clear screen
    // Clear screen
    glClearColor( backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a );
    glClearColor( aColor.r, aColor.g, aColor.b, aColor.a );
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
}


+1 −1
Original line number Original line Diff line number Diff line
/*
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 *
 * Copyright (C) 2013 CERN
 * Copyright (C) 2013-2014 CERN
 * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
 * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
 *
 *
 * This program is free software; you can redistribute it and/or
 * This program is free software; you can redistribute it and/or
+3 −2
Original line number Original line Diff line number Diff line
@@ -135,7 +135,7 @@ public:
    virtual void Flush();
    virtual void Flush();


    /// @copydoc GAL::ClearScreen()
    /// @copydoc GAL::ClearScreen()
    virtual void ClearScreen();
    virtual void ClearScreen( const COLOR4D& aColor );


    // -----------------
    // -----------------
    // Attribute setting
    // Attribute setting
@@ -333,6 +333,7 @@ private:
    unsigned int*       bitmapBufferBackup;     ///< Backup storage of the cairo image
    unsigned int*       bitmapBufferBackup;     ///< Backup storage of the cairo image
    int                 stride;                 ///< Stride value for Cairo
    int                 stride;                 ///< Stride value for Cairo
    bool                isInitialized;          ///< Are Cairo image & surface ready to use
    bool                isInitialized;          ///< Are Cairo image & surface ready to use
    COLOR4D             backgroundColor;        ///< Background color


    // Methods
    // Methods
    void storePath();                           ///< Store the actual path
    void storePath();                           ///< Store the actual path
Loading