[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master dab856b 04/22: * graph/grfill.c (gr_fill_hline_
From: |
Werner Lemberg |
Subject: |
[freetype2-demos] master dab856b 04/22: * graph/grfill.c (gr_fill_hline_4): Clean up. |
Date: |
Fri, 5 Mar 2021 11:18:37 -0500 (EST) |
branch: master
commit dab856bc06e529e14b854671ba834ccdb6d929af
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
* graph/grfill.c (gr_fill_hline_4): Clean up.
---
ChangeLog | 6 +++++-
graph/grfill.c | 27 +++++++++++----------------
2 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b96fb5a..fb1dc40 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,12 @@
+2021-01-17 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ * graph/grfill.c (gr_fill_hline_4): Clean up.
+
2021-01-15 Alexei Podtelezhnikov <apodtele@gmail.com>
[graph] Implement much faster vertical grid lines.
- * graph/gbfill.c (gr_fill_hline_*): Accept pitch increment as
+ * graph/grfill.c (gr_fill_hline_*): Accept pitch increment as
additional argument and act accordingly.
(grFillVLine, grFillHLine, grFillRect): Updated all callers.
diff --git a/graph/grfill.c b/graph/grfill.c
index 7b69b23..91fa070 100644
--- a/graph/grfill.c
+++ b/graph/grfill.c
@@ -61,33 +61,28 @@ gr_fill_hline_4( unsigned char* line,
grColor color )
{
int col = color.value | (color.value << 4);
+ int height;
line += (x >> 1);
if ( incr & ~3 ) /* vertical */
{
- if ( x & 1 )
- for ( ; width > 0; width--, line += incr )
- line[0] = (unsigned char)((line[0] & 0xF0) | (col & 0x0F));
- else
- for ( ; width > 0; width--, line += incr )
- line[0] = (unsigned char)((line[0] & 0x0F) | (col & 0xF0));
+ height = width;
+ width = 1;
}
else /* horizontal */
- {
- if ( x & 1 )
- {
+ height = 1;
+
+ if ( x & 1 )
+ for ( ; height > 0; height--, width--, line += incr )
line[0] = (unsigned char)((line[0] & 0xF0) | (col & 0x0F));
- line++;
- width--;
- }
- for ( ; width >= 2; width -= 2, line ++ )
- line[0] = (unsigned char)col;
+ for ( ; width > 1; width -= 2, line++ )
+ line[0] = (unsigned char)col;
- if ( width > 0 )
+ if ( width > 0 )
+ for ( ; height > 0; height--, line += incr )
line[0] = (unsigned char)((line[0] & 0x0F) | (col & 0xF0));
- }
}
static void
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master dab856b 04/22: * graph/grfill.c (gr_fill_hline_4): Clean up.,
Werner Lemberg <=