flat assembler
Message board for the users of flat assembler.
Index
> IDE Development > Garbage when scrolling Goto page 1, 2 Next |
Author |
|
LostCoder 24 Apr 2012, 19:48
Vertical scroll produces garbage with bold Courier New font. Size is 10.
|
|||
24 Apr 2012, 19:48 |
|
revolution 24 Apr 2012, 21:44
Please give exact steps needed to reproduce the problem. Also which OS and which fasm version? Does the contents of the source code affect things?
|
|||
24 Apr 2012, 21:44 |
|
mindcooler 24 Apr 2012, 22:57
Same here, the letter m seems to be leaving two pixels behind.
|
|||
24 Apr 2012, 22:57 |
|
SFeLi 25 Apr 2012, 10:06
Tomasz Grysztar
32-bit Windows XP SP3, 1280x800x32, ClearType turned on, Courier New, Bold, any size (20 on screenshot), scrolling window with a mouse wheel up and down several times. Last edited by SFeLi on 25 Apr 2012, 11:33; edited 1 time in total |
|||
25 Apr 2012, 10:06 |
|
Tomasz Grysztar 25 Apr 2012, 10:19
Hmm, actually I noticed it in WinXP after i turned ClearType OFF. While it was on, the effect was simply not discernible with my contrast settings, at least on smaller font sizes.
Is it possible that some letters have pixels drawn outside their boxes? It seems that the invalidation region I set up is not enough to cover some of the drawn pixels. |
|||
25 Apr 2012, 10:19 |
|
dancho 25 Apr 2012, 10:21
win XP 32bit SP3,
1680*1050*32, dell 2007wfp, nV GF GTX 260, driver version : 285,58 whql, fasmw Courier New, Bold , any size, same here : vertical scrolls produce red pixels... |
|||
25 Apr 2012, 10:21 |
|
JohnFound 25 Apr 2012, 10:30
Confirmed minor artifacts for bold and italic fonts with and without antialiasing.
IMHO, it is Win32 problem with the wrong width of the characters for bold and italic fonts. It is not related to ClearType (actually with cleartype off the artifacts are plain black and more visible) |
|||
25 Apr 2012, 10:30 |
|
Tomasz Grysztar 25 Apr 2012, 10:36
Yes, it seems that some of the letters have pixels drawn outside of their boxes, as it is possible to fix it by making invalidation region one pixel wider to the left:
Code: invalidate: push ecx edx lea eax,[rect] dec [rect.left] ; add this instruction invoke InvalidateRect,[hwnd],eax,FALSE |
|||
25 Apr 2012, 10:36 |
|
revolution 25 Apr 2012, 10:43
VScroll can be done by copying the lower (upper) section of pixels and moving up (down) the screen and then redraw the new lower (upper) section. Why does VScroll need to know the horizontal width of an individual character? The entire width of the new drawn portion can be erased as one piece before the new text is drawn.
|
|||
25 Apr 2012, 10:43 |
|
Tomasz Grysztar 25 Apr 2012, 10:53
In asmedit's architecture the scrolling is handled internally, so your solution does not apply here in such an obvious way. Remember that it was designed to be working cross-platform, the same code is used for text-mode fasmd, for example, and the same would work for escape-codes-based console, too.
And the problem here comes from the fact that it does not redraw the parts of the line that are supposedly the same as they were before the change. Even if you were simply copying the pixels from one place to the other, still the same thing would occur unless you invalidated the whole window (or the wider area, as in my quick fix). |
|||
25 Apr 2012, 10:53 |
|
revolution 25 Apr 2012, 11:27
Since you need to make it cross platform then you could extend the "will be changed" portion by one whole character at each end and then do the scroll.
|
|||
25 Apr 2012, 11:27 |
|
Tomasz Grysztar 25 Apr 2012, 11:32
revolution wrote: Since you need to make it cross platform then you could extend the "will be changed" portion by one whole character at each end and then do the scroll. |
|||
25 Apr 2012, 11:32 |
|
revolution 25 Apr 2012, 11:41
One whole character fixes the current problem and has no detrimental effect on any other platforms. It also addresses your concern about "how do I know that it will never be off by two pixels?".
Besides, for computers now days even the naive redraw of the entire screen is usually rapid enough to be unnoticeable by the user. |
|||
25 Apr 2012, 11:41 |
|
Tomasz Grysztar 25 Apr 2012, 11:52
Such logic should never be put into a core, as core design has to simply reflect the functional view of the system, which can be easily interpreted when you write an interface for it. So even if core was saying that there is some area needed to be refreshed (which is not the case with asmedit, because there determining which characters changed and thus need to be redrawn is left to the abstraction layer), it would have to clearly specify the exact area, otherwise it would be a bad design. It would then be responsibility of OS-specific interface to decide what to do with that data, on different systems different problems might arise - but providing the clear set of rules from the core makes it easier to perform any adjustments necessary in the abstraction layer.
With asmedit, the interface has much freedom - it can simply redraw the whole screen each time, or check what has changed and redraw only these portions - on Windows it also uses the invalidation mechanism for that. It is even possible to add to Windows interface the ability to detect what pixel block can be copied from other portions of the window instead of drawing them anew (like in the case of scrolling), but this wouldn't change anything in case of this problem, as it is related to the dimensions of invalidated region created by Windows-specific interface. revolution wrote: Besides, for computers now days even the naive redraw of the entire screen is usually rapid enough to be unnoticeable by the user. |
|||
25 Apr 2012, 11:52 |
|
LostCoder 25 Apr 2012, 12:20
revolution wrote: Please give exact steps needed to reproduce the problem. Also which OS and which fasm version? Does the contents of the source code affect things? Tomasz Grysztar wrote: how do I know that it will never be off by two pixels? Structure TEXTMETRICS contains tmOverhang field which probably one you need. Also my experiments shows that members of ABC structure can be negative, so I can assume that OS character drawing routines calculates offset after drawing, and extent calculation functions can return smaller size of character instead of actual. |
|||
25 Apr 2012, 12:20 |
|
Tomasz Grysztar 25 Apr 2012, 12:33
fasmw is using GetTextExtentPoint32, which supposedly already contains the tmOverhang:
MSDN on TEXTMETRIC wrote: The tmOverhang member enables the application to determine how much of the character width returned by a GetTextExtentPoint32 function call on a single character is the actual character width and how much is the per-string extra width. The actual width is the extent minus the overhang. |
|||
25 Apr 2012, 12:33 |
|
LostCoder 25 Apr 2012, 12:41
Hmm, than it is probably ABC:
MSDN Remarks on ABC wrote: The total width of a character is the summation of the A, B, and C spaces. Either the A or the C space can be negative to indicate underhangs or overhangs. |
|||
25 Apr 2012, 12:41 |
|
Tomasz Grysztar 25 Apr 2012, 12:49
ABC only applies to TrueType fonts.
However, I think that staying with GetTextExtentPoint32 result, but using the negative tmOverhang to extend the invalidation region size may be the right way to do it. |
|||
25 Apr 2012, 12:49 |
|
LostCoder 25 Apr 2012, 12:54
Courier New is TrueType font.
|
|||
25 Apr 2012, 12:54 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.