mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
common: RenderRegion x, y protect against negative value in unsigned int
This change protects against negative value in unsigned int of RenderRegion.x/y. This fixes a problem of invisible paint if ClipPath bounds was negative. @issue: #704
This commit is contained in:
parent
abebdbe545
commit
e6ebb5379b
3 changed files with 5 additions and 2 deletions
|
@ -77,6 +77,9 @@ static bool _clipPathFastTrack(Paint* cmpTarget, const RenderTransform* pTransfo
|
||||||
y2 = y2 * pTransform->m.e22 + pTransform->m.e23;
|
y2 = y2 * pTransform->m.e22 + pTransform->m.e23;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (x1 < 0.0f) x1 = 0.0f;
|
||||||
|
if (y1 < 0.0f) y1 = 0.0f;
|
||||||
|
|
||||||
viewport.x = static_cast<uint32_t>(x1);
|
viewport.x = static_cast<uint32_t>(x1);
|
||||||
viewport.y = static_cast<uint32_t>(y1);
|
viewport.y = static_cast<uint32_t>(y1);
|
||||||
viewport.w = static_cast<uint32_t>(roundf(x2 - x1 + 0.5f));
|
viewport.w = static_cast<uint32_t>(roundf(x2 - x1 + 0.5f));
|
||||||
|
|
|
@ -95,7 +95,7 @@ struct Picture::Impl
|
||||||
if (auto p = loader->paint()) {
|
if (auto p = loader->paint()) {
|
||||||
paint = p.release();
|
paint = p.release();
|
||||||
loader->close();
|
loader->close();
|
||||||
if (w != loader->w && h != loader->h) {
|
if (w != loader->w || h != loader->h) {
|
||||||
loader->resize(paint, w, h);
|
loader->resize(paint, w, h);
|
||||||
resizing = false;
|
resizing = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue