mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
common: fix incorrect aabb of scenes
This commit is contained in:
parent
f8c5f3a69c
commit
b38b6b659d
1 changed files with 13 additions and 6 deletions
|
@ -194,7 +194,7 @@ struct Scene::Impl : Paint::Impl
|
|||
return ret;
|
||||
}
|
||||
|
||||
Result bounds(Point* pt4, Matrix& m, TVG_UNUSED bool obb, bool stroking)
|
||||
Result bounds(Point* pt4, Matrix& m, bool obb, bool stroking)
|
||||
{
|
||||
if (paints.empty()) return Result::InsufficientCondition;
|
||||
|
||||
|
@ -203,7 +203,7 @@ struct Scene::Impl : Paint::Impl
|
|||
|
||||
for (auto paint : paints) {
|
||||
Point tmp[4];
|
||||
if (PAINT(paint)->bounds(tmp, nullptr, false, stroking) != Result::Success) continue;
|
||||
if (PAINT(paint)->bounds(tmp, obb ? nullptr : &m, false, stroking) != Result::Success) continue;
|
||||
//Merge regions
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (tmp[i].x < min.x) min.x = tmp[i].x;
|
||||
|
@ -212,10 +212,17 @@ struct Scene::Impl : Paint::Impl
|
|||
if (tmp[i].y > max.y) max.y = tmp[i].y;
|
||||
}
|
||||
}
|
||||
pt4[0] = min * m;
|
||||
pt4[1] = Point{max.x, min.y} * m;
|
||||
pt4[2] = max * m;
|
||||
pt4[3] = Point{min.x, max.y} * m;
|
||||
pt4[0] = min;
|
||||
pt4[1] = Point{max.x, min.y};
|
||||
pt4[2] = max;
|
||||
pt4[3] = Point{min.x, max.y};
|
||||
|
||||
if (obb) {
|
||||
pt4[0] *= m;
|
||||
pt4[1] *= m;
|
||||
pt4[2] *= m;
|
||||
pt4[3] *= m;
|
||||
}
|
||||
|
||||
return Result::Success;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue