Previous 199869 Revisions Next

r26344 Thursday 21st November, 2013 at 21:43:07 UTC by Jürgen Buchmüller
Count width of identical attributes and fill their background at once. Make the DVT_LOG view track the last visible line.
[/branches/alto2/src/osd/sdl]debugqtview.c

branches/alto2/src/osd/sdl/debugqtview.c
r26343r26344
7272
7373   size_t viewDataOffset = 0;
7474   const debug_view_xy& visibleCharDims = m_view->visible_size();
75   const debug_view_char* viewdata = m_view->viewdata();
7576   for (int y = 0; y < visibleCharDims.y; y++)
7677   {
7778      for (int x = 0; x < visibleCharDims.x; x++)
7879      {
79         const unsigned char textAttr = m_view->viewdata()[viewDataOffset].attrib;
80         const unsigned char textAttr = viewdata[viewDataOffset].attrib;
8081
81         if (x == 0 || textAttr != m_view->viewdata()[viewDataOffset-1].attrib)
82         if (x == 0 || textAttr != viewdata[viewDataOffset-1].attrib)
8283         {
8384            // Text color handling
8485            QColor fgColor(0,0,0);
r26343r26344
125126
126127            bgBrush.setColor(bgColor);
127128            painter.setBackground(bgBrush);
129            // Scan for the width of identical attributes
130            int width;
131            for (width = 0; x + width < visibleCharDims.x; width++)
132               if (textAttr != viewdata[viewDataOffset + width].attrib)
133                  break;
134            // Fill the of width times fontWidth x fontHeight.
135            painter.fillRect(x*fontWidth, y*fontHeight, width*fontWidth, fontHeight, bgBrush);
128136            painter.setPen(QPen(fgColor));
129137         }
130138
131         // Your character is not guaranteed to take up the entire fontWidth x fontHeight, so fill before.
132         painter.fillRect(x*fontWidth, y*fontHeight, fontWidth, fontHeight, bgBrush);
133
134139         // There is a touchy interplay between font height, drawing difference, visible position, etc
135140         // Fonts don't get drawn "down and to the left" like boxes, so some wiggling is needed.
136141         painter.drawText(x*fontWidth,
137142                        (y*fontHeight + (fontHeight*0.80)),
138                        QString(QChar(m_view->viewdata()[viewDataOffset].uchar)));
143                        QString(QChar(viewdata[viewDataOffset].uchar)));
139144         viewDataOffset++;
140145      }
141146   }
r26343r26344
251256{
252257   // Get a handle to the DebuggerView being updated & redraw
253258   DebuggerView* dView = (DebuggerView*)osdPrivate;
254   dView->verticalScrollBar()->setValue(dView->view()->visible_position().y);
259   int y = dView->view()->visible_position().y;
260   // Make the DVT_LOG view track the last visible line on updates
261   if (dView->view()->type() == DVT_LOG)
262      y += dView->view()->visible_size().y;
263   dView->verticalScrollBar()->setValue(y);
255264   dView->viewport()->update();
256265   dView->update();
257266}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team