ICU-2243 Remove old #if 0 code.

X-SVN-Rev: 11670
This commit is contained in:
Eric Mader 2003-04-24 18:22:42 +00:00
parent fe6c5b30a4
commit dada958faf

View File

@ -14,7 +14,6 @@
#include "unicode/utypes.h"
#include "unicode/uchar.h"
#include "unicode/ubidi.h"
#include "usc_impl.h" /* this is currently private! */
#include "layout/ParagraphLayout.h"
@ -28,137 +27,6 @@
#define MARGIN 10
#define LINE_GROW 32
#if 0
class LineRun
{
public:
LineRun(ParagraphLayout *paragraphLayout, le_int32 runIndex);
~LineRun();
le_int32 draw(RenderingSurface *surface, le_int32 x, le_int32 y, le_int32 width, le_int32 height) const;
private:
le_int32 fGlyphCount;
const LEFontInstance *fFont;
UBiDiDirection fDirection;
const LEGlyphID *fGlyphs;
le_int32 *fDX;
le_int32 *fDY;
};
LineRun::LineRun(ParagraphLayout *paragraphLayout, le_int32 runIndex)
{
LEGlyphID *glyphs;
float *positions;
le_int32 i;
fGlyphCount = paragraphLayout->getVisualRun(runIndex, NULL, NULL, NULL, NULL, NULL);
if (fGlyphCount <= 0) {
return;
}
fGlyphs = LE_NEW_ARRAY(LEGlyphID, fGlyphCount);
fDX = LE_NEW_ARRAY(le_int32, fGlyphCount);
fDY = LE_NEW_ARRAY(le_int32, fGlyphCount);
positions = LE_NEW_ARRAY(float, fGlyphCount * 2 + 2);
glyphs = (LEGlyphID *) fGlyphs;
paragraphLayout->getVisualRun(runIndex, glyphs, positions, NULL, &fFont, &fDirection);
for (i = 0; i < fGlyphCount; i += 1) {
TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(glyphs[i]);
// filter out deleted glyphs
if (ttGlyph == 0xFFFE || ttGlyph == 0xFFFF) {
glyphs[i] = LE_SET_GLYPH(glyphs[i], 0x0002);
}
fDX[i] = (le_int32) (positions[i * 2 + 2] - positions[i * 2]);
fDY[i] = (le_int32) positions[i * 2 + 1];
}
LE_DELETE_ARRAY(positions);
}
LineRun::~LineRun()
{
LE_DELETE_ARRAY(fDY);
LE_DELETE_ARRAY(fDX);
LE_DELETE_ARRAY(fGlyphs);
}
le_int32 LineRun::draw(RenderingSurface *surface, le_int32 x, le_int32 y, le_int32 width, le_int32 height) const
{
le_int32 dyEnd, dyStart;
dyStart = dyEnd = 0;
while (dyEnd < fGlyphCount) {
while (dyEnd < fGlyphCount && fDY[dyStart] == fDY[dyEnd]) {
dyEnd += 1;
}
surface->drawGlyphs(fFont, &fGlyphs[dyStart], dyEnd - dyStart,
&fDX[dyStart], x, y + fDY[dyStart], width, height);
for (le_int32 i = dyStart; i < dyEnd; i += 1) {
x += fDX[i];
}
dyStart = dyEnd;
}
return x;
}
class LineInfo
{
public:
LineInfo(ParagraphLayout *paragraphLayout);
~LineInfo();
le_int32 getRunCount() const {return fRunCount;};
void draw(RenderingSurface *surface, le_int32 x, le_int32 y, le_int32 width, le_int32 height);
private:
le_int32 fRunCount;
LineRun **fRuns;
};
LineInfo::LineInfo(ParagraphLayout *paragraphLayout)
{
fRunCount = paragraphLayout->countLineRuns();
fRuns = LE_NEW_ARRAY(LineRun *, fRunCount);
le_int32 run;
for (run = 0; run < fRunCount; run += 1) {
fRuns[run] = new LineRun(paragraphLayout, run);
}
}
LineInfo::~LineInfo()
{
le_int32 run;
for (run = 0; run < fRunCount; run += 1) {
delete fRuns[run];
}
LE_DELETE_ARRAY(fRuns);
}
void LineInfo::draw(RenderingSurface *surface, le_int32 x, le_int32 y, le_int32 width, le_int32 height)
{
le_int32 run;
for (run = 0; run < fRunCount; run += 1) {
x = fRuns[run]->draw(surface, x, y, width, height);
}
}
#endif
Paragraph::Paragraph(const LEUnicode chars[], int32_t charCount, const FontRuns *fontRuns)
: fParagraphLayout(NULL), fLineCount(0), fLinesMax(0), fLinesGrow(LINE_GROW), fLines(NULL),
fLineHeight(-1), fAscent(-1), fWidth(-1), fHeight(-1)