code style fixes
This commit is contained in:
@@ -136,8 +136,8 @@ float Collision::getPlacementScale(const GlyphBoxes &glyphs, float minPlacementS
|
||||
const Box searchBox = getBox(anchor, bbox, minScale, maxScale);
|
||||
|
||||
std::vector<PlacementValue> blocking;
|
||||
((Tree *)cTree)->query(bgi::intersects(searchBox), std::back_inserter(blocking));
|
||||
((Tree *)hTree)->query(bgi::intersects(searchBox), std::back_inserter(blocking));
|
||||
((Tree *)cTree)->query(bgi::intersects(searchBox), std::back_inserter(blocking));
|
||||
|
||||
if (blocking.size()) {
|
||||
const CollisionAnchor &na = anchor; // new anchor
|
||||
@@ -175,12 +175,14 @@ float Collision::getPlacementScale(const GlyphBoxes &glyphs, float minPlacementS
|
||||
s3 = s4 = 1;
|
||||
}
|
||||
|
||||
float collisionFreeScale = std::fmin(std::fmax(s1, s2), std::fmax(s3, s4));
|
||||
const float collisionFreeScale = std::fmin(std::fmax(s1, s2), std::fmax(s3, s4));
|
||||
|
||||
// Only update label's min scale if the glyph was
|
||||
// restricted by a collision
|
||||
if (collisionFreeScale > minPlacementScale && collisionFreeScale > minScale &&
|
||||
collisionFreeScale < maxScale && collisionFreeScale < placement.maxScale) {
|
||||
if (collisionFreeScale > minPlacementScale &&
|
||||
collisionFreeScale > minScale &&
|
||||
collisionFreeScale < maxScale &&
|
||||
collisionFreeScale < placement.maxScale) {
|
||||
minPlacementScale = collisionFreeScale;
|
||||
}
|
||||
|
||||
|
||||
@@ -210,9 +210,6 @@ Placement Placement::getGlyphs(Anchor &anchor, const vec2<float> &origin, const
|
||||
|
||||
Placement placement;
|
||||
|
||||
PlacedGlyphs &glyphs = placement.shapes;
|
||||
GlyphBoxes &boxes = placement.boxes;
|
||||
|
||||
const uint32_t buffer = 3;
|
||||
|
||||
for (const PositionedGlyph &shape : shaping) {
|
||||
@@ -281,7 +278,7 @@ Placement Placement::getGlyphs(Anchor &anchor, const vec2<float> &origin, const
|
||||
const float glyphMinScale = std::max(instance.minScale, anchor.scale);
|
||||
|
||||
// Remember the glyph for later insertion.
|
||||
glyphs.emplace_back(
|
||||
placement.shapes.emplace_back(
|
||||
tl, tr, bl, br, rect,
|
||||
float(std::fmod((anchor.angle + rotate + instance.offset + 2 * M_PI), (2 * M_PI))),
|
||||
instance.anchor, glyphMinScale, instance.maxScale);
|
||||
@@ -294,18 +291,18 @@ Placement Placement::getGlyphs(Anchor &anchor, const vec2<float> &origin, const
|
||||
boxScale * util::max(tl.x, tr.x, bl.x, br.x),
|
||||
boxScale * util::max(tl.y, tr.y, bl.y, br.y)};
|
||||
}
|
||||
boxes.emplace_back(box, instance.anchor, glyphMinScale, instance.maxScale, padding);
|
||||
placement.boxes.emplace_back(box, instance.anchor, glyphMinScale, instance.maxScale, padding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO avoid creating the boxes in the first place?
|
||||
if (horizontal)
|
||||
boxes = {getMergedBoxes(boxes, anchor)};
|
||||
placement.boxes = {getMergedBoxes(placement.boxes, anchor)};
|
||||
|
||||
const float minPlacementScale = anchor.scale;
|
||||
placement.minScale = std::numeric_limits<float>::infinity();
|
||||
for (const GlyphBox &box : boxes) {
|
||||
for (const GlyphBox &box : placement.boxes) {
|
||||
placement.minScale = util::min(placement.minScale, box.minScale);
|
||||
}
|
||||
placement.minScale = util::max(minPlacementScale, Placement::globalMinScale);
|
||||
|
||||
Reference in New Issue
Block a user