[haiku-commits] Re: r38317 - haiku/trunk/src/apps/terminal

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 12 Sep 2010 17:50:55 +0200

On 2010-08-23 at 14:48:03 [+0200], pulkomandy@xxxxxxxxxxxxxxxxx wrote:
> Author: pulkomandy
> Date: 2010-08-23 14:48:03 +0200 (Mon, 23 Aug 2010)
> New Revision: 38317
> Changeset: http://dev.haiku-os.org/changeset/38317
> 
> Modified:
>    haiku/trunk/src/apps/terminal/TermView.cpp
> Log:
> Re-add a part of the code I shouldn't have removed : this ensures the 
> partial line that may be at the bottom of the screen
> if the size of the window is not a multiple of the text font size is 
> cleared.
> 
> 
> Modified: haiku/trunk/src/apps/terminal/TermView.cpp
> ===================================================================
> --- haiku/trunk/src/apps/terminal/TermView.cpp    2010-08-23 11:11:52 UTC 
> (rev 38316)
> +++ haiku/trunk/src/apps/terminal/TermView.cpp    2010-08-23 12:48:03 UTC 
> (rev 38317)
> @@ -1395,6 +1395,15 @@
>                  i += count;
>              }
>          }
> +
> +        if (y2 == fRows - 1) {
> +            // There may be some empty space below the last line
> +            BRect rect(updateRect.left, _LineOffset(fRows),
> +                updateRect.right, 0);
> +            rect.bottom = rect.top + fFontHeight - 1;
> +            FillRect(rect);
> +        }
> +
>      }

Besides that this introduces a superfluous blank line it also doesn't 
reproduce the original code removed in r38317. Which was:

-       // clear the area to the right of the line ends
-       if (y1 <= y2) {
-               float clearLeft = fColumns * fFontWidth;
-               if (clearLeft <= updateRect.right) {
-                       BRect rect(clearLeft, updateRect.top, updateRect.right,
-                               updateRect.bottom);
-                       SetHighColor(fTextBackColor);
-                       FillRect(rect);
-               }
-       }
-
-       // clear the area below the last line
-       if (y2 == fRows - 1) {
-               float clearTop = _LineOffset(fRows);
-               if (clearTop <= updateRect.bottom) {
-                       BRect rect(updateRect.left, clearTop, updateRect.right,
-                               updateRect.bottom);
-                       SetHighColor(fTextBackColor);
-                       FillRect(rect);
-               }
-       }

The first part is still completely missing. The second part you changed for 
a reason not obvious to me. The removed SetHighColor() causes the 
background drawing to happen with a random color. IMO the previous version 
was more efficent, more correct, and more robust (why rect.bottom = 
rect.top + fFontHeight - 1?).

The visual effects are described in #6530.

Also, the code was at the beginning of Draw() not without reason (reducing 
the time this dirty region remained on screen).

CU, Ingo

Other related posts: