483 // ============================================================================= |
483 // ============================================================================= |
484 // |
484 // |
485 void GLRenderer::drawVBOs (EVBOSurface surface, EVBOComplement colors, GLenum type) |
485 void GLRenderer::drawVBOs (EVBOSurface surface, EVBOComplement colors, GLenum type) |
486 { |
486 { |
487 // Filter this through some configuration options |
487 // Filter this through some configuration options |
488 if ((Eq (surface, VBOSF_Quads, VBOSF_Triangles) and cfg::DrawSurfaces == false) or |
488 if ((isOneOf (surface, VBOSF_Quads, VBOSF_Triangles) and cfg::DrawSurfaces == false) or |
489 (surface == VBOSF_Lines and cfg::DrawEdgeLines == false) or |
489 (surface == VBOSF_Lines and cfg::DrawEdgeLines == false) or |
490 (surface == VBOSF_CondLines and cfg::DrawConditionalLines == false)) |
490 (surface == VBOSF_CondLines and cfg::DrawConditionalLines == false)) |
491 { |
491 { |
492 return; |
492 return; |
493 } |
493 } |
634 if (overlay.img != null) |
634 if (overlay.img != null) |
635 { |
635 { |
636 QPoint v0 = coordconv3_2 (currentDocumentData().overlays[camera()].v0), |
636 QPoint v0 = coordconv3_2 (currentDocumentData().overlays[camera()].v0), |
637 v1 = coordconv3_2 (currentDocumentData().overlays[camera()].v1); |
637 v1 = coordconv3_2 (currentDocumentData().overlays[camera()].v1); |
638 |
638 |
639 QRect targRect (v0.x(), v0.y(), Abs (v1.x() - v0.x()), Abs (v1.y() - v0.y())), |
639 QRect targRect (v0.x(), v0.y(), qAbs (v1.x() - v0.x()), qAbs (v1.y() - v0.y())), |
640 srcRect (0, 0, overlay.img->width(), overlay.img->height()); |
640 srcRect (0, 0, overlay.img->width(), overlay.img->height()); |
641 paint.drawImage (targRect, *overlay.img, srcRect); |
641 paint.drawImage (targRect, *overlay.img, srcRect); |
642 } |
642 } |
643 |
643 |
644 // Paint the coordinates onto the screen. |
644 // Paint the coordinates onto the screen. |
794 // |
794 // |
795 void GLRenderer::mouseMoveEvent (QMouseEvent* ev) |
795 void GLRenderer::mouseMoveEvent (QMouseEvent* ev) |
796 { |
796 { |
797 int dx = ev->x() - m_mousePosition.x(); |
797 int dx = ev->x() - m_mousePosition.x(); |
798 int dy = ev->y() - m_mousePosition.y(); |
798 int dy = ev->y() - m_mousePosition.y(); |
799 m_totalmove += Abs (dx) + Abs (dy); |
799 m_totalmove += qAbs (dx) + qAbs (dy); |
800 setCameraMoving (false); |
800 setCameraMoving (false); |
801 |
801 |
802 if (not m_editmode->mouseMoved (ev)) |
802 if (not m_editmode->mouseMoved (ev)) |
803 { |
803 { |
804 const bool left = ev->buttons() & Qt::LeftButton, |
804 const bool left = ev->buttons() & Qt::LeftButton, |
935 int y0 = range.top(); |
935 int y0 = range.top(); |
936 int x1 = x0 + range.width(); |
936 int x1 = x0 + range.width(); |
937 int y1 = y0 + range.height(); |
937 int y1 = y0 + range.height(); |
938 |
938 |
939 // Clamp the values to ensure they're within bounds |
939 // Clamp the values to ensure they're within bounds |
940 x0 = Max (0, x0); |
940 x0 = qMax (0, x0); |
941 y0 = Max (0, y0); |
941 y0 = qMax (0, y0); |
942 x1 = Min (x1, m_width); |
942 x1 = qMin (x1, m_width); |
943 y1 = Min (y1, m_height); |
943 y1 = qMin (y1, m_height); |
944 const int areawidth = (x1 - x0); |
944 const int areawidth = (x1 - x0); |
945 const int areaheight = (y1 - y0); |
945 const int areaheight = (y1 - y0); |
946 const qint32 numpixels = areawidth * areaheight; |
946 const qint32 numpixels = areawidth * areaheight; |
947 |
947 |
948 // Allocate space for the pixel data. |
948 // Allocate space for the pixel data. |