freetype/freetype-2.9-ftsmooth.patch

102 lines
2.9 KiB
Diff
Raw Normal View History

--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -232,39 +232,13 @@
FT_UInt i, j;
unsigned int height = bitmap->rows;
- unsigned int width = bitmap->width;
+ unsigned int width = bitmap->width / 3;
int pitch = bitmap->pitch;
-
- /* Render 3 separate monochrome bitmaps, shifting the outline */
- /* by 1/3 pixel. */
- width /= 3;
-
- bitmap->buffer += width;
-
- error = render->raster_render( render->raster, &params );
- if ( error )
- goto Exit;
-
- FT_Outline_Translate( outline, -21, 0 );
- x_shift -= 21;
- bitmap->buffer += width;
-
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
- FT_Outline_Translate( outline, 42, 0 );
- x_shift += 42;
- bitmap->buffer -= 2 * width;
-
- error = render->raster_render( render->raster, &params );
- if ( error )
- goto Exit;
-
- /* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */
- /* XXX: It is more efficient to render every third byte above. */
-
if ( FT_ALLOC( temp, (FT_ULong)pitch ) )
goto Exit;
@@ -272,11 +246,7 @@
{
line = bitmap->buffer + i * (FT_ULong)pitch;
for ( j = 0; j < width; j++ )
- {
- temp[3 * j ] = line[j];
- temp[3 * j + 1] = line[j + width];
- temp[3 * j + 2] = line[j + width + width];
- }
+ temp[3 * j] = temp[3 * j + 1] = temp[3 * j + 2] = line[j];
FT_MEM_COPY( line, temp, pitch );
}
@@ -284,35 +254,23 @@
}
else if ( vmul ) /* lcd_v */
{
- int pitch = bitmap->pitch;
-
+ FT_Byte* line;
+ FT_UInt i;
+ int original_pitch = bitmap->pitch;
- /* Render 3 separate monochrome bitmaps, shifting the outline */
- /* by 1/3 pixel. Triple the pitch to render on each third row. */
bitmap->pitch *= 3;
bitmap->rows /= 3;
- bitmap->buffer += pitch;
-
- error = render->raster_render( render->raster, &params );
- if ( error )
- goto Exit;
-
- FT_Outline_Translate( outline, 0, 21 );
- y_shift += 21;
- bitmap->buffer += pitch;
-
error = render->raster_render( render->raster, &params );
if ( error )
goto Exit;
- FT_Outline_Translate( outline, 0, -42 );
- y_shift -= 42;
- bitmap->buffer -= 2 * pitch;
-
- error = render->raster_render( render->raster, &params );
- if ( error )
- goto Exit;
+ for ( i = 0; i < bitmap->rows; i++ )
+ {
+ line = bitmap->buffer + i * bitmap->pitch;
+ FT_MEM_COPY( line + original_pitch, line, bitmap->width );
+ FT_MEM_COPY( line + 2 * original_pitch, line, bitmap->width );
+ }
bitmap->pitch /= 3;
bitmap->rows *= 3;