Fixed conflicts after merge with master

This commit is contained in:
Enrico Turri 2019-04-03 08:38:32 +02:00
commit 48da4d4756
5 changed files with 54 additions and 27 deletions

View file

@ -3306,12 +3306,12 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
auto *imgui = wxGetApp().imgui();
imgui->set_display_size((float)w, (float)h);
const float font_size = 1.5f * wxGetApp().em_unit();
#if ENABLE_RETINA_GL
const float scaling = m_retina_helper->get_scale_factor();
imgui->set_scaling(font_size, 1.0f, m_retina_helper->get_scale_factor());
#else
const float scaling = m_canvas->GetContentScaleFactor();
imgui->set_scaling(font_size, m_canvas->GetContentScaleFactor(), 1.0f);
#endif
imgui->set_scaling(m_canvas->GetFont().GetPixelSize().y, scaling);
// ensures that this canvas is current
_set_current();
@ -3945,17 +3945,25 @@ void GLCanvas3D::_render_sla_slices() const
if (obj->is_left_handed())
// The polygons are mirrored by X.
glsafe(::glScalef(-1.0, 1.0, 1.0));
glsafe(::glColor3f(1.0f, 0.37f, 0.0f));
glsafe(::glEnableClientState(GL_VERTEX_ARRAY));
glsafe(::glVertexPointer(3, GL_DOUBLE, 0, (GLdouble*)bottom_obj_triangles.front().data()));
glsafe(::glDrawArrays(GL_TRIANGLES, 0, bottom_obj_triangles.size()));
glsafe(::glVertexPointer(3, GL_DOUBLE, 0, (GLdouble*)top_obj_triangles.front().data()));
glsafe(::glDrawArrays(GL_TRIANGLES, 0, top_obj_triangles.size()));
glsafe(::glColor3f(1.0f, 0.37f, 0.0f));
if (!bottom_obj_triangles.empty()) {
glsafe(::glVertexPointer(3, GL_DOUBLE, 0, (GLdouble*)bottom_obj_triangles.front().data()));
glsafe(::glDrawArrays(GL_TRIANGLES, 0, bottom_obj_triangles.size()));
}
if (! top_obj_triangles.empty()) {
glsafe(::glVertexPointer(3, GL_DOUBLE, 0, (GLdouble*)top_obj_triangles.front().data()));
glsafe(::glDrawArrays(GL_TRIANGLES, 0, top_obj_triangles.size()));
}
glsafe(::glColor3f(1.0f, 0.0f, 0.37f));
glsafe(::glVertexPointer(3, GL_DOUBLE, 0, (GLdouble*)bottom_sup_triangles.front().data()));
glsafe(::glDrawArrays(GL_TRIANGLES, 0, bottom_sup_triangles.size()));
glsafe(::glVertexPointer(3, GL_DOUBLE, 0, (GLdouble*)top_sup_triangles.front().data()));
glsafe(::glDrawArrays(GL_TRIANGLES, 0, top_sup_triangles.size()));
if (! bottom_sup_triangles.empty()) {
glsafe(::glVertexPointer(3, GL_DOUBLE, 0, (GLdouble*)bottom_sup_triangles.front().data()));
glsafe(::glDrawArrays(GL_TRIANGLES, 0, bottom_sup_triangles.size()));
}
if (! top_sup_triangles.empty()) {
glsafe(::glVertexPointer(3, GL_DOUBLE, 0, (GLdouble*)top_sup_triangles.front().data()));
glsafe(::glDrawArrays(GL_TRIANGLES, 0, top_sup_triangles.size()));
}
glsafe(::glDisableClientState(GL_VERTEX_ARRAY));
glsafe(::glPopMatrix());
}

View file

@ -93,16 +93,19 @@ void ImGuiWrapper::set_display_size(float w, float h)
io.DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
}
void ImGuiWrapper::set_scaling(float font_size, float scaling)
void ImGuiWrapper::set_scaling(float font_size, float scale_style, float scale_both)
{
if (m_font_size == font_size && m_style_scaling == scaling) {
font_size *= scale_both;
scale_style *= scale_both;
if (m_font_size == font_size && m_style_scaling == scale_style) {
return;
}
m_font_size = font_size;
ImGui::GetStyle().ScaleAllSizes(scaling / m_style_scaling);
m_style_scaling = scaling;
ImGui::GetStyle().ScaleAllSizes(scale_style / m_style_scaling);
m_style_scaling = scale_style;
destroy_font();
}

View file

@ -35,7 +35,7 @@ public:
void set_language(const std::string &language);
void set_display_size(float w, float h);
void set_scaling(float font_size, float scaling);
void set_scaling(float font_size, float scale_style, float scale_both);
bool update_mouse_data(wxMouseEvent &evt);
bool update_key_data(wxKeyEvent &evt);