remove all async_start/end calls
This commit is contained in:
@@ -34,9 +34,12 @@ void ActionStroke::undo()
|
||||
glm::vec2 box_sz = zw(m_box[i]) - xy(m_box[i]);
|
||||
if (box_sz.x > 0 && box_sz.y > 0 && box_sz.x <= m_canvas->m_layers[m_layer_idx]->w && box_sz.y <= m_canvas->m_layers[m_layer_idx]->h)
|
||||
{
|
||||
m_canvas->m_layers[m_layer_idx]->m_rtt[i].bindTexture();
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, (int)m_box[i].x, (int)m_box[i].y, (int)box_sz.x, (int)box_sz.y, GL_RGBA, GL_UNSIGNED_BYTE, m_image[i].get());
|
||||
m_canvas->m_layers[m_layer_idx]->m_rtt[i].unbindTexture();
|
||||
App::I.render_task([&]
|
||||
{
|
||||
m_canvas->m_layers[m_layer_idx]->m_rtt[i].bindTexture();
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, (int)m_box[i].x, (int)m_box[i].y, (int)box_sz.x, (int)box_sz.y, GL_RGBA, GL_UNSIGNED_BYTE, m_image[i].get());
|
||||
m_canvas->m_layers[m_layer_idx]->m_rtt[i].unbindTexture();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -66,7 +69,6 @@ Action* ActionStroke::get_redo()
|
||||
if (!layer->m_dirty_face[i] && !m_image[i])
|
||||
continue; // no stroke on this face, skip it
|
||||
|
||||
layer->m_rtt[i].bindFramebuffer();
|
||||
|
||||
auto box = clear_layer ? glm::ivec4(layer->m_dirty_box[i]) : m_box[i];
|
||||
|
||||
@@ -76,7 +78,12 @@ Action* ActionStroke::get_redo()
|
||||
if (box_sz.x > 0 && box_sz.y > 0 && box_sz.x <= layer->w && box_sz.y <= layer->h)
|
||||
{
|
||||
action->m_image[i] = std::make_unique<uint8_t[]>(box_sz.x * box_sz.y * 4);
|
||||
glReadPixels(box_or.x, box_or.y, box_sz.x, box_sz.y, GL_RGBA, GL_UNSIGNED_BYTE, action->m_image[i].get());
|
||||
App::I.render_task([&]
|
||||
{
|
||||
layer->m_rtt[i].bindFramebuffer();
|
||||
glReadPixels(box_or.x, box_or.y, box_sz.x, box_sz.y, GL_RGBA, GL_UNSIGNED_BYTE, action->m_image[i].get());
|
||||
layer->m_rtt[i].unbindFramebuffer();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -86,8 +93,6 @@ Action* ActionStroke::get_redo()
|
||||
action->m_box[i] = box;
|
||||
action->m_old_box[i] = layer->m_dirty_box[i];
|
||||
action->m_old_dirty[i] = layer->m_dirty_face[i];
|
||||
|
||||
layer->m_rtt[i].unbindFramebuffer();
|
||||
}
|
||||
// save history
|
||||
action->m_layer_idx = m_layer_idx;
|
||||
|
||||
Reference in New Issue
Block a user