mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
renderer/scene: rectify the render region elaboration
Properly clip the render region to the current viewport.
This commit is contained in:
parent
27f173faa3
commit
bbe69578a5
1 changed files with 7 additions and 1 deletions
|
@ -60,6 +60,7 @@ struct Scene::Impl
|
|||
list<Paint*> paints;
|
||||
RenderData rd = nullptr;
|
||||
Scene* scene = nullptr;
|
||||
RenderRegion vport = {0, 0, INT32_MAX, INT32_MAX};
|
||||
Array<RenderEffect*>* effects = nullptr;
|
||||
uint8_t opacity; //for composition
|
||||
bool needComp = false; //composite or not
|
||||
|
@ -108,6 +109,8 @@ struct Scene::Impl
|
|||
|
||||
RenderData update(RenderMethod* renderer, const Matrix& transform, Array<RenderData>& clips, uint8_t opacity, RenderUpdateFlag flag, TVG_UNUSED bool clipper)
|
||||
{
|
||||
this->vport = renderer->viewport();
|
||||
|
||||
if ((needComp = needComposition(opacity))) {
|
||||
/* Overriding opacity value. If this scene is half-translucent,
|
||||
It must do intermediate composition with that opacity value. */
|
||||
|
@ -182,7 +185,10 @@ struct Scene::Impl
|
|||
}
|
||||
}
|
||||
}
|
||||
return {x1 + ex, y1 + ey, (x2 - x1) + ew, (y2 - y1) + eh};
|
||||
|
||||
auto ret = RenderRegion{x1 + ex, y1 + ey, (x2 - x1) + ew, (y2 - y1) + eh};
|
||||
ret.intersect(this->vport);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool bounds(float* px, float* py, float* pw, float* ph, bool stroking)
|
||||
|
|
Loading…
Add table
Reference in a new issue