mirror of https://github.com/OpenTTD/OpenTTD
(svn r26016) -Codechange: prepare for some class renames
parent
b9e4697d8a
commit
6449e96f1a
|
@ -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(const ParagraphLayout::Line *line, int y, int left, int right, StringAlignment align, bool underline, bool truncation)
|
static int DrawLayoutLine(const ParagraphLayouter::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;
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ static int DrawLayoutLine(const ParagraphLayout::Line *line, int y, int left, in
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int run_index = 0; run_index < line->countRuns(); run_index++) {
|
for (int run_index = 0; run_index < line->countRuns(); run_index++) {
|
||||||
const ParagraphLayout::VisualRun *run = line->getVisualRun(run_index);
|
const ParagraphLayouter::VisualRun *run = line->getVisualRun(run_index);
|
||||||
const Font *f = (const Font*)run->getFont();
|
const Font *f = (const Font*)run->getFont();
|
||||||
|
|
||||||
FontCache *fc = f->fc;
|
FontCache *fc = f->fc;
|
||||||
|
@ -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 (const ParagraphLayout::Line **iter = layout.Begin(); iter != layout.End(); iter++) {
|
for (const ParagraphLayouter::Line **iter = layout.Begin(); iter != layout.End(); iter++) {
|
||||||
const ParagraphLayout::Line *line = *iter;
|
const ParagraphLayouter::Line *line = *iter;
|
||||||
|
|
||||||
int line_height = line->getLeading();
|
int line_height = line->getLeading();
|
||||||
if (y >= top && y < bottom) {
|
if (y >= top && y < bottom) {
|
||||||
|
|
|
@ -153,7 +153,7 @@ ParagraphLayout *Layouter::GetParagraphLayout(UChar *buff, UChar *buff_end, Font
|
||||||
* @param char_count The number of characters in this run.
|
* @param char_count The number of characters in this run.
|
||||||
* @param x The initial x position for this run.
|
* @param x The initial x position for this run.
|
||||||
*/
|
*/
|
||||||
ParagraphLayout::VisualRun::VisualRun(Font *font, const WChar *chars, int char_count, int x) :
|
FallbackParagraphLayout::FallbackVisualRun::FallbackVisualRun(Font *font, const WChar *chars, int char_count, int x) :
|
||||||
font(font), glyph_count(char_count)
|
font(font), glyph_count(char_count)
|
||||||
{
|
{
|
||||||
this->glyphs = MallocT<GlyphID>(this->glyph_count);
|
this->glyphs = MallocT<GlyphID>(this->glyph_count);
|
||||||
|
@ -173,7 +173,7 @@ ParagraphLayout::VisualRun::VisualRun(Font *font, const WChar *chars, int char_c
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Free all data. */
|
/** Free all data. */
|
||||||
ParagraphLayout::VisualRun::~VisualRun()
|
FallbackParagraphLayout::FallbackVisualRun::~FallbackVisualRun()
|
||||||
{
|
{
|
||||||
free(this->positions);
|
free(this->positions);
|
||||||
free(this->glyph_to_char);
|
free(this->glyph_to_char);
|
||||||
|
@ -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.
|
||||||
*/
|
*/
|
||||||
const Font *ParagraphLayout::VisualRun::getFont() const
|
const Font *FallbackParagraphLayout::FallbackVisualRun::getFont() const
|
||||||
{
|
{
|
||||||
return this->font;
|
return this->font;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ const Font *ParagraphLayout::VisualRun::getFont() const
|
||||||
* Get the number of glyphs in this run.
|
* Get the number of glyphs in this run.
|
||||||
* @return The number of glyphs.
|
* @return The number of glyphs.
|
||||||
*/
|
*/
|
||||||
int ParagraphLayout::VisualRun::getGlyphCount() const
|
int FallbackParagraphLayout::FallbackVisualRun::getGlyphCount() const
|
||||||
{
|
{
|
||||||
return this->glyph_count;
|
return this->glyph_count;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ int ParagraphLayout::VisualRun::getGlyphCount() const
|
||||||
* Get the glyphs of this run.
|
* Get the glyphs of this run.
|
||||||
* @return The glyphs.
|
* @return The glyphs.
|
||||||
*/
|
*/
|
||||||
const GlyphID *ParagraphLayout::VisualRun::getGlyphs() const
|
const GlyphID *FallbackParagraphLayout::FallbackVisualRun::getGlyphs() const
|
||||||
{
|
{
|
||||||
return this->glyphs;
|
return this->glyphs;
|
||||||
}
|
}
|
||||||
|
@ -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.
|
||||||
*/
|
*/
|
||||||
const float *ParagraphLayout::VisualRun::getPositions() const
|
const float *FallbackParagraphLayout::FallbackVisualRun::getPositions() const
|
||||||
{
|
{
|
||||||
return this->positions;
|
return this->positions;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ const float *ParagraphLayout::VisualRun::getPositions() const
|
||||||
* Get the glyph-to-character map for this visual run.
|
* Get the glyph-to-character map for this visual run.
|
||||||
* @return The glyph-to-character map.
|
* @return The glyph-to-character map.
|
||||||
*/
|
*/
|
||||||
const int *ParagraphLayout::VisualRun::getGlyphToCharMap() const
|
const int *FallbackParagraphLayout::FallbackVisualRun::getGlyphToCharMap() const
|
||||||
{
|
{
|
||||||
return this->glyph_to_char;
|
return this->glyph_to_char;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ const int *ParagraphLayout::VisualRun::getGlyphToCharMap() const
|
||||||
* Get the height of this font.
|
* Get the height of this font.
|
||||||
* @return The height of the font.
|
* @return The height of the font.
|
||||||
*/
|
*/
|
||||||
int ParagraphLayout::VisualRun::getLeading() const
|
int FallbackParagraphLayout::FallbackVisualRun::getLeading() const
|
||||||
{
|
{
|
||||||
return this->getFont()->fc->GetHeight();
|
return this->getFont()->fc->GetHeight();
|
||||||
}
|
}
|
||||||
|
@ -238,10 +238,10 @@ int ParagraphLayout::VisualRun::getLeading() const
|
||||||
* Get the height of the line.
|
* Get the height of the line.
|
||||||
* @return The maximum height of the line.
|
* @return The maximum height of the line.
|
||||||
*/
|
*/
|
||||||
int ParagraphLayout::Line::getLeading() const
|
int FallbackParagraphLayout::FallbackLine::getLeading() const
|
||||||
{
|
{
|
||||||
int leading = 0;
|
int leading = 0;
|
||||||
for (const VisualRun * const *run = this->Begin(); run != this->End(); run++) {
|
for (const FallbackVisualRun * const *run = this->Begin(); run != this->End(); run++) {
|
||||||
leading = max(leading, (*run)->getLeading());
|
leading = max(leading, (*run)->getLeading());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ int ParagraphLayout::Line::getLeading() const
|
||||||
* Get the width of this line.
|
* Get the width of this line.
|
||||||
* @return The width of the line.
|
* @return The width of the line.
|
||||||
*/
|
*/
|
||||||
int ParagraphLayout::Line::getWidth() const
|
int FallbackParagraphLayout::FallbackLine::getWidth() const
|
||||||
{
|
{
|
||||||
if (this->Length() == 0) return 0;
|
if (this->Length() == 0) return 0;
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ int ParagraphLayout::Line::getWidth() const
|
||||||
* Since there is no left-to-right support, taking this value of
|
* Since there is no left-to-right support, taking this value of
|
||||||
* the last run gives us the end of the line and thus the width.
|
* the last run gives us the end of the line and thus the width.
|
||||||
*/
|
*/
|
||||||
const VisualRun *run = this->getVisualRun(this->countRuns() - 1);
|
const FallbackVisualRun *run = this->getVisualRun(this->countRuns() - 1);
|
||||||
return (int)run->getPositions()[run->getGlyphCount() * 2];
|
return (int)run->getPositions()[run->getGlyphCount() * 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ int ParagraphLayout::Line::getWidth() const
|
||||||
* Get the number of runs in this line.
|
* Get the number of runs in this line.
|
||||||
* @return The number of runs.
|
* @return The number of runs.
|
||||||
*/
|
*/
|
||||||
int ParagraphLayout::Line::countRuns() const
|
int FallbackParagraphLayout::FallbackLine::countRuns() const
|
||||||
{
|
{
|
||||||
return this->Length();
|
return this->Length();
|
||||||
}
|
}
|
||||||
|
@ -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.
|
||||||
*/
|
*/
|
||||||
const ParagraphLayout::VisualRun *ParagraphLayout::Line::getVisualRun(int run) const
|
const ParagraphLayouter::VisualRun *FallbackParagraphLayout::FallbackLine::getVisualRun(int run) const
|
||||||
{
|
{
|
||||||
return *this->Get(run);
|
return *this->Get(run);
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ const ParagraphLayout::VisualRun *ParagraphLayout::Line::getVisualRun(int run) c
|
||||||
* @param length The length of the paragraph.
|
* @param length The length of the paragraph.
|
||||||
* @param runs The font mapping of this paragraph.
|
* @param runs The font mapping of this paragraph.
|
||||||
*/
|
*/
|
||||||
ParagraphLayout::ParagraphLayout(WChar *buffer, int length, FontMap &runs) : buffer_begin(buffer), buffer(buffer), runs(runs)
|
FallbackParagraphLayout::FallbackParagraphLayout(WChar *buffer, int length, FontMap &runs) : buffer_begin(buffer), buffer(buffer), runs(runs)
|
||||||
{
|
{
|
||||||
assert(runs.End()[-1].first == length);
|
assert(runs.End()[-1].first == length);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ ParagraphLayout::ParagraphLayout(WChar *buffer, int length, FontMap &runs) : buf
|
||||||
/**
|
/**
|
||||||
* Reset the position to the start of the paragraph.
|
* Reset the position to the start of the paragraph.
|
||||||
*/
|
*/
|
||||||
void ParagraphLayout::reflow()
|
void FallbackParagraphLayout::reflow()
|
||||||
{
|
{
|
||||||
this->buffer = this->buffer_begin;
|
this->buffer = this->buffer_begin;
|
||||||
}
|
}
|
||||||
|
@ -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.
|
||||||
*/
|
*/
|
||||||
const ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width)
|
const ParagraphLayouter::Line *FallbackParagraphLayout::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.
|
||||||
|
@ -315,12 +315,12 @@ const ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width)
|
||||||
*/
|
*/
|
||||||
if (this->buffer == NULL) return NULL;
|
if (this->buffer == NULL) return NULL;
|
||||||
|
|
||||||
Line *l = new Line();
|
FallbackLine *l = new FallbackLine();
|
||||||
|
|
||||||
if (*this->buffer == '\0') {
|
if (*this->buffer == '\0') {
|
||||||
/* Only a newline. */
|
/* Only a newline. */
|
||||||
this->buffer = NULL;
|
this->buffer = NULL;
|
||||||
*l->Append() = new VisualRun(this->runs.Begin()->second, this->buffer, 0, 0);
|
*l->Append() = new FallbackVisualRun(this->runs.Begin()->second, this->buffer, 0, 0);
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ const ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width)
|
||||||
|
|
||||||
if (this->buffer == next_run) {
|
if (this->buffer == next_run) {
|
||||||
int w = l->getWidth();
|
int w = l->getWidth();
|
||||||
*l->Append() = new VisualRun(iter->second, begin, this->buffer - begin, w);
|
*l->Append() = new FallbackVisualRun(iter->second, begin, this->buffer - begin, w);
|
||||||
iter++;
|
iter++;
|
||||||
assert(iter != this->runs.End());
|
assert(iter != this->runs.End());
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ const ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width)
|
||||||
|
|
||||||
if (l->Length() == 0 || last_char - begin != 0) {
|
if (l->Length() == 0 || last_char - begin != 0) {
|
||||||
int w = l->getWidth();
|
int w = l->getWidth();
|
||||||
*l->Append() = new VisualRun(iter->second, begin, last_char - begin, w);
|
*l->Append() = new FallbackVisualRun(iter->second, begin, last_char - begin, w);
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
@ -422,9 +422,9 @@ size_t Layouter::AppendToBuffer(WChar *buff, const WChar *buffer_last, WChar c)
|
||||||
* @param fontMapping THe mapping of the fonts.
|
* @param fontMapping THe mapping of the fonts.
|
||||||
* @return The ParagraphLayout instance.
|
* @return The ParagraphLayout instance.
|
||||||
*/
|
*/
|
||||||
ParagraphLayout *Layouter::GetParagraphLayout(WChar *buff, WChar *buff_end, FontMap &fontMapping)
|
ParagraphLayouter *Layouter::GetParagraphLayout(WChar *buff, WChar *buff_end, FontMap &fontMapping)
|
||||||
{
|
{
|
||||||
return new ParagraphLayout(buff, buff_end - buff, fontMapping);
|
return new FallbackParagraphLayout(buff, buff_end - buff, fontMapping);
|
||||||
}
|
}
|
||||||
#endif /* !WITH_ICU */
|
#endif /* !WITH_ICU */
|
||||||
|
|
||||||
|
@ -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. */
|
||||||
const ParagraphLayout::Line *l;
|
const ParagraphLayouter::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 (const ParagraphLayout::Line **l = this->Begin(); l != this->End(); l++) {
|
for (const ParagraphLayouter::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();
|
||||||
}
|
}
|
||||||
|
@ -557,7 +557,7 @@ Point Layouter::GetCharPosition(const char *ch) const
|
||||||
|
|
||||||
if (str == ch) {
|
if (str == ch) {
|
||||||
/* Valid character. */
|
/* Valid character. */
|
||||||
const ParagraphLayout::Line *line = *this->Begin();
|
const ParagraphLayouter::Line *line = *this->Begin();
|
||||||
|
|
||||||
/* Pointer to the end-of-string/line marker? Return total line width. */
|
/* Pointer to the end-of-string/line marker? Return total line width. */
|
||||||
if (*ch == '\0' || *ch == '\n') {
|
if (*ch == '\0' || *ch == '\n') {
|
||||||
|
@ -567,7 +567,7 @@ Point Layouter::GetCharPosition(const char *ch) const
|
||||||
|
|
||||||
/* Scan all runs until we've found our code point index. */
|
/* Scan all runs until we've found our code point index. */
|
||||||
for (int run_index = 0; run_index < line->countRuns(); run_index++) {
|
for (int run_index = 0; run_index < line->countRuns(); run_index++) {
|
||||||
const ParagraphLayout::VisualRun *run = line->getVisualRun(run_index);
|
const ParagraphLayouter::VisualRun *run = line->getVisualRun(run_index);
|
||||||
|
|
||||||
for (int i = 0; i < run->getGlyphCount(); i++) {
|
for (int i = 0; i < run->getGlyphCount(); i++) {
|
||||||
/* Matching glyph? Return position. */
|
/* Matching glyph? Return position. */
|
||||||
|
@ -590,10 +590,10 @@ Point Layouter::GetCharPosition(const char *ch) const
|
||||||
*/
|
*/
|
||||||
const char *Layouter::GetCharAtPosition(int x) const
|
const char *Layouter::GetCharAtPosition(int x) const
|
||||||
{
|
{
|
||||||
const ParagraphLayout::Line *line = *this->Begin();;
|
const ParagraphLayouter::Line *line = *this->Begin();;
|
||||||
|
|
||||||
for (int run_index = 0; run_index < line->countRuns(); run_index++) {
|
for (int run_index = 0; run_index < line->countRuns(); run_index++) {
|
||||||
const ParagraphLayout::VisualRun *run = line->getVisualRun(run_index);
|
const ParagraphLayouter::VisualRun *run = line->getVisualRun(run_index);
|
||||||
|
|
||||||
for (int i = 0; i < run->getGlyphCount(); i++) {
|
for (int i = 0; i < run->getGlyphCount(); i++) {
|
||||||
/* Not a valid glyph (empty). */
|
/* Not a valid glyph (empty). */
|
||||||
|
|
|
@ -24,7 +24,11 @@
|
||||||
#define ICU_FONTINSTANCE : public LEFontInstance
|
#define ICU_FONTINSTANCE : public LEFontInstance
|
||||||
#else /* WITH_ICU */
|
#else /* WITH_ICU */
|
||||||
#define ICU_FONTINSTANCE
|
#define ICU_FONTINSTANCE
|
||||||
|
#define FallbackParagraphLayout ParagraphLayout
|
||||||
|
#define FallbackVisualRun VisualRun
|
||||||
|
#define FallbackLine Line
|
||||||
#endif /* WITH_ICU */
|
#endif /* WITH_ICU */
|
||||||
|
#define ParagraphLayouter ParagraphLayout
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text drawing parameters, which can change while drawing a line, but are kept between multiple parts
|
* Text drawing parameters, which can change while drawing a line, but are kept between multiple parts
|
||||||
|
@ -118,10 +122,10 @@ typedef SmallMap<int, Font *> FontMap;
|
||||||
* @note Does not conform to function naming style as it provides a
|
* @note Does not conform to function naming style as it provides a
|
||||||
* fallback for the ICU class.
|
* fallback for the ICU class.
|
||||||
*/
|
*/
|
||||||
class ParagraphLayout {
|
class FallbackParagraphLayout {
|
||||||
public:
|
public:
|
||||||
/** Visual run contains data about the bit of text with the same font. */
|
/** Visual run contains data about the bit of text with the same font. */
|
||||||
class VisualRun {
|
class FallbackVisualRun {
|
||||||
Font *font; ///< The font used to layout these.
|
Font *font; ///< The font used to layout these.
|
||||||
GlyphID *glyphs; ///< The glyphs we're drawing.
|
GlyphID *glyphs; ///< The glyphs we're drawing.
|
||||||
float *positions; ///< The positions of the glyphs.
|
float *positions; ///< The positions of the glyphs.
|
||||||
|
@ -129,8 +133,8 @@ public:
|
||||||
int glyph_count; ///< The number of glyphs.
|
int glyph_count; ///< The number of glyphs.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VisualRun(Font *font, const WChar *chars, int glyph_count, int x);
|
FallbackVisualRun(Font *font, const WChar *chars, int glyph_count, int x);
|
||||||
~VisualRun();
|
~FallbackVisualRun();
|
||||||
const Font *getFont() const;
|
const Font *getFont() const;
|
||||||
int getGlyphCount() const;
|
int getGlyphCount() const;
|
||||||
const GlyphID *getGlyphs() const;
|
const GlyphID *getGlyphs() const;
|
||||||
|
@ -140,19 +144,19 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A single line worth of VisualRuns. */
|
/** A single line worth of VisualRuns. */
|
||||||
class Line : public AutoDeleteSmallVector<VisualRun *, 4> {
|
class FallbackLine : public AutoDeleteSmallVector<FallbackVisualRun *, 4> {
|
||||||
public:
|
public:
|
||||||
int getLeading() const;
|
int getLeading() const;
|
||||||
int getWidth() const;
|
int getWidth() const;
|
||||||
int countRuns() const;
|
int countRuns() const;
|
||||||
const VisualRun *getVisualRun(int run) const;
|
const FallbackVisualRun *getVisualRun(int run) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
const WChar *buffer_begin; ///< Begin of the buffer.
|
const WChar *buffer_begin; ///< Begin of the buffer.
|
||||||
const WChar *buffer; ///< The current location in the buffer.
|
const WChar *buffer; ///< The current location in the buffer.
|
||||||
FontMap &runs; ///< The fonts we have to use for this paragraph.
|
FontMap &runs; ///< The fonts we have to use for this paragraph.
|
||||||
|
|
||||||
ParagraphLayout(WChar *buffer, int length, FontMap &runs);
|
FallbackParagraphLayout(WChar *buffer, int length, FontMap &runs);
|
||||||
void reflow();
|
void reflow();
|
||||||
const Line *nextLine(int max_width);
|
const Line *nextLine(int max_width);
|
||||||
};
|
};
|
||||||
|
@ -163,7 +167,7 @@ public:
|
||||||
*
|
*
|
||||||
* It also accounts for the memory allocations and frees.
|
* It also accounts for the memory allocations and frees.
|
||||||
*/
|
*/
|
||||||
class Layouter : public AutoDeleteSmallVector<const ParagraphLayout::Line *, 4> {
|
class Layouter : public AutoDeleteSmallVector<const ParagraphLayouter::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 */
|
||||||
|
@ -173,7 +177,7 @@ class Layouter : public AutoDeleteSmallVector<const ParagraphLayout::Line *, 4>
|
||||||
const char *string; ///< Pointer to the original string.
|
const char *string; ///< Pointer to the original string.
|
||||||
|
|
||||||
size_t AppendToBuffer(CharType *buff, const CharType *buffer_last, WChar c);
|
size_t AppendToBuffer(CharType *buff, const CharType *buffer_last, WChar c);
|
||||||
ParagraphLayout *GetParagraphLayout(CharType *buff, CharType *buff_end, FontMap &fontMapping);
|
ParagraphLayouter *GetParagraphLayout(CharType *buff, CharType *buff_end, FontMap &fontMapping);
|
||||||
|
|
||||||
/** Key into the linecache */
|
/** Key into the linecache */
|
||||||
struct LineCacheKey {
|
struct LineCacheKey {
|
||||||
|
@ -195,8 +199,8 @@ class Layouter : public AutoDeleteSmallVector<const ParagraphLayout::Line *, 4>
|
||||||
CharType buffer[DRAW_STRING_BUFFER]; ///< Accessed by both ICU's and our ParagraphLayout::nextLine.
|
CharType buffer[DRAW_STRING_BUFFER]; ///< Accessed by both ICU's and our ParagraphLayout::nextLine.
|
||||||
FontMap runs; ///< Accessed by our ParagraphLayout::nextLine.
|
FontMap runs; ///< Accessed by our ParagraphLayout::nextLine.
|
||||||
|
|
||||||
FontState state_after; ///< Font state after the line.
|
FontState state_after; ///< Font state after the line.
|
||||||
ParagraphLayout *layout; ///< Layout of the line.
|
ParagraphLayouter *layout; ///< Layout of the line.
|
||||||
|
|
||||||
LineCacheItem() : layout(NULL) {}
|
LineCacheItem() : layout(NULL) {}
|
||||||
~LineCacheItem() { delete layout; }
|
~LineCacheItem() { delete layout; }
|
||||||
|
|
Loading…
Reference in New Issue