Commit c55ee4b7 authored by Mohammad Mahfuzur Rahman Mamun's avatar Mohammad Mahfuzur Rahman Mamun
Browse files

A last moment refactoring of the code ... some const & changes

parent dca4ee55
......@@ -210,7 +210,7 @@ class OKULAR_EXPORT NormalizedRect
/**
* Returns true if the point pt is located to the bottom of the rectangle
*/
bool isBottom(NormalizedPoint pt) const
bool isBottom(const NormalizedPoint& pt) const
{
return bottom < pt.y;
}
......@@ -218,7 +218,7 @@ class OKULAR_EXPORT NormalizedRect
/**
* Returns true if the point pt is located on the top of the rectangle
*/
bool isTop(NormalizedPoint pt) const
bool isTop(const NormalizedPoint& pt) const
{
return top > pt.y;
}
......@@ -226,7 +226,7 @@ class OKULAR_EXPORT NormalizedRect
/**
* Returns true if the point pt is located under the top of the rectangle
*/
bool isBottomOrLevel(NormalizedPoint pt) const
bool isBottomOrLevel(const NormalizedPoint& pt) const
{
return top < pt.y;
}
......@@ -234,7 +234,7 @@ class OKULAR_EXPORT NormalizedRect
/**
* Returns true if the point pt is located above the bottom of the rectangle
*/
bool isTopOrLevel(NormalizedPoint pt) const
bool isTopOrLevel(const NormalizedPoint& pt) const
{
return bottom > pt.y;
}
......@@ -242,7 +242,7 @@ class OKULAR_EXPORT NormalizedRect
/**
* Returns true if the point pt is located to the right of the left arm of rectangle
*/
bool isLeft(NormalizedPoint pt) const
bool isLeft(const NormalizedPoint& pt) const
{
return left < pt.x;
}
......@@ -250,7 +250,7 @@ class OKULAR_EXPORT NormalizedRect
/**
* Returns true if the point pt is located to the left of the right arm of rectangle
*/
bool isRight(NormalizedPoint pt) const
bool isRight(const NormalizedPoint& pt) const
{
return right > pt.x;
}
......
......@@ -220,7 +220,7 @@ public:
{
};
RegionText(TextList &list,QRect &area)
RegionText(const TextList &list,const QRect &area)
: m_region_text(list) ,m_area(area)
{
}
......@@ -236,12 +236,12 @@ public:
return m_area;
}
inline void setArea(QRect area)
inline void setArea(const QRect area)
{
m_area = area;
}
inline void setText(TextList text)
inline void setText(const TextList text)
{
m_region_text = text;
}
......@@ -1000,12 +1000,12 @@ bool compareTinyTextEntityY(TinyTextEntity* first, TinyTextEntity* second)
return firstArea.top() < secondArea.top();
}
bool compareRegionTextY(RegionText first, RegionText second)
bool compareRegionTextY(const RegionText& first, const RegionText& second)
{
return first.area().top() < second.area().top();
}
bool compareRegionTextX(RegionText first, RegionText second)
bool compareRegionTextX(const RegionText& first, const RegionText& second)
{
return first.area().left() < second.area().left();
}
......@@ -1052,7 +1052,7 @@ void TextPagePrivate::copyFrom(TextList &list)
* ---- -------- ----- second
* or we can make it overlap of spaces by threshold%
*/
bool doesConsumeX(QRect first, QRect second, int threshold)
bool doesConsumeX(const QRect& first, const QRect& second, int threshold)
{
// if one consumes another fully
if(first.left() <= second.left() && first.right() >= second.right())
......@@ -1085,7 +1085,7 @@ bool doesConsumeX(QRect first, QRect second, int threshold)
/**
* Same concept of doesConsumeX but in this case we calculate on y axis
*/
bool doesConsumeY(QRect first, QRect second, int threshold)
bool doesConsumeY(const QRect& first, const QRect& second, int threshold)
{
// if one consumes another fully
if(first.top() <= second.top() && first.bottom() >= second.bottom())
......
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