fix canvas on hdpi
This commit is contained in:
@@ -1082,7 +1082,7 @@ void App::brush_update()
|
||||
quick->m_slider_size->set_value(stroke->m_tip_size->get_value());
|
||||
*quick->m_button_brush_current_preview->m_brush = *Canvas::I->m_current_brush;
|
||||
quick->m_button_brush_current_preview->draw_stroke();
|
||||
//quick->m_button_color_current_inner->m_color = Canvas::I->m_current_brush->m_tip_color;
|
||||
quick->m_button_color_current_inner->m_color = Canvas::I->m_current_brush->m_tip_color;
|
||||
if (floating_picker)
|
||||
floating_picker->set_color(Canvas::I->m_current_brush->m_tip_color);
|
||||
if (floating_color)
|
||||
|
||||
@@ -243,7 +243,7 @@ void CanvasModePen::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const
|
||||
}
|
||||
}
|
||||
glm::u8vec4 pixel;
|
||||
glReadPixels(pos.x, App::I.height - pos.y - 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
|
||||
glReadPixels(pos.x / App::I.zoom, (App::I.height - pos.y - 1) / App::I.zoom, 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);
|
||||
|
||||
@@ -500,7 +500,7 @@ void NodeCanvas::handle_resize(glm::vec2 old_size, glm::vec2 new_size)
|
||||
//#endif
|
||||
m_blender_rtt.create((int)new_size.x, (int)new_size.y, -1, GL_RGBA8);
|
||||
m_cache_rtt.create((int)new_size.x, (int)new_size.y, -1, GL_RGBA8);
|
||||
m_rtt.create((int)new_size.x, (int)new_size.y, -1, GL_RGBA8);
|
||||
m_rtt.create((int)new_size.x, (int)new_size.y, -1, GL_RGBA8, true);
|
||||
m_blender_bg.create((int)new_size.x, (int)new_size.y, GL_RGBA8);
|
||||
if (auto img = root()->find<NodeImageTexture>("tex-debug"))
|
||||
img->tex.assign(m_canvas->m_mixer.getTextureID());
|
||||
|
||||
15
src/rtt.cpp
15
src/rtt.cpp
@@ -41,7 +41,7 @@ void RTT::resize(int width, int height)
|
||||
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldDFboID);
|
||||
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &oldRFboID);
|
||||
|
||||
new_rtt.create(width, height, -1, int_fmt);
|
||||
new_rtt.create(width, height, -1, int_fmt, rboID != 0);
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, new_rtt.fboID);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, fboID);
|
||||
@@ -100,7 +100,7 @@ void RTT::copy(const RTT & source)
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, oldRFboID);
|
||||
}
|
||||
|
||||
bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format)
|
||||
bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format, bool depth_buffer /*= false*/)
|
||||
{
|
||||
// Destroy any previously created object
|
||||
destroy();
|
||||
@@ -133,10 +133,13 @@ bool RTT::create(int width, int height, int tex/* = -1*/, GLint internal_format)
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
// Create a renderbuffer object to store depth info
|
||||
// glGenRenderbuffers(1, &rboID);
|
||||
// glBindRenderbuffer(GL_RENDERBUFFER, rboID);
|
||||
// glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
|
||||
// glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
if (depth_buffer)
|
||||
{
|
||||
glGenRenderbuffers(1, &rboID);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, rboID);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
|
||||
GLint oldFboID;
|
||||
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldFboID);
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
void destroy();
|
||||
void copy(const RTT& source);
|
||||
void resize(int width, int height);
|
||||
bool create(int width, int height, int tex = -1, GLint internal_format = GL_RGBA8);
|
||||
bool create(int width, int height, int tex = -1, GLint internal_format = GL_RGBA8, bool depth_buffer = false);
|
||||
bool recreate() { return create(w, h); }
|
||||
void clear(glm::vec4 color = glm::vec4(0));
|
||||
glm::ivec4 calc_bounds();
|
||||
|
||||
Reference in New Issue
Block a user