[smooth, raster] Remove synonymous error macros.

* src/smooth/ftgays.c [STANDALONE_]: s/ErrRaster_/Smooth_Err_/.
(gray_convert_glyph_inner): Updated accordingly.

* src/raster/ftraster.c [STANDALONE_]: Do not abbreviate error macros.
(New_Profile, End_Profile, Insert_Y_Turn, Line_Up, Bezier_Up,
Decompose_Curve, Draw_Sweep, Render_Single_Pass, ft_black_render):
Updated accordingly.
This commit is contained in:
Alexei Podtelezhnikov 2021-06-23 23:32:02 -04:00
parent 1e65e6051a
commit d8ac180c88
3 changed files with 59 additions and 59 deletions

View File

@ -1,4 +1,16 @@
2021-07-22 Dominik Röttsches <drott@chromium.org>
2021-06-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth, raster] Remove synonymous error macros.
* src/smooth/ftgays.c [STANDALONE_]: s/ErrRaster_/Smooth_Err_/.
(gray_convert_glyph_inner): Updated accordingly.
* src/raster/ftraster.c [STANDALONE_]: Do not abbreviate error macros.
(New_Profile, End_Profile, Insert_Y_Turn, Line_Up, Bezier_Up,
Decompose_Curve, Draw_Sweep, Render_Single_Pass, ft_black_render):
Updated accordingly.
2021-06-22 Dominik Röttsches <drott@chromium.org>
[sfnt] s/PaintTransformed/PaintTransform/, s/transformed/transform/.
@ -8,7 +20,7 @@
* src/sfnt/ttcolr.c (read_paint, tt_face_get_paint): Ditto.
2021-07-22 Dominik Röttsches <drott@chromium.org>
2021-06-22 Dominik Röttsches <drott@chromium.org>
Move 'COLR' API to `ftcolor.h`.

View File

@ -200,12 +200,13 @@
#define FT_THROW( e ) FT_ERR_CAT( Raster_Err_, e )
#endif
#define Raster_Err_None 0
#define Raster_Err_Not_Ini -1
#define Raster_Err_Overflow -2
#define Raster_Err_Neg_Height -3
#define Raster_Err_Invalid -4
#define Raster_Err_Unsupported -5
#define Raster_Err_Ok 0
#define Raster_Err_Invalid_Outline -1
#define Raster_Err_Cannot_Render_Glyph -2
#define Raster_Err_Invalid_Argument -3
#define Raster_Err_Raster_Overflow -4
#define Raster_Err_Raster_Uninitialized -5
#define Raster_Err_Raster_Negative_Height -6
#define ft_memset memset
@ -230,13 +231,6 @@
#include "rasterrs.h"
#define Raster_Err_None FT_Err_Ok
#define Raster_Err_Not_Ini Raster_Err_Raster_Uninitialized
#define Raster_Err_Overflow Raster_Err_Raster_Overflow
#define Raster_Err_Neg_Height Raster_Err_Raster_Negative_Height
#define Raster_Err_Invalid Raster_Err_Invalid_Outline
#define Raster_Err_Unsupported Raster_Err_Cannot_Render_Glyph
#endif /* !STANDALONE_ */
@ -660,7 +654,7 @@
if ( ras.top >= ras.maxBuff )
{
ras.error = FT_THROW( Overflow );
ras.error = FT_THROW( Raster_Overflow );
return FAILURE;
}
@ -689,7 +683,7 @@
default:
FT_ERROR(( "New_Profile: invalid profile direction\n" ));
ras.error = FT_THROW( Invalid );
ras.error = FT_THROW( Invalid_Outline );
return FAILURE;
}
@ -731,7 +725,7 @@
if ( h < 0 )
{
FT_ERROR(( "End_Profile: negative height encountered\n" ));
ras.error = FT_THROW( Neg_Height );
ras.error = FT_THROW( Raster_Negative_Height );
return FAILURE;
}
@ -767,7 +761,7 @@
if ( ras.top >= ras.maxBuff )
{
FT_TRACE1(( "overflow in End_Profile\n" ));
ras.error = FT_THROW( Overflow );
ras.error = FT_THROW( Raster_Overflow );
return FAILURE;
}
@ -822,7 +816,7 @@
ras.maxBuff--;
if ( ras.maxBuff <= ras.top )
{
ras.error = FT_THROW( Overflow );
ras.error = FT_THROW( Raster_Overflow );
return FAILURE;
}
ras.numTurns++;
@ -1086,7 +1080,7 @@
size = e2 - e1 + 1;
if ( ras.top + size >= ras.maxBuff )
{
ras.error = FT_THROW( Overflow );
ras.error = FT_THROW( Raster_Overflow );
return FAILURE;
}
@ -1271,7 +1265,7 @@
if ( ( top + TRUNC( e2 - e ) + 1 ) >= ras.maxBuff )
{
ras.top = top;
ras.error = FT_THROW( Overflow );
ras.error = FT_THROW( Raster_Overflow );
return FAILURE;
}
@ -1967,7 +1961,7 @@
return SUCCESS;
Invalid_Outline:
ras.error = FT_THROW( Invalid );
ras.error = FT_THROW( Invalid_Outline );
Fail:
return FAILURE;
@ -2744,7 +2738,7 @@
/* check the Y-turns */
if ( ras.numTurns == 0 )
{
ras.error = FT_THROW( Invalid );
ras.error = FT_THROW( Invalid_Outline );
return FAILURE;
}
@ -3051,14 +3045,14 @@
ras.top = ras.buff;
ras.error = Raster_Err_None;
ras.error = Raster_Err_Ok;
if ( Convert_Glyph( RAS_VARS flipped ) )
{
if ( ras.error != Raster_Err_Overflow )
if ( ras.error != Raster_Err_Raster_Overflow )
return FAILURE;
ras.error = Raster_Err_None;
ras.error = Raster_Err_Ok;
/* sub-banding */
@ -3074,7 +3068,7 @@
if ( ras.band_top >= 7 || k < i )
{
ras.band_top = 0;
ras.error = FT_THROW( Invalid );
ras.error = FT_THROW( Invalid_Outline );
return ras.error;
}
@ -3174,7 +3168,7 @@
return error;
}
return Raster_Err_None;
return Raster_Err_Ok;
}
@ -3292,38 +3286,36 @@
if ( !raster )
return FT_THROW( Not_Ini );
return FT_THROW( Raster_Uninitialized );
if ( !outline )
return FT_THROW( Invalid );
return FT_THROW( Invalid_Outline );
/* return immediately if the outline is empty */
if ( outline->n_points == 0 || outline->n_contours <= 0 )
return Raster_Err_None;
return Raster_Err_Ok;
if ( !outline->contours || !outline->points )
return FT_THROW( Invalid );
return FT_THROW( Invalid_Outline );
if ( outline->n_points !=
outline->contours[outline->n_contours - 1] + 1 )
return FT_THROW( Invalid );
return FT_THROW( Invalid_Outline );
/* this version of the raster does not support direct rendering, sorry */
if ( params->flags & FT_RASTER_FLAG_DIRECT )
return FT_THROW( Unsupported );
if ( params->flags & FT_RASTER_FLAG_AA )
return FT_THROW( Unsupported );
if ( params->flags & FT_RASTER_FLAG_DIRECT ||
params->flags & FT_RASTER_FLAG_AA )
return FT_THROW( Cannot_Render_Glyph );
if ( !target_map )
return FT_THROW( Invalid );
return FT_THROW( Invalid_Argument );
/* nothing to do */
if ( !target_map->width || !target_map->rows )
return Raster_Err_None;
return Raster_Err_Ok;
if ( !target_map->buffer )
return FT_THROW( Invalid );
return FT_THROW( Invalid_Argument );
ras.outline = *outline;
ras.target = *target_map;

View File

@ -168,10 +168,10 @@
typedef ptrdiff_t FT_PtrDist;
#define ErrRaster_Invalid_Mode -2
#define ErrRaster_Invalid_Outline -1
#define ErrRaster_Invalid_Argument -3
#define ErrRaster_Memory_Overflow -4
#define Smooth_Err_Invalid_Outline -1
#define Smooth_Err_Cannot_Render_Glyph -2
#define Smooth_Err_Invalid_Argument -3
#define Smooth_Err_Out_Of_Memory -4
#define FT_BEGIN_HEADER
#define FT_END_HEADER
@ -229,18 +229,18 @@ typedef ptrdiff_t FT_PtrDist;
#define FT_ERROR( varformat ) FT_Message varformat
#endif
#define FT_THROW( e ) \
( FT_Throw( FT_ERR_CAT( ErrRaster_, e ), \
__LINE__, \
__FILE__ ) | \
FT_ERR_CAT( ErrRaster_, e ) )
#define FT_THROW( e ) \
( FT_Throw( FT_ERR_CAT( Smooth_Err_, e ), \
__LINE__, \
__FILE__ ) | \
FT_ERR_CAT( Smooth_Err_, e ) )
#else /* !FT_DEBUG_LEVEL_TRACE */
#define FT_TRACE5( x ) do { } while ( 0 ) /* nothing */
#define FT_TRACE7( x ) do { } while ( 0 ) /* nothing */
#define FT_ERROR( x ) do { } while ( 0 ) /* nothing */
#define FT_THROW( e ) FT_ERR_CAT( ErrRaster_, e )
#define FT_THROW( e ) FT_ERR_CAT( Smooth_Err_, e )
#endif /* !FT_DEBUG_LEVEL_TRACE */
@ -286,10 +286,6 @@ typedef ptrdiff_t FT_PtrDist;
#include "ftsmerrs.h"
#define Smooth_Err_Invalid_Mode Smooth_Err_Cannot_Render_Glyph
#define Smooth_Err_Memory_Overflow Smooth_Err_Out_Of_Memory
#define ErrRaster_Memory_Overflow Smooth_Err_Out_Of_Memory
#endif /* !STANDALONE_ */
@ -1654,7 +1650,7 @@ typedef ptrdiff_t FT_PtrDist;
}
else
{
error = FT_THROW( Memory_Overflow );
error = FT_THROW( Out_Of_Memory );
FT_TRACE7(( "band [%d..%d]: to be bisected\n",
ras.min_ey, ras.max_ey ));
@ -1730,7 +1726,7 @@ typedef ptrdiff_t FT_PtrDist;
band--;
continue;
}
else if ( error != ErrRaster_Memory_Overflow )
else if ( error != Smooth_Err_Out_Of_Memory )
return 1;
/* render pool overflow; we will reduce the render band by half */
@ -1770,7 +1766,7 @@ typedef ptrdiff_t FT_PtrDist;
/* this version does not support monochrome rendering */
if ( !( params->flags & FT_RASTER_FLAG_AA ) )
return FT_THROW( Invalid_Mode );
return FT_THROW( Cannot_Render_Glyph );
if ( !outline )
return FT_THROW( Invalid_Outline );