mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
common: fix wrong viewport region.
in the clip rect, viewport must be accumulated to the smaller one. this patch improves that corner-case.
This commit is contained in:
parent
f1fe36d8f6
commit
4a19e5b9f6
3 changed files with 15 additions and 1 deletions
|
@ -401,7 +401,7 @@ bool shapeGenRle(SwShape* shape, TVG_UNUSED const Shape* sdata, bool antiAlias,
|
|||
//Case A: Fast Track Rectangle Drawing
|
||||
if (!hasComposite && (shape->rect = _fastTrack(shape->outline))) return true;
|
||||
//Case B: Normale Shape RLE Drawing
|
||||
if ((shape->rle = rleRender(shape->rle, shape->outline, shape->bbox,antiAlias))) return true;
|
||||
if ((shape->rle = rleRender(shape->rle, shape->outline, shape->bbox, antiAlias))) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -214,6 +214,7 @@ namespace tvg
|
|||
RenderRegion viewport2;
|
||||
if ((cmpFastTrack = _clipPathFastTrack(cmpTarget, pTransform, viewport2))) {
|
||||
viewport = renderer.viewport();
|
||||
viewport2.merge(viewport);
|
||||
renderer.viewport(viewport2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,19 @@ struct Compositor {
|
|||
|
||||
struct RenderRegion {
|
||||
uint32_t x, y, w, h;
|
||||
|
||||
void merge(const RenderRegion& rhs)
|
||||
{
|
||||
auto x1 = x + w;
|
||||
auto y1 = y + h;
|
||||
auto x2 = rhs.x + rhs.w;
|
||||
auto y2 = rhs.y + rhs.h;
|
||||
|
||||
x = max(x, rhs.x);
|
||||
y = max(y, rhs.y);
|
||||
w = min(x1, x2) - x;
|
||||
h = min(y1, y2) - y;
|
||||
}
|
||||
};
|
||||
|
||||
struct RenderTransform
|
||||
|
|
Loading…
Add table
Reference in a new issue