]> sigrok.org Git - pulseview.git/commitdiff
Clip signal painting with glScissor
authorJoel Holdsworth <redacted>
Sat, 7 Jul 2012 07:16:38 +0000 (08:16 +0100)
committerJoel Holdsworth <redacted>
Mon, 3 Sep 2012 12:59:06 +0000 (13:59 +0100)
sigview.cpp

index 8461af6e455f37b1182ef9b9bc1a8197ada54d09..dea3cbc1255bc646307cbd39448be239c0982fae 100644 (file)
@@ -86,6 +86,8 @@ void SigView::paintEvent(QPaintEvent *event)
        glClear(GL_COLOR_BUFFER_BIT);
 
        // Plot the signal
        glClear(GL_COLOR_BUFFER_BIT);
 
        // Plot the signal
+       glEnable(GL_SCISSOR_TEST);
+       glScissor(LabelMarginWidth, 0, width(), height());
        offset = RulerHeight;
        BOOST_FOREACH(const shared_ptr<Signal> s, sigs)
        {
        offset = RulerHeight;
        BOOST_FOREACH(const shared_ptr<Signal> s, sigs)
        {
@@ -99,6 +101,8 @@ void SigView::paintEvent(QPaintEvent *event)
                offset += SignalHeight;
        }
 
                offset += SignalHeight;
        }
 
+       glDisable(GL_SCISSOR_TEST);
+
        // Prepare for QPainter rendering
        glMatrixMode(GL_MODELVIEW);
        glPopMatrix();
        // Prepare for QPainter rendering
        glMatrixMode(GL_MODELVIEW);
        glPopMatrix();