OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 1999-2007, International Business Machines | 4 * Copyright (C) 1999-2015, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * file name: Paragraph.cpp | 8 * file name: Paragraph.cpp |
9 * | 9 * |
10 * created on: 09/06/2000 | 10 * created on: 09/06/2000 |
11 * created by: Eric R. Mader | 11 * created by: Eric R. Mader |
12 */ | 12 */ |
13 | 13 |
14 #include "unicode/utypes.h" | 14 #include "unicode/utypes.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (pEnd == NULL) { | 108 if (pEnd == NULL) { |
109 pEnd = &fChars[charCount]; | 109 pEnd = &fChars[charCount]; |
110 } | 110 } |
111 | 111 |
112 if (pEnd != pStart) { | 112 if (pEnd != pStart) { |
113 subsetFontRuns(fontRuns, pStart - fChars, pEnd - fChars, &fr); | 113 subsetFontRuns(fontRuns, pStart - fChars, pEnd - fChars, &fr); |
114 | 114 |
115 paragraphLayout = new ParagraphLayout(pStart, pEnd - pStart, &fr, NU
LL, NULL, locales, fParagraphLevel, FALSE, status); | 115 paragraphLayout = new ParagraphLayout(pStart, pEnd - pStart, &fr, NU
LL, NULL, locales, fParagraphLevel, FALSE, status); |
116 | 116 |
117 if (LE_FAILURE(status)) { | 117 if (LE_FAILURE(status)) { |
| 118 delete paragraphLayout; |
118 break; // return? something else? | 119 break; // return? something else? |
119 } | 120 } |
120 | 121 |
121 if (fParagraphLevel == UBIDI_DEFAULT_LTR) { | 122 if (fParagraphLevel == UBIDI_DEFAULT_LTR) { |
122 fParagraphLevel = paragraphLayout->getParagraphLevel(); | 123 fParagraphLevel = paragraphLayout->getParagraphLevel(); |
123 } | 124 } |
124 | 125 |
125 pAscent = paragraphLayout->getAscent(); | 126 pAscent = paragraphLayout->getAscent(); |
126 pDescent = paragraphLayout->getDescent(); | 127 pDescent = paragraphLayout->getDescent(); |
127 pLeading = paragraphLayout->getLeading(); | 128 pLeading = paragraphLayout->getLeading(); |
(...skipping 28 matching lines...) Expand all Loading... |
156 fLineHeight = ascent + descent + leading; | 157 fLineHeight = ascent + descent + leading; |
157 fAscent = ascent; | 158 fAscent = ascent; |
158 } | 159 } |
159 | 160 |
160 Paragraph::~Paragraph() | 161 Paragraph::~Paragraph() |
161 { | 162 { |
162 for (le_int32 line = 0; line < fLineCount; line += 1) { | 163 for (le_int32 line = 0; line < fLineCount; line += 1) { |
163 delete /*(LineInfo *)*/ fLines[line]; | 164 delete /*(LineInfo *)*/ fLines[line]; |
164 } | 165 } |
165 | 166 |
| 167 for (le_int32 paragraph = 0; paragraph < fParagraphCount; paragraph += 1) { |
| 168 delete fParagraphLayout[paragraph]; |
| 169 } |
| 170 |
166 LE_DELETE_ARRAY(fLines); | 171 LE_DELETE_ARRAY(fLines); |
167 delete fParagraphLayout; | 172 LE_DELETE_ARRAY(fParagraphLayout); |
168 LE_DELETE_ARRAY(fChars); | 173 LE_DELETE_ARRAY(fChars); |
169 } | 174 } |
170 | 175 |
171 void Paragraph::addLine(const ParagraphLayout::Line *line) | 176 void Paragraph::addLine(const ParagraphLayout::Line *line) |
172 { | 177 { |
173 if (fLineCount >= fLinesMax) { | 178 if (fLineCount >= fLinesMax) { |
174 fLines = (const ParagraphLayout::Line **) LE_GROW_ARRAY(fLines, fLinesMa
x + fLinesGrow); | 179 fLines = (const ParagraphLayout::Line **) LE_GROW_ARRAY(fLines, fLinesMa
x + fLinesGrow); |
175 fLinesMax += fLinesGrow; | 180 fLinesMax += fLinesGrow; |
176 } | 181 } |
177 | 182 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 if (LE_FAILURE(status)) { | 274 if (LE_FAILURE(status)) { |
270 delete result; | 275 delete result; |
271 result = NULL; | 276 result = NULL; |
272 } | 277 } |
273 | 278 |
274 LE_DELETE_ARRAY(text); | 279 LE_DELETE_ARRAY(text); |
275 | 280 |
276 return result; | 281 return result; |
277 } | 282 } |
278 | 283 |
OLD | NEW |