Commit 16a28348 authored by Maciej Suminski's avatar Maciej Suminski

Added const(..)& in GAL methods' parameters and change iterators to constant iterators.

parent 520be6f6
...@@ -293,7 +293,7 @@ void CAIRO_GAL::RestoreScreen() ...@@ -293,7 +293,7 @@ void CAIRO_GAL::RestoreScreen()
} }
void CAIRO_GAL::DrawLine( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) void CAIRO_GAL::DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
{ {
cairo_move_to( cairoImage, aStartPoint.x, aStartPoint.y ); cairo_move_to( cairoImage, aStartPoint.x, aStartPoint.y );
cairo_line_to( cairoImage, aEndPoint.x, aEndPoint.y ); cairo_line_to( cairoImage, aEndPoint.x, aEndPoint.y );
...@@ -341,7 +341,7 @@ void CAIRO_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPo ...@@ -341,7 +341,7 @@ void CAIRO_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPo
} }
void CAIRO_GAL::DrawCircle( VECTOR2D aCenterPoint, double aRadius ) void CAIRO_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
{ {
// A circle is drawn using an arc // A circle is drawn using an arc
cairo_new_sub_path( cairoImage ); cairo_new_sub_path( cairoImage );
...@@ -351,7 +351,7 @@ void CAIRO_GAL::DrawCircle( VECTOR2D aCenterPoint, double aRadius ) ...@@ -351,7 +351,7 @@ void CAIRO_GAL::DrawCircle( VECTOR2D aCenterPoint, double aRadius )
} }
void CAIRO_GAL::DrawArc( VECTOR2D aCenterPoint, double aRadius, double aStartAngle, void CAIRO_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle,
double aEndAngle ) double aEndAngle )
{ {
SWAP( aStartAngle, >, aEndAngle ); SWAP( aStartAngle, >, aEndAngle );
...@@ -368,7 +368,7 @@ void CAIRO_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) ...@@ -368,7 +368,7 @@ void CAIRO_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList )
bool isFirstPoint = true; bool isFirstPoint = true;
// Iterate over the point list and draw the segments // Iterate over the point list and draw the segments
for( std::deque<VECTOR2D>::iterator it = aPointList.begin(); it != aPointList.end(); ++it ) for( std::deque<VECTOR2D>::const_iterator it = aPointList.begin(); it != aPointList.end(); ++it )
{ {
if( isFirstPoint ) if( isFirstPoint )
{ {
...@@ -410,7 +410,7 @@ void CAIRO_GAL::DrawPolygon( const std::deque<VECTOR2D>& aPointList ) ...@@ -410,7 +410,7 @@ void CAIRO_GAL::DrawPolygon( const std::deque<VECTOR2D>& aPointList )
} }
void CAIRO_GAL::DrawRectangle( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) void CAIRO_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
{ {
// Calculate the diagonal points // Calculate the diagonal points
VECTOR2D diagonalPointA( aEndPoint.x, aStartPoint.y ); VECTOR2D diagonalPointA( aEndPoint.x, aStartPoint.y );
...@@ -427,8 +427,8 @@ void CAIRO_GAL::DrawRectangle( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) ...@@ -427,8 +427,8 @@ void CAIRO_GAL::DrawRectangle( VECTOR2D aStartPoint, VECTOR2D aEndPoint )
} }
void CAIRO_GAL::DrawCurve( VECTOR2D aStartPoint, VECTOR2D aControlPointA, void CAIRO_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControlPointA,
VECTOR2D aControlPointB, VECTOR2D aEndPoint ) const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint )
{ {
cairo_move_to( cairoImage, aStartPoint.x, aStartPoint.y ); cairo_move_to( cairoImage, aStartPoint.x, aStartPoint.y );
cairo_curve_to( cairoImage, aControlPointA.x, aControlPointA.y, aControlPointB.x, cairo_curve_to( cairoImage, aControlPointA.x, aControlPointA.y, aControlPointB.x,
...@@ -606,7 +606,7 @@ void CAIRO_GAL::Rotate( double aAngle ) ...@@ -606,7 +606,7 @@ void CAIRO_GAL::Rotate( double aAngle )
} }
void CAIRO_GAL::Translate( VECTOR2D aTranslation ) void CAIRO_GAL::Translate( const VECTOR2D& aTranslation )
{ {
storePath(); storePath();
...@@ -623,7 +623,7 @@ void CAIRO_GAL::Translate( VECTOR2D aTranslation ) ...@@ -623,7 +623,7 @@ void CAIRO_GAL::Translate( VECTOR2D aTranslation )
} }
void CAIRO_GAL::Scale( VECTOR2D aScale ) void CAIRO_GAL::Scale( const VECTOR2D& aScale )
{ {
storePath(); storePath();
...@@ -905,9 +905,8 @@ void CAIRO_GAL::initCursor( int aCursorSize ) ...@@ -905,9 +905,8 @@ void CAIRO_GAL::initCursor( int aCursorSize )
} }
VECTOR2D CAIRO_GAL::ComputeCursorToWorld( VECTOR2D aCursorPosition ) VECTOR2D CAIRO_GAL::ComputeCursorToWorld( const VECTOR2D& aCursorPosition )
{ {
MATRIX3x3D inverseMatrix = worldScreenMatrix.Inverse(); MATRIX3x3D inverseMatrix = worldScreenMatrix.Inverse();
VECTOR2D cursorPositionWorld = inverseMatrix * aCursorPosition; VECTOR2D cursorPositionWorld = inverseMatrix * aCursorPosition;
...@@ -953,7 +952,7 @@ void CAIRO_GAL::DrawCursor( VECTOR2D aCursorPosition ) ...@@ -953,7 +952,7 @@ void CAIRO_GAL::DrawCursor( VECTOR2D aCursorPosition )
} }
void CAIRO_GAL::DrawGridLine( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) void CAIRO_GAL::DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
{ {
cairo_move_to( cairoImage, aStartPoint.x, aStartPoint.y ); cairo_move_to( cairoImage, aStartPoint.x, aStartPoint.y );
cairo_line_to( cairoImage, aEndPoint.x, aEndPoint.y ); cairo_line_to( cairoImage, aEndPoint.x, aEndPoint.y );
......
...@@ -439,7 +439,7 @@ inline void OPENGL_GAL::selectShader( int aIndex ) ...@@ -439,7 +439,7 @@ inline void OPENGL_GAL::selectShader( int aIndex )
} }
void OPENGL_GAL::drawRoundedSegment( VECTOR2D aStartPoint, VECTOR2D aEndPoint, void OPENGL_GAL::drawRoundedSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint,
double aWidth, bool aStroke, bool aGlBegin ) double aWidth, bool aStroke, bool aGlBegin )
{ {
VECTOR2D l = (aEndPoint - aStartPoint); VECTOR2D l = (aEndPoint - aStartPoint);
...@@ -493,7 +493,7 @@ void OPENGL_GAL::drawRoundedSegment( VECTOR2D aStartPoint, VECTOR2D aEndPoint, ...@@ -493,7 +493,7 @@ void OPENGL_GAL::drawRoundedSegment( VECTOR2D aStartPoint, VECTOR2D aEndPoint,
} }
inline void OPENGL_GAL::drawLineQuad( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) inline void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
{ {
VECTOR2D startEndVector = aEndPoint - aStartPoint; VECTOR2D startEndVector = aEndPoint - aStartPoint;
double lineLength = startEndVector.EuclideanNorm(); double lineLength = startEndVector.EuclideanNorm();
...@@ -564,10 +564,11 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP ...@@ -564,10 +564,11 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP
} }
inline void OPENGL_GAL::drawLineCap( VECTOR2D aStartPoint, VECTOR2D aEndPoint, double aDepthOffset ) inline void OPENGL_GAL::drawLineCap( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint,
double aDepthOffset )
{ {
VECTOR2D startEndVector = aEndPoint - aStartPoint; VECTOR2D startEndVector = aEndPoint - aStartPoint;
double lineLength = startEndVector.EuclideanNorm(); // double lineLength = startEndVector.EuclideanNorm();
double lineAngle = atan2( startEndVector.y, startEndVector.x ); double lineAngle = atan2( startEndVector.y, startEndVector.x );
switch( lineCap ) switch( lineCap )
...@@ -582,16 +583,16 @@ inline void OPENGL_GAL::drawLineCap( VECTOR2D aStartPoint, VECTOR2D aEndPoint, d ...@@ -582,16 +583,16 @@ inline void OPENGL_GAL::drawLineCap( VECTOR2D aStartPoint, VECTOR2D aEndPoint, d
break; break;
case LINE_CAP_SQUARED: case LINE_CAP_SQUARED:
VECTOR2D offset; // FIXME? VECTOR2D offset;
offset = startEndVector * ( lineWidth / lineLength / 2.0 ); // offset = startEndVector * ( lineWidth / lineLength / 2.0 );
aStartPoint = aStartPoint - offset; // aStartPoint = aStartPoint - offset;
aEndPoint = aEndPoint + offset; // aEndPoint = aEndPoint + offset;
break; break;
} }
} }
void OPENGL_GAL::DrawLine( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) void OPENGL_GAL::DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
{ {
if( isUseShader ) if( isUseShader )
{ {
...@@ -816,7 +817,7 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) ...@@ -816,7 +817,7 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList )
} }
void OPENGL_GAL::DrawRectangle( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
{ {
// Compute the diagonal points of the rectangle // Compute the diagonal points of the rectangle
VECTOR2D diagonalPointA( aEndPoint.x, aStartPoint.y ); VECTOR2D diagonalPointA( aEndPoint.x, aStartPoint.y );
...@@ -890,7 +891,7 @@ void OPENGL_GAL::DrawRectangle( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) ...@@ -890,7 +891,7 @@ void OPENGL_GAL::DrawRectangle( VECTOR2D aStartPoint, VECTOR2D aEndPoint )
} }
void OPENGL_GAL::DrawCircle( VECTOR2D aCenterPoint, double aRadius ) void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius )
{ {
// We need a minimum radius, else simply don't draw the circle // We need a minimum radius, else simply don't draw the circle
if( aRadius <= 0.0 ) if( aRadius <= 0.0 )
...@@ -959,7 +960,7 @@ void OPENGL_GAL::DrawCircle( VECTOR2D aCenterPoint, double aRadius ) ...@@ -959,7 +960,7 @@ void OPENGL_GAL::DrawCircle( VECTOR2D aCenterPoint, double aRadius )
// This method is used for round line caps // This method is used for round line caps
void OPENGL_GAL::drawSemiCircle( VECTOR2D aCenterPoint, double aRadius, double aAngle, void OPENGL_GAL::drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle,
double aDepthOffset ) double aDepthOffset )
{ {
// XXX Depth seems to be buggy // XXX Depth seems to be buggy
...@@ -975,7 +976,7 @@ void OPENGL_GAL::drawSemiCircle( VECTOR2D aCenterPoint, double aRadius, double a ...@@ -975,7 +976,7 @@ void OPENGL_GAL::drawSemiCircle( VECTOR2D aCenterPoint, double aRadius, double a
// FIXME Optimize // FIXME Optimize
void OPENGL_GAL::DrawArc( VECTOR2D aCenterPoint, double aRadius, double aStartAngle, void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle,
double aEndAngle ) double aEndAngle )
{ {
if( aRadius <= 0 ) if( aRadius <= 0 )
...@@ -1158,8 +1159,8 @@ void OPENGL_GAL::DrawPolygon( const std::deque<VECTOR2D>& aPointList ) ...@@ -1158,8 +1159,8 @@ void OPENGL_GAL::DrawPolygon( const std::deque<VECTOR2D>& aPointList )
} }
void OPENGL_GAL::DrawCurve( VECTOR2D aStartPoint, VECTOR2D aControlPointA, void OPENGL_GAL::DrawCurve( const VECTOR2D& aStartPoint, const VECTOR2D& aControlPointA,
VECTOR2D aControlPointB, VECTOR2D aEndPoint ) const VECTOR2D& aControlPointB, const VECTOR2D& aEndPoint )
{ {
// FIXME The drawing quality needs to be improved // FIXME The drawing quality needs to be improved
// FIXME Perhaps choose a quad/triangle strip instead? // FIXME Perhaps choose a quad/triangle strip instead?
...@@ -1266,13 +1267,13 @@ void OPENGL_GAL::Rotate( double aAngle ) ...@@ -1266,13 +1267,13 @@ void OPENGL_GAL::Rotate( double aAngle )
} }
void OPENGL_GAL::Translate( VECTOR2D aVector ) void OPENGL_GAL::Translate( const VECTOR2D& aVector )
{ {
glTranslated( aVector.x, aVector.y, 0 ); glTranslated( aVector.x, aVector.y, 0 );
} }
void OPENGL_GAL::Scale( VECTOR2D aScale ) void OPENGL_GAL::Scale( const VECTOR2D& aScale )
{ {
// TODO: Check method // TODO: Check method
glScaled( aScale.x, aScale.y, 0 ); glScaled( aScale.x, aScale.y, 0 );
...@@ -1487,11 +1488,12 @@ void OPENGL_GAL::initCursor( int aCursorSize ) ...@@ -1487,11 +1488,12 @@ void OPENGL_GAL::initCursor( int aCursorSize )
} }
VECTOR2D OPENGL_GAL::ComputeCursorToWorld( VECTOR2D aCursorPosition ) VECTOR2D OPENGL_GAL::ComputeCursorToWorld( const VECTOR2D& aCursorPosition )
{ {
aCursorPosition.y = screenSize.y - aCursorPosition.y; VECTOR2D cursorPosition = aCursorPosition;
cursorPosition.y = screenSize.y - aCursorPosition.y;
MATRIX3x3D inverseMatrix = worldScreenMatrix.Inverse(); MATRIX3x3D inverseMatrix = worldScreenMatrix.Inverse();
VECTOR2D cursorPositionWorld = inverseMatrix * aCursorPosition; VECTOR2D cursorPositionWorld = inverseMatrix * cursorPosition;
return cursorPositionWorld; return cursorPositionWorld;
} }
...@@ -1552,7 +1554,7 @@ void OPENGL_GAL::DrawCursor( VECTOR2D aCursorPosition ) ...@@ -1552,7 +1554,7 @@ void OPENGL_GAL::DrawCursor( VECTOR2D aCursorPosition )
} }
void OPENGL_GAL::DrawGridLine( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) void OPENGL_GAL::DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
{ {
// We check, if we got a horizontal or a vertical grid line and compute the offset // We check, if we got a horizontal or a vertical grid line and compute the offset
VECTOR2D perpendicularVector; VECTOR2D perpendicularVector;
......
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
virtual void EndDrawing(); virtual void EndDrawing();
/// @copydoc GAL::DrawLine() /// @copydoc GAL::DrawLine()
virtual void DrawLine( VECTOR2D aStartPoint, VECTOR2D aEndPoint ); virtual void DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
/// @copydoc GAL::DrawSegment() /// @copydoc GAL::DrawSegment()
virtual void DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth ); virtual void DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth );
...@@ -105,21 +105,21 @@ public: ...@@ -105,21 +105,21 @@ public:
virtual void DrawPolyline( std::deque<VECTOR2D>& aPointList ); virtual void DrawPolyline( std::deque<VECTOR2D>& aPointList );
/// @copydoc GAL::DrawCircle() /// @copydoc GAL::DrawCircle()
virtual void DrawCircle( VECTOR2D aCenterPoint, double aRadius ); virtual void DrawCircle( const VECTOR2D& aCenterPoint, double aRadius );
/// @copydoc GAL::DrawArc() /// @copydoc GAL::DrawArc()
virtual void virtual void
DrawArc( VECTOR2D aCenterPoint, double aRadius, double aStartAngle, double aEndAngle ); DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle, double aEndAngle );
/// @copydoc GAL::DrawRectangle() /// @copydoc GAL::DrawRectangle()
virtual void DrawRectangle( VECTOR2D aStartPoint, VECTOR2D aEndPoint ); virtual void DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
/// @copydoc GAL::DrawPolygon() /// @copydoc GAL::DrawPolygon()
virtual void DrawPolygon( const std::deque<VECTOR2D>& aPointList ); virtual void DrawPolygon( const std::deque<VECTOR2D>& aPointList );
/// @copydoc GAL::DrawCurve() /// @copydoc GAL::DrawCurve()
virtual void DrawCurve( VECTOR2D startPoint, VECTOR2D controlPointA, VECTOR2D controlPointB, virtual void DrawCurve( const VECTOR2D& startPoint, const VECTOR2D& controlPointA,
VECTOR2D endPoint ); const VECTOR2D& controlPointB, const VECTOR2D& endPoint );
// -------------- // --------------
// Screen methods // Screen methods
...@@ -188,10 +188,10 @@ public: ...@@ -188,10 +188,10 @@ public:
virtual void Rotate( double aAngle ); virtual void Rotate( double aAngle );
/// @copydoc GAL::Translate() /// @copydoc GAL::Translate()
virtual void Translate( VECTOR2D aTranslation ); virtual void Translate( const VECTOR2D& aTranslation );
/// @copydoc GAL::Scale() /// @copydoc GAL::Scale()
virtual void Scale( VECTOR2D aScale ); virtual void Scale( const VECTOR2D& aScale );
/// @copydoc GAL::Save() /// @copydoc GAL::Save()
virtual void Save(); virtual void Save();
...@@ -235,7 +235,7 @@ public: ...@@ -235,7 +235,7 @@ public:
void SetScreenDPI( double aScreenDPI ); void SetScreenDPI( double aScreenDPI );
/// @copydoc GAL::SetLookAtPoint() /// @copydoc GAL::SetLookAtPoint()
void SetLookAtPoint( VECTOR2D aPoint ); void SetLookAtPoint( const VECTOR2D& aPoint );
/// @copydoc GAL::GetLookAtPoint() /// @copydoc GAL::GetLookAtPoint()
VECTOR2D GetLookAtPoint(); VECTOR2D GetLookAtPoint();
...@@ -257,7 +257,7 @@ public: ...@@ -257,7 +257,7 @@ public:
// ------- // -------
/// @copydoc GAL::ComputeCursorToWorld() /// @copydoc GAL::ComputeCursorToWorld()
virtual VECTOR2D ComputeCursorToWorld( VECTOR2D aCursorPosition ); virtual VECTOR2D ComputeCursorToWorld( const VECTOR2D& aCursorPosition );
/// @copydoc GAL::SetIsCursorEnabled() /// @copydoc GAL::SetIsCursorEnabled()
void SetIsCursorEnabled( bool aIsCursorEnabled ); void SetIsCursorEnabled( bool aIsCursorEnabled );
...@@ -290,7 +290,7 @@ public: ...@@ -290,7 +290,7 @@ public:
} }
protected: protected:
virtual void DrawGridLine(VECTOR2D aStartPoint, VECTOR2D aEndPoint); virtual void DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
private: private:
/// Super class definition /// Super class definition
......
...@@ -105,7 +105,7 @@ public: ...@@ -105,7 +105,7 @@ public:
* @param aStartPoint is the start point of the line. * @param aStartPoint is the start point of the line.
* @param aEndPoint is the end point of the line. * @param aEndPoint is the end point of the line.
*/ */
virtual void DrawLine( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) = 0; virtual void DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ) = 0;
/** /**
* @brief Draw a rounded segment. * @brief Draw a rounded segment.
...@@ -131,7 +131,7 @@ public: ...@@ -131,7 +131,7 @@ public:
* @param aCenterPoint is the center point of the circle. * @param aCenterPoint is the center point of the circle.
* @param aRadius is the radius of the circle. * @param aRadius is the radius of the circle.
*/ */
virtual void DrawCircle( VECTOR2D aCenterPoint, double aRadius ) = 0; virtual void DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) = 0;
/** /**
* @brief Draw an arc. * @brief Draw an arc.
...@@ -142,7 +142,7 @@ public: ...@@ -142,7 +142,7 @@ public:
* @param aEndAngle is the end angle of the arc. * @param aEndAngle is the end angle of the arc.
*/ */
virtual void virtual void
DrawArc( VECTOR2D aCenterPoint, double aRadius, double aStartAngle, double aEndAngle ) = 0; DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle, double aEndAngle ) = 0;
/** /**
* @brief Draw a rectangle. * @brief Draw a rectangle.
...@@ -150,7 +150,7 @@ public: ...@@ -150,7 +150,7 @@ public:
* @param aStartPoint is the start point of the rectangle. * @param aStartPoint is the start point of the rectangle.
* @param aEndPoint is the end point of the rectangle. * @param aEndPoint is the end point of the rectangle.
*/ */
virtual void DrawRectangle( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) = 0; virtual void DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ) = 0;
/** /**
* @brief Draw a polygon. * @brief Draw a polygon.
...@@ -167,8 +167,8 @@ public: ...@@ -167,8 +167,8 @@ public:
* @param controlPointB is the second control point. * @param controlPointB is the second control point.
* @param endPoint is the end point of the spline. * @param endPoint is the end point of the spline.
*/ */
virtual void DrawCurve( VECTOR2D startPoint, VECTOR2D controlPointA, virtual void DrawCurve( const VECTOR2D& startPoint, const VECTOR2D& controlPointA,
VECTOR2D controlPointB, VECTOR2D endPoint ) = 0; const VECTOR2D& controlPointB, const VECTOR2D& endPoint ) = 0;
// -------------- // --------------
// Screen methods // Screen methods
...@@ -326,14 +326,14 @@ public: ...@@ -326,14 +326,14 @@ public:
* *
* @param aTranslation is the translation vector. * @param aTranslation is the translation vector.
*/ */
virtual void Translate( VECTOR2D aTranslation ) = 0; virtual void Translate( const VECTOR2D& aTranslation ) = 0;
/** /**
* @brief Scale the context. * @brief Scale the context.
* *
* @param aScale is the scale factor for the x- and y-axis. * @param aScale is the scale factor for the x- and y-axis.
*/ */
virtual void Scale( VECTOR2D aScale ) = 0; virtual void Scale( const VECTOR2D& aScale ) = 0;
/// @brief Save the context. /// @brief Save the context.
virtual void Save() = 0; virtual void Save() = 0;
...@@ -476,7 +476,7 @@ public: ...@@ -476,7 +476,7 @@ public:
* @param aDepthRange is the depth range where component x is the near clipping plane and y * @param aDepthRange is the depth range where component x is the near clipping plane and y
* is the far clipping plane. * is the far clipping plane.
*/ */
inline void SetDepthRange( VECTOR2D aDepthRange ) inline void SetDepthRange( const VECTOR2D& aDepthRange )
{ {
depthRange = aDepthRange; depthRange = aDepthRange;
} }
...@@ -617,7 +617,7 @@ public: ...@@ -617,7 +617,7 @@ public:
* @param aCursorPosition is the cursor position in screen coordinates. * @param aCursorPosition is the cursor position in screen coordinates.
* @return the cursor position in world coordinates. * @return the cursor position in world coordinates.
*/ */
virtual VECTOR2D ComputeCursorToWorld( VECTOR2D aCursorPosition ) = 0; virtual VECTOR2D ComputeCursorToWorld( const VECTOR2D& aCursorPosition ) = 0;
/** /**
* @brief Enable/Disable cursor. * @brief Enable/Disable cursor.
...@@ -720,7 +720,7 @@ protected: ...@@ -720,7 +720,7 @@ protected:
* @param aStartPoint is the start point of the line. * @param aStartPoint is the start point of the line.
* @param aEndPoint is the end point of the line. * @param aEndPoint is the end point of the line.
*/ */
virtual void DrawGridLine( VECTOR2D aStartPoint, VECTOR2D aEndPoint ) = 0; virtual void DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ) = 0;
}; };
} // namespace KiGfx } // namespace KiGfx
......
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
virtual void EndDrawing(); virtual void EndDrawing();
/// @copydoc GAL::DrawLine() /// @copydoc GAL::DrawLine()
virtual void DrawLine( VECTOR2D aStartPoint, VECTOR2D aEndPoint ); virtual void DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
/// @copydoc GAL::DrawSegment() /// @copydoc GAL::DrawSegment()
virtual void DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth ); virtual void DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth );
...@@ -112,21 +112,21 @@ public: ...@@ -112,21 +112,21 @@ public:
virtual void DrawPolyline( std::deque<VECTOR2D>& aPointList ); virtual void DrawPolyline( std::deque<VECTOR2D>& aPointList );
/// @copydoc GAL::DrawCircle() /// @copydoc GAL::DrawCircle()
virtual void DrawCircle( VECTOR2D aCenterPoint, double aRadius ); virtual void DrawCircle( const VECTOR2D& aCenterPoint, double aRadius );
/// @copydoc GAL::DrawArc() /// @copydoc GAL::DrawArc()
virtual void virtual void
DrawArc( VECTOR2D aCenterPoint, double aRadius, double aStartAngle, double aEndAngle ); DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle, double aEndAngle );
/// @copydoc GAL::DrawRectangle() /// @copydoc GAL::DrawRectangle()
virtual void DrawRectangle( VECTOR2D aStartPoint, VECTOR2D aEndPoint ); virtual void DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
/// @copydoc GAL::DrawPolygon() /// @copydoc GAL::DrawPolygon()
virtual void DrawPolygon( const std::deque<VECTOR2D>& aPointList ); virtual void DrawPolygon( const std::deque<VECTOR2D>& aPointList );
/// @copydoc GAL::DrawCurve() /// @copydoc GAL::DrawCurve()
virtual void DrawCurve( VECTOR2D startPoint, VECTOR2D controlPointA, VECTOR2D controlPointB, virtual void DrawCurve( const VECTOR2D& startPoint, const VECTOR2D& controlPointA,
VECTOR2D endPoint ); const VECTOR2D& controlPointB, const VECTOR2D& endPoint );
// -------------- // --------------
// Screen methods // Screen methods
...@@ -206,10 +206,10 @@ public: ...@@ -206,10 +206,10 @@ public:
virtual void Rotate( double aAngle ); virtual void Rotate( double aAngle );
/// @copydoc GAL::Translate() /// @copydoc GAL::Translate()
virtual void Translate( VECTOR2D aTranslation ); virtual void Translate( const VECTOR2D& aTranslation );
/// @copydoc GAL::Scale() /// @copydoc GAL::Scale()
virtual void Scale( VECTOR2D aScale ); virtual void Scale( const VECTOR2D& aScale );
/// @copydoc GAL::Save() /// @copydoc GAL::Save()
virtual void Save(); virtual void Save();
...@@ -253,7 +253,7 @@ public: ...@@ -253,7 +253,7 @@ public:
void SetScreenDPI( double aScreenDPI ); void SetScreenDPI( double aScreenDPI );
/// @copydoc GAL::SetLookAtPoint() /// @copydoc GAL::SetLookAtPoint()
void SetLookAtPoint( VECTOR2D aPoint ); void SetLookAtPoint( const VECTOR2D& aPoint );
/// @copydoc GAL::GetLookAtPoint() /// @copydoc GAL::GetLookAtPoint()
VECTOR2D GetLookAtPoint(); VECTOR2D GetLookAtPoint();
...@@ -275,7 +275,7 @@ public: ...@@ -275,7 +275,7 @@ public:
// ------- // -------
/// @copydoc GAL::ComputeCursorToWorld() /// @copydoc GAL::ComputeCursorToWorld()
virtual VECTOR2D ComputeCursorToWorld( VECTOR2D aCursorPosition ); virtual VECTOR2D ComputeCursorToWorld( const VECTOR2D& aCursorPosition );
/// @copydoc GAL::SetIsCursorEnabled() /// @copydoc GAL::SetIsCursorEnabled()
void SetIsCursorEnabled( bool aIsCursorEnabled ); void SetIsCursorEnabled( bool aIsCursorEnabled );
...@@ -313,7 +313,7 @@ public: ...@@ -313,7 +313,7 @@ public:
} }
protected: protected:
virtual void DrawGridLine( VECTOR2D aStartPoint, VECTOR2D aEndPoint ); virtual void DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
private: private:
/// Super class definition /// Super class definition
...@@ -384,7 +384,7 @@ private: ...@@ -384,7 +384,7 @@ private:
* @param ADepthOffset is the relative depth of the semi-circle. * @param ADepthOffset is the relative depth of the semi-circle.
* *
*/ */
void drawSemiCircle( VECTOR2D aCenterPoint, double aRadius, double aAngle, void drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle,
double aDepthOffset ); double aDepthOffset );
/// Compute the points of a unit circle. /// Compute the points of a unit circle.
...@@ -470,7 +470,7 @@ private: ...@@ -470,7 +470,7 @@ private:
* @param aStartPoint is the start point of the line. * @param aStartPoint is the start point of the line.
* @param aEndPoint is the end point of the line. * @param aEndPoint is the end point of the line.
*/ */
inline void drawLineQuad( VECTOR2D aStartPoint, VECTOR2D aEndPoint ); inline void drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
/** /**
* @brief Draw the line cap * @brief Draw the line cap
...@@ -479,12 +479,13 @@ private: ...@@ -479,12 +479,13 @@ private:
* @param aEndPoint is the end point of the line. * @param aEndPoint is the end point of the line.
* @param aDepthOffset is the relative depth of the line cap. * @param aDepthOffset is the relative depth of the line cap.
*/ */
inline void drawLineCap( VECTOR2D aStartPoint, VECTOR2D aEndPoint, double aDepthOffset ); inline void drawLineCap( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint,
double aDepthOffset );
inline void selectShader( int aIndex ); inline void selectShader( int aIndex );
/// @copydoc GAL::DrawRoundedSegment() /// @copydoc GAL::DrawRoundedSegment()
void drawRoundedSegment( VECTOR2D aStartPoint, VECTOR2D aEndPoint, double aWidth, void drawRoundedSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth,
bool aStroke = false, bool aGlBegin = false ); bool aStroke = false, bool aGlBegin = false );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment