rectArray can only be NULL in case fAsString is true, not the other way around; this fixes
ServerFont::GetBoundingBoxesForStrings() (ScreenSaver no longer crashes as reported by Brian Verre on the mailing list). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21846 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -592,6 +592,7 @@ class BoundingBoxConsumer {
|
|||||||
, fTransform(transform)
|
, fTransform(transform)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start() {}
|
void Start() {}
|
||||||
void Finish(double x, double y) {}
|
void Finish(double x, double y) {}
|
||||||
void ConsumeEmptyGlyph(int32 index, uint32 charCode, double x, double y) {}
|
void ConsumeEmptyGlyph(int32 index, uint32 charCode, double x, double y) {}
|
||||||
@@ -601,21 +602,21 @@ class BoundingBoxConsumer {
|
|||||||
if (glyph->data_type != glyph_data_outline) {
|
if (glyph->data_type != glyph_data_outline) {
|
||||||
const agg::rect_i& r = glyph->bounds;
|
const agg::rect_i& r = glyph->bounds;
|
||||||
if (fAsString) {
|
if (fAsString) {
|
||||||
rectArray[index].left = r.x1 + x;
|
|
||||||
rectArray[index].top = r.y1 + y;
|
|
||||||
rectArray[index].right = r.x2 + x + 1;
|
|
||||||
rectArray[index].bottom = r.y2 + y + 1;
|
|
||||||
} else {
|
|
||||||
if (rectArray) {
|
if (rectArray) {
|
||||||
rectArray[index].left = r.x1;
|
rectArray[index].left = r.x1 + x;
|
||||||
rectArray[index].top = r.y1;
|
rectArray[index].top = r.y1 + y;
|
||||||
rectArray[index].right = r.x2 + 1;
|
rectArray[index].right = r.x2 + x + 1;
|
||||||
rectArray[index].bottom = r.y2 + 1;
|
rectArray[index].bottom = r.y2 + y + 1;
|
||||||
} else {
|
} else {
|
||||||
stringBoundingBox = stringBoundingBox
|
stringBoundingBox = stringBoundingBox
|
||||||
| BRect(r.x1 + x, r.y1 + y,
|
| BRect(r.x1 + x, r.y1 + y,
|
||||||
r.x2 + x + 1, r.y2 + y + 1);
|
r.x2 + x + 1, r.y2 + y + 1);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
rectArray[index].left = r.x1;
|
||||||
|
rectArray[index].top = r.y1;
|
||||||
|
rectArray[index].right = r.x2 + 1;
|
||||||
|
rectArray[index].bottom = r.y2 + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (fAsString) {
|
if (fAsString) {
|
||||||
@@ -686,8 +687,9 @@ ServerFont::GetBoundingBoxes(const char* string, int32 numChars,
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ServerFont::GetBoundingBoxesForStrings(char *charArray[], int32 lengthArray[],
|
ServerFont::GetBoundingBoxesForStrings(char *charArray[], int32 lengthArray[],
|
||||||
int32 numStrings, BRect rectArray[], font_metric_mode mode, escapement_delta deltaArray[])
|
int32 numStrings, BRect rectArray[], font_metric_mode mode,
|
||||||
|
escapement_delta deltaArray[])
|
||||||
{
|
{
|
||||||
// TODO: The font_metric_mode is never used
|
// TODO: The font_metric_mode is never used
|
||||||
if (!charArray || !lengthArray|| numStrings <= 0 || !rectArray || !deltaArray)
|
if (!charArray || !lengthArray|| numStrings <= 0 || !rectArray || !deltaArray)
|
||||||
|
|||||||
Reference in New Issue
Block a user