fix mixer on hdpi scale
This commit is contained in:
@@ -444,7 +444,7 @@ std::vector<Canvas::StrokeFrame> Canvas::stroke_draw_compute(Stroke& stroke) con
|
||||
+dx - dy, // D - bottom-right
|
||||
};
|
||||
|
||||
glm::vec2 mixer_sz(m_mixer.getWidth(), m_mixer.getHeight());
|
||||
glm::vec2 mixer_sz(App::I.width, App::I.height);
|
||||
glm::vec2 mixer_bb_min(mixer_sz);
|
||||
glm::vec2 mixer_bb_max(0, 0);
|
||||
for (int j = 0; j < 4; j++)
|
||||
@@ -466,7 +466,7 @@ std::vector<Canvas::StrokeFrame> Canvas::stroke_draw_compute(Stroke& stroke) con
|
||||
B[j].uvs2 = p / mixer_sz;
|
||||
}
|
||||
|
||||
f.m_mixer_rect = { glm::floor(mixer_bb_min), glm::ceil(mixer_bb_max - mixer_bb_min) };
|
||||
f.m_mixer_rect = glm::vec4(glm::floor(mixer_bb_min), glm::ceil(mixer_bb_max - mixer_bb_min)) / App::I.zoom;
|
||||
f.col = glm::vec4(s.col, 1);
|
||||
f.flow = s.flow;
|
||||
f.opacity = s.opacity;
|
||||
|
||||
@@ -440,26 +440,6 @@ void NodeCanvas::draw()
|
||||
}
|
||||
}
|
||||
|
||||
if (zoom > 1.f)
|
||||
{
|
||||
m_rtt.unbindFramebuffer();
|
||||
|
||||
glClearColor(1, 1, 1, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glViewport(c.x + App::I.off_x, c.y + App::I.off_y, c.z, c.w);
|
||||
|
||||
// draw the canvas
|
||||
m_sampler_linear.bind(0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
m_rtt.bindTexture();
|
||||
ShaderManager::use(kShader::Texture);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho<float>(-1, 1, -1, 1));
|
||||
m_face_plane.draw_fill();
|
||||
m_rtt.unbindTexture();
|
||||
}
|
||||
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
if (m_canvas->m_smask_active || m_canvas->m_current_mode == kCanvasMode::Copy || m_canvas->m_current_mode == kCanvasMode::Cut)
|
||||
{
|
||||
@@ -479,6 +459,25 @@ void NodeCanvas::draw()
|
||||
for (auto& mode : *m_canvas->m_mode)
|
||||
mode->on_Draw(ortho_proj, proj, camera);
|
||||
|
||||
if (zoom > 1.f)
|
||||
{
|
||||
m_rtt.unbindFramebuffer();
|
||||
|
||||
glClearColor(1, 1, 1, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glViewport(c.x + App::I.off_x, c.y + App::I.off_y, c.z, c.w);
|
||||
|
||||
// draw the canvas
|
||||
m_sampler_linear.bind(0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
m_rtt.bindTexture();
|
||||
ShaderManager::use(kShader::Texture);
|
||||
ShaderManager::u_int(kShaderUniform::Tex, 0);
|
||||
ShaderManager::u_mat4(kShaderUniform::MVP, glm::ortho<float>(-1, 1, -1, 1));
|
||||
m_face_plane.draw_fill();
|
||||
m_rtt.unbindTexture();
|
||||
}
|
||||
|
||||
blend ? glEnable(GL_BLEND) : glDisable(GL_BLEND);
|
||||
depth ? glEnable(GL_DEPTH_TEST) : glDisable(GL_DEPTH_TEST);
|
||||
m_sampler.unbind();
|
||||
|
||||
Reference in New Issue
Block a user