Skip to content

Commit 6c954be

Browse files
committed
Update to latest DPF, force GL1 drawing on resize handle
Signed-off-by: falkTX <falktx@falktx.com>
1 parent 8686010 commit 6c954be

2 files changed

Lines changed: 29 additions & 24 deletions

File tree

‎plugins/ProM/ResizeHandle.hpp‎

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ START_NAMESPACE_DGL
2525
class ResizeHandle : public TopLevelWidget
2626
{
2727
public:
28-
/** Constructor for placing this handle on top of a window. */
29-
explicit ResizeHandle(Window& window)
30-
: TopLevelWidget(window),
31-
handleSize(16),
32-
hasCursor(false),
33-
isResizing(false)
34-
{
35-
resetArea();
36-
}
37-
3828
/** Overloaded constructor, will fetch the window from an existing top-level widget. */
3929
explicit ResizeHandle(TopLevelWidget* const tlw)
4030
: TopLevelWidget(tlw->getWindow()),
@@ -56,31 +46,27 @@ class ResizeHandle : public TopLevelWidget
5646
protected:
5747
void onDisplay() override
5848
{
59-
// TODO implement gl3 stuff in DPF
60-
#ifndef DGL_USE_OPENGL3
6149
const GraphicsContext& context(getGraphicsContext());
6250
const double lineWidth = 1.0 * getScaleFactor();
6351

64-
#if defined(DGL_OPENGL) && !defined(DGL_USE_OPENGL3)
6552
glMatrixMode(GL_MODELVIEW);
66-
#endif
53+
glLineWidth(lineWidth);
6754

6855
// draw white lines, 1px wide
69-
Color(1.0f, 1.0f, 1.0f).setFor(context);
70-
l1.draw(context, lineWidth);
71-
l2.draw(context, lineWidth);
72-
l3.draw(context, lineWidth);
56+
glColor3f(1.0f, 1.0f, 1.0f);
57+
drawLine(l1);
58+
drawLine(l2);
59+
drawLine(l3);
7360

7461
// draw black lines, offset by 1px and 1px wide
75-
Color(0.0f, 0.0f, 0.0f).setFor(context);
62+
glColor3f(0.0f, 0.0f, 0.0f);
7663
Line<double> l1b(l1), l2b(l2), l3b(l3);
7764
l1b.moveBy(lineWidth, lineWidth);
7865
l2b.moveBy(lineWidth, lineWidth);
7966
l3b.moveBy(lineWidth, lineWidth);
80-
l1b.draw(context, lineWidth);
81-
l2b.draw(context, lineWidth);
82-
l3b.draw(context, lineWidth);
83-
#endif
67+
drawLine(l1b);
68+
drawLine(l2b);
69+
drawLine(l3b);
8470
}
8571

8672
bool onMouse(const MouseEvent& ev) override
@@ -201,6 +187,25 @@ class ResizeHandle : public TopLevelWidget
201187
l3.setEndPos(x + offset, y + linesize + offset);
202188
}
203189

190+
void drawLine(const Line<double>& line)
191+
{
192+
drawLine(line.getStartPos(), line.getEndPos());
193+
}
194+
195+
void drawLine(const Point<double>& posStart, const Point<double>& posEnd)
196+
{
197+
DISTRHO_SAFE_ASSERT_RETURN(posStart != posEnd,);
198+
199+
glBegin(GL_LINES);
200+
201+
{
202+
glVertex2d(posStart.getX(), posStart.getY());
203+
glVertex2d(posEnd.getX(), posEnd.getY());
204+
}
205+
206+
glEnd();
207+
}
208+
204209
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ResizeHandle)
205210
};
206211

0 commit comments

Comments
 (0)