summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qgrayraster.c
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-11-18 12:06:41 +0100
committerSamuel Rødal <samuel.rodal@nokia.com>2010-11-18 13:48:48 +0100
commit7eb560609cf1fc82f897a9a67c76e42b06823f9b (patch)
tree1312637c076b5c7f1f88cc3de6233720025c8186 /src/gui/painting/qgrayraster.c
parent77218177d44bb120e4cb558cadeadc0bcf6c3cab (diff)
Some optimizations for the gray-raster (raster engine antialiasing).
Increase the size of the initial memory pool (it's anyways free'd later on) to improve the performance of the rasterizer and also decrease the chance of re-allocations. Also, by combining gray_record_cell and gray_find_cell into one function, as gray_find_cell is only called from the former, we can skip some unnecessary operations. Measured performance improvements range from 58 % to 154 % for rounded rect filling and stroking. Reviewed-by: Andreas Kling
Diffstat (limited to 'src/gui/painting/qgrayraster.c')
-rw-r--r--src/gui/painting/qgrayraster.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index ec9ebeb71f..536f265f14 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -408,25 +408,31 @@
/* */
/* Record the current cell in the table. */
/* */
- static PCell
- gray_find_cell( RAS_ARG )
+ static void
+ gray_record_cell( RAS_ARG )
{
PCell *pcell, cell;
int x = ras.ex;
+ if ( ras.invalid || !( ras.area | ras.cover ) )
+ return;
if ( x > ras.max_ex )
x = ras.max_ex;
pcell = &ras.ycells[ras.ey];
+
for (;;)
{
cell = *pcell;
if ( cell == NULL || cell->x > x )
break;
- if ( cell->x == x )
- goto Exit;
+ if ( cell->x == x ) {
+ cell->area += ras.area;
+ cell->cover += ras.cover;
+ return;
+ }
pcell = &cell->next;
}
@@ -436,28 +442,11 @@
cell = ras.cells + ras.num_cells++;
cell->x = x;
- cell->area = 0;
- cell->cover = 0;
+ cell->area = ras.area;
+ cell->cover = ras.cover;
cell->next = *pcell;
*pcell = cell;
-
- Exit:
- return cell;
- }
-
-
- static void
- gray_record_cell( RAS_ARG )
- {
- if ( !ras.invalid && ( ras.area | ras.cover ) )
- {
- PCell cell = gray_find_cell( RAS_VAR );
-
-
- cell->area += ras.area;
- cell->cover += ras.cover;
- }
}