aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/base/ftbitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'freetype/src/base/ftbitmap.c')
-rw-r--r--freetype/src/base/ftbitmap.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/freetype/src/base/ftbitmap.c b/freetype/src/base/ftbitmap.c
index 50ef269bf..3425c368f 100644
--- a/freetype/src/base/ftbitmap.c
+++ b/freetype/src/base/ftbitmap.c
@@ -4,7 +4,7 @@
/* */
/* FreeType utility functions for bitmaps (body). */
/* */
-/* Copyright 2004-2009, 2011, 2013 by */
+/* Copyright 2004-2009, 2011, 2013, 2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -375,7 +375,7 @@
}
- FT_Byte
+ static FT_Byte
ft_gray_for_premultiplied_srgb_bgra( const FT_Byte* bgra )
{
FT_Long a = bgra[3];
@@ -385,6 +385,10 @@
FT_Long l;
+ /* Short-circuit transparent color to avoid div-by-zero. */
+ if ( !a )
+ return 0;
+
/*
* Luminosity for sRGB is defined using ~0.2126,0.7152,0.0722
* coefficients for RGB channels *on the linear colors*.