change font scale based on ui scale, fix brush outline color

This commit is contained in:
2019-08-08 23:50:45 +02:00
parent 34464c167e
commit 67dd9a2456
6 changed files with 59 additions and 25 deletions

View File

@@ -281,7 +281,16 @@ void CanvasModePen::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const
}
}
glm::u8vec4 pixel;
glReadPixels(pos.x / App::I->zoom, (App::I->height - pos.y - 1) / App::I->zoom, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
GLint fb_width = App::I->width;
GLint fb_height = App::I->height;
if (node->m_density != 1.f)
{
fb_width = node->m_rtt.getWidth();
fb_height = node->m_rtt.getHeight();
}
glReadPixels((pos.x / App::I->width) * fb_width,
((App::I->height - pos.y - 1) / App::I->height) * fb_height,
1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
bool outline = glm::min(tip_scale.x, tip_scale.y) < 20 || m_resizing ? false : m_draw_outline;
ShaderManager::u_int(kShaderUniform::DrawOutline, outline);
ShaderManager::u_vec4(kShaderUniform::Col, outline ? glm::vec4(1.f - glm::vec3(pixel) / 255.f, 1.f) : tip_color);