(svn r26015) -Codechange: some constificaton

This commit is contained in:
rubidium 2013-11-16 19:59:06 +00:00
parent 16ecd533f3
commit b9e4697d8a
3 changed files with 14 additions and 14 deletions

View File

@ -339,7 +339,7 @@ static void SetColourRemap(TextColour colour)
* @return In case of left or center alignment the right most pixel we have drawn to. * @return In case of left or center alignment the right most pixel we have drawn to.
* In case of right alignment the left most pixel we have drawn to. * In case of right alignment the left most pixel we have drawn to.
*/ */
static int DrawLayoutLine(ParagraphLayout::Line *line, int y, int left, int right, StringAlignment align, bool underline, bool truncation) static int DrawLayoutLine(const ParagraphLayout::Line *line, int y, int left, int right, StringAlignment align, bool underline, bool truncation)
{ {
if (line->countRuns() == 0) return 0; if (line->countRuns() == 0) return 0;
@ -640,8 +640,8 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, const char *st
int last_line = top; int last_line = top;
int first_line = bottom; int first_line = bottom;
for (ParagraphLayout::Line **iter = layout.Begin(); iter != layout.End(); iter++) { for (const ParagraphLayout::Line **iter = layout.Begin(); iter != layout.End(); iter++) {
ParagraphLayout::Line *line = *iter; const ParagraphLayout::Line *line = *iter;
int line_height = line->getLeading(); int line_height = line->getLeading();
if (y >= top && y < bottom) { if (y >= top && y < bottom) {

View File

@ -184,7 +184,7 @@ ParagraphLayout::VisualRun::~VisualRun()
* Get the font associated with this run. * Get the font associated with this run.
* @return The font. * @return The font.
*/ */
Font *ParagraphLayout::VisualRun::getFont() const const Font *ParagraphLayout::VisualRun::getFont() const
{ {
return this->font; return this->font;
} }
@ -211,7 +211,7 @@ const GlyphID *ParagraphLayout::VisualRun::getGlyphs() const
* Get the positions of this run. * Get the positions of this run.
* @return The positions. * @return The positions.
*/ */
float *ParagraphLayout::VisualRun::getPositions() const const float *ParagraphLayout::VisualRun::getPositions() const
{ {
return this->positions; return this->positions;
} }
@ -278,7 +278,7 @@ int ParagraphLayout::Line::countRuns() const
* Get a specific visual run. * Get a specific visual run.
* @return The visual run. * @return The visual run.
*/ */
ParagraphLayout::VisualRun *ParagraphLayout::Line::getVisualRun(int run) const const ParagraphLayout::VisualRun *ParagraphLayout::Line::getVisualRun(int run) const
{ {
return *this->Get(run); return *this->Get(run);
} }
@ -307,7 +307,7 @@ void ParagraphLayout::reflow()
* @param max_width The maximum width of the string. * @param max_width The maximum width of the string.
* @return A Line, or NULL when at the end of the paragraph. * @return A Line, or NULL when at the end of the paragraph.
*/ */
ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width) const ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width)
{ {
/* Simple idea: /* Simple idea:
* - split a line at a newline character, or at a space where we can break a line. * - split a line at a newline character, or at a space where we can break a line.
@ -508,7 +508,7 @@ Layouter::Layouter(const char *str, int maxw, TextColour colour, FontSize fontsi
} }
/* Copy all lines into a local cache so we can reuse them later on more easily. */ /* Copy all lines into a local cache so we can reuse them later on more easily. */
ParagraphLayout::Line *l; const ParagraphLayout::Line *l;
while ((l = line.layout->nextLine(maxw)) != NULL) { while ((l = line.layout->nextLine(maxw)) != NULL) {
*this->Append() = l; *this->Append() = l;
} }
@ -523,7 +523,7 @@ Layouter::Layouter(const char *str, int maxw, TextColour colour, FontSize fontsi
Dimension Layouter::GetBounds() Dimension Layouter::GetBounds()
{ {
Dimension d = { 0, 0 }; Dimension d = { 0, 0 };
for (ParagraphLayout::Line **l = this->Begin(); l != this->End(); l++) { for (const ParagraphLayout::Line **l = this->Begin(); l != this->End(); l++) {
d.width = max<uint>(d.width, (*l)->getWidth()); d.width = max<uint>(d.width, (*l)->getWidth());
d.height += (*l)->getLeading(); d.height += (*l)->getLeading();
} }

View File

@ -131,10 +131,10 @@ public:
public: public:
VisualRun(Font *font, const WChar *chars, int glyph_count, int x); VisualRun(Font *font, const WChar *chars, int glyph_count, int x);
~VisualRun(); ~VisualRun();
Font *getFont() const; const Font *getFont() const;
int getGlyphCount() const; int getGlyphCount() const;
const GlyphID *getGlyphs() const; const GlyphID *getGlyphs() const;
float *getPositions() const; const float *getPositions() const;
int getLeading() const; int getLeading() const;
const int *getGlyphToCharMap() const; const int *getGlyphToCharMap() const;
}; };
@ -145,7 +145,7 @@ public:
int getLeading() const; int getLeading() const;
int getWidth() const; int getWidth() const;
int countRuns() const; int countRuns() const;
VisualRun *getVisualRun(int run) const; const VisualRun *getVisualRun(int run) const;
}; };
const WChar *buffer_begin; ///< Begin of the buffer. const WChar *buffer_begin; ///< Begin of the buffer.
@ -154,7 +154,7 @@ public:
ParagraphLayout(WChar *buffer, int length, FontMap &runs); ParagraphLayout(WChar *buffer, int length, FontMap &runs);
void reflow(); void reflow();
Line *nextLine(int max_width); const Line *nextLine(int max_width);
}; };
#endif /* !WITH_ICU */ #endif /* !WITH_ICU */
@ -163,7 +163,7 @@ public:
* *
* It also accounts for the memory allocations and frees. * It also accounts for the memory allocations and frees.
*/ */
class Layouter : public AutoDeleteSmallVector<ParagraphLayout::Line *, 4> { class Layouter : public AutoDeleteSmallVector<const ParagraphLayout::Line *, 4> {
#ifdef WITH_ICU #ifdef WITH_ICU
typedef UChar CharType; ///< The type of character used within the layouter. typedef UChar CharType; ///< The type of character used within the layouter.
#else /* WITH_ICU */ #else /* WITH_ICU */