From 7c4ac3cb0c3defe453009503d2a85026227bad55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9=20=D0=9F=D0=BE?= =?UTF-8?q?=D0=B4=D1=82=D0=B5=D0=BB=D0=B5=D0=B6=D0=BD=D0=B8=D0=BA=D0=BE?= =?UTF-8?q?=D0=B2?= Date: Sun, 28 Nov 2010 08:23:40 +0100 Subject: [PATCH] [ftsmooth]: Minor code simplification. * src/smooth/ftgrays (gray_render_cubic): Do only one comparison instead of two. --- ChangeLog | 7 +++++++ src/smooth/ftgrays.c | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f81527da9..8a3968d43 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-11-28 Alexei Podtelezhnikov + + [ftsmooth]: Minor code simplification. + + * src/smooth/ftgrays (gray_render_cubic): Do only one comparison + instead of two. + 2010-11-26 Johnson Y. Yan [truetype] Better multi-threading support. diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 8f93392fb..a85e16086 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -1057,7 +1057,13 @@ typedef ptrdiff_t FT_PtrDist; dx_ = FT_ABS( dx ); dy_ = FT_ABS( dy ); - L = ( 236 * FT_MAX( dx_, dy_ ) + 97 * FT_MIN( dx_, dy_ ) ) >> 8; + + /* This is the same as */ + /* */ + /* L = ( 236 * FT_MAX( dx_, dy_ ) */ + /* + 97 * FT_MIN( dx_, dy_ ) ) >> 8; */ + L = ( dx_ > dy_ ? 236 * dx_ + 97 * dy_ + : 97 * dx_ + 236 * dy_ ) >> 8; /* Avoid possible arithmetic overflow below by splitting. */ if ( L > 32767 )