diff --git a/ChangeLog b/ChangeLog index 38eb21b2d..c3cb03aef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2016-08-29 Alexei Podtelezhnikov + + [smooth] Streamline pixmap drawing. + + This gives 2% speed improvement in rendering simple glyphs. + + * src/smooth/ftgrays.c (TPixmap): Reduced pixmap descriptor with a + pointer to its bottom-left and pitch to be used in... + (gray_TWorker): ... here. + (gray_render_span): Move pixmap flow check from here... + (gray_raster_render): .. to here. + 2016-08-27 Alexei Podtelezhnikov [smooth] Reduce stack of band boundaries. diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 296daa49d..814749bb0 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -403,6 +403,12 @@ typedef ptrdiff_t FT_PtrDist; } TCell; + typedef struct TPixmap_ + { + unsigned char* origin; /* pixmap origin at the bottom-left */ + int pitch; /* pitch to go down one row */ + + } TPixmap; /* maximum number of gray cells in the buffer */ #if FT_RENDER_POOL_SIZE > 2048 @@ -440,7 +446,7 @@ typedef ptrdiff_t FT_PtrDist; TPos x, y; FT_Outline outline; - FT_Bitmap target; + TPixmap target; FT_Raster_Span_Func render_span; void* render_span_data; @@ -1270,15 +1276,9 @@ typedef ptrdiff_t FT_PtrDist; const FT_Span* spans, gray_PWorker worker ) { - unsigned char* p; - FT_Bitmap* map = &worker->target; + unsigned char* p = worker->target.origin - y * worker->target.pitch; - /* first of all, compute the scanline offset */ - p = (unsigned char*)map->buffer - y * map->pitch; - if ( map->pitch >= 0 ) - p += ( map->rows - 1 ) * (unsigned int)map->pitch; - for ( ; count > 0; count--, spans++ ) { unsigned char coverage = spans->coverage; @@ -1962,7 +1962,14 @@ typedef ptrdiff_t FT_PtrDist; if ( !target_map->buffer ) return FT_THROW( Invalid_Argument ); - ras.target = *target_map; + if ( target_map->pitch < 0 ) + ras.target.origin = target_map->buffer; + else + ras.target.origin = target_map->buffer + + ( target_map->rows - 1 ) * (unsigned int)target_map->pitch; + + ras.target.pitch = target_map->pitch; + ras.render_span = (FT_Raster_Span_Func)gray_render_span; ras.render_span_data = &ras; }