Removed BeginLayer and EndLayer functions. Resolved Cairo layers drawing problem in a different way.

This commit is contained in:
Maciej Suminski 2013-04-24 09:48:34 +02:00
parent bb3f3d063f
commit 10dd5023e2
5 changed files with 19 additions and 46 deletions

View File

@ -178,6 +178,8 @@ void CAIRO_GAL::BeginDrawing() throw( int )
lineWidth = 0;
isDeleteSavedPixels = true;
cairo_push_group( cairoImage );
}
@ -186,6 +188,9 @@ void CAIRO_GAL::EndDrawing()
// Force remaining objects to be drawn
Flush();
cairo_pop_group_to_source( cairoImage );
cairo_paint_with_alpha( cairoImage, fillColor.a );
// This code was taken from the wxCairo example - it's not the most efficient one
// Here is a good place for optimizations
@ -521,6 +526,19 @@ void CAIRO_GAL::ClearScreen()
}
void CAIRO_GAL::SetLayerDepth( double aLayerDepth )
{
super::SetLayerDepth( aLayerDepth );
storePath();
cairo_pop_group_to_source( cairoImage );
cairo_paint_with_alpha( cairoImage, fillColor.a );
cairo_push_group( cairoImage );
}
void CAIRO_GAL::Transform( MATRIX3x3D aTransformation )
{
cairo_matrix_t cairoTransformation;
@ -617,21 +635,6 @@ void CAIRO_GAL::Restore()
}
void CAIRO_GAL::BeginLayer()
{
cairo_push_group( cairoImage );
}
void CAIRO_GAL::EndLayer()
{
storePath();
cairo_pop_group_to_source( cairoImage );
cairo_paint_with_alpha( cairoImage, fillColor.a );
}
int CAIRO_GAL::BeginGroup()
{
// If the grouping is started: the actual path is stored in the group, when

View File

@ -1288,15 +1288,6 @@ void OPENGL_GAL::Restore()
}
void OPENGL_GAL::BeginLayer()
{
}
void OPENGL_GAL::EndLayer()
{
}
// TODO Error handling
int OPENGL_GAL::BeginGroup()
{

View File

@ -95,12 +95,6 @@ public:
/// @copydoc GAL::EndDrawing()
virtual void EndDrawing();
/// @copydoc GAL::BeginLayer()
virtual void BeginLayer();
/// @copydoc GAL::EndLayer()
virtual void EndLayer();
/// @copydoc GAL::DrawLine()
virtual void DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
@ -178,10 +172,7 @@ public:
double GetLineWidth();
/// @copydoc GAL::SetLayerDepth()
virtual void SetLayerDepth( double aLayerDepth )
{
super::SetLayerDepth( aLayerDepth );
}
virtual void SetLayerDepth( double aLayerDepth );
// --------------
// Transformation

View File

@ -95,12 +95,6 @@ public:
/// @brief End the drawing, needs to be called for every new frame.
virtual void EndDrawing() = 0;
/// @brief Begin the layer drawing, needs to be called for every new layer.
virtual void BeginLayer() = 0;
/// @brief Finish the layer drawing, needs to be called for every new layer.
virtual void EndLayer() = 0;
/**
* @brief Draw a line.
*

View File

@ -102,12 +102,6 @@ public:
/// @copydoc GAL::EndDrawing()
virtual void EndDrawing();
/// @copydoc GAL::BeginLayer()
virtual void BeginLayer();
/// @copydoc GAL::EndLayer()
virtual void EndLayer();
/// @copydoc GAL::DrawLine()
virtual void DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );