lazy stroke preview rendering

This commit is contained in:
2019-04-23 12:17:46 +02:00
parent 042ad503d2
commit b4a9061cc4
7 changed files with 71 additions and 34 deletions

View File

@@ -590,8 +590,6 @@ void App::update(float dt)
{
auto box = n->m_clip_uncut;
Node* p = n->m_parent;
if (dynamic_cast<NodeBrushPresetItem*>(n))
p = p;
while (p)
{
float pt = YGNodeLayoutGetPadding(p->y_node, YGEdgeTop);
@@ -607,7 +605,21 @@ void App::update(float dt)
//auto box = n->m_clip;
//glm::ivec4 c = glm::vec4((int)box.x - 1, (int)(height / zoom - box.y - box.w) - 1, (int)box.z + 2, (int)box.w + 2) * zoom;
if (box.z <= 0.f || box.w <= 0.f)
{
if (n->m_on_screen)
{
if (dynamic_cast<NodeStrokePreview*>(n))
p = p;
n->handle_on_screen(true, false);
n->m_on_screen = false;
}
return false;
}
if (!n->m_on_screen)
{
n->handle_on_screen(false, true);
n->m_on_screen = true;
}
glm::ivec4 c = glm::vec4((int)box.x, (int)(height / zoom - box.y - box.w), (int)box.z, (int)box.w) * zoom;
glScissor(c.x + off_x, c.y + off_y, c.z, c.w);
n->draw();