mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-24 23:28:57 +00:00
common: more accurate clipped viewport rounding
Replaced ceil and direct casts with nearbyint to improve viewport size calculation. This ensures consistent approach with the fastTrack case in sw_engine. @Issue: https://github.com/thorvg/thorvg/issues/3148
This commit is contained in:
parent
02be99185e
commit
9c864f3e99
1 changed files with 4 additions and 4 deletions
|
@ -119,10 +119,10 @@ static Result _compFastTrack(RenderMethod* renderer, Paint* cmpTarget, const Mat
|
|||
if (v1.x > v2.x) std::swap(v1.x, v2.x);
|
||||
if (v1.y > v2.y) std::swap(v1.y, v2.y);
|
||||
|
||||
after.x = static_cast<int32_t>(v1.x);
|
||||
after.y = static_cast<int32_t>(v1.y);
|
||||
after.w = static_cast<int32_t>(ceil(v2.x - after.x));
|
||||
after.h = static_cast<int32_t>(ceil(v2.y - after.y));
|
||||
after.x = static_cast<int32_t>(nearbyint(v1.x));
|
||||
after.y = static_cast<int32_t>(nearbyint(v1.y));
|
||||
after.w = static_cast<int32_t>(nearbyint(v2.x)) - after.x;
|
||||
after.h = static_cast<int32_t>(nearbyint(v2.y)) - after.y;
|
||||
|
||||
if (after.w < 0) after.w = 0;
|
||||
if (after.h < 0) after.h = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue