* Source/OpalGraphics/CGContext.m: Protect against incorrect dash count.

* Source/OpalGraphics/cairo/CairoFontX11.m: Correct sign of descender.
	* Source/OpalGraphics/image/OPImageCodecPNG.m: Prepare for newer
	libpng versions.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/opal/trunk@40296 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2017-01-18 22:52:41 +00:00
parent 958114ee06
commit 693c3613f5
4 changed files with 24 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2017-01-18 Fred Kiefer <FredKiefer@gmx.de>
* Source/OpalGraphics/CGContext.m: Protect against incorrect dash count.
* Source/OpalGraphics/cairo/CairoFontX11.m: Correct sign of descender.
* Source/OpalGraphics/image/OPImageCodecPNG.m: Prepare for newer
libpng versions.
2016-06-19 Fred Kiefer <FredKiefer@gmx.de>
* Source/GNUmakefile

View File

@ -412,12 +412,19 @@ void CGContextSetLineDash(
size_t count)
{
OPLOGCALL("ctx /*%p*/, %g, <lengths>, %d", ctx, phase, count)
if (!lengths && count != 0)
{
NSLog(@"%s: null 'lengths' passed with count %d. Fixing by setting count to 0.", lengths, (int)count);
count = 0;
}
double dashes[count]; /* C99 allows this */
size_t i;
for (i=0; i<count; i++)
dashes[i] = lengths[i];
{
dashes[i] = lengths[i];
}
cairo_set_dash(ctx->ct, dashes, count, phase);
OPRESTORELOGGING()
@ -426,13 +433,13 @@ void CGContextSetLineDash(
void CGContextSetFlatness(CGContextRef ctx, CGFloat flatness)
{
OPLOGCALL("ctx /*%p*/, %g", ctx, flatness)
cairo_set_tolerance(ctx->ct, flatness);
cairo_set_tolerance(ctx->ct, flatness / 2);
OPRESTORELOGGING()
}
CGInterpolationQuality CGContextGetInterpolationQuality(CGContextRef ctx)
{
return 0;
return 0;
}
void CGContextSetInterpolationQuality(

View File

@ -305,8 +305,8 @@ static FcPattern *opal_FcPatternCacheLookup(const char *name)
- (int) descent;
{
FT_Face ft_face = cairo_ft_scaled_font_lock_face(self->cairofont);
int result = ft_face->descender;
int result = -ft_face->descender;
cairo_ft_scaled_font_unlock_face(self->cairofont);
return result;
}
@ -366,7 +366,7 @@ static FcPattern *opal_FcPatternCacheLookup(const char *name)
// see http://www.typophile.com/node/13081
int result = ft_face->height - ft_face->ascender +
ft_face->descender;
cairo_ft_scaled_font_unlock_face(self->cairofont);
return result;
}

View File

@ -406,7 +406,11 @@ static bool opal_has_png_header(CGDataProviderRef dp)
const CGColorSpaceRef dstColorSpace = [CGColorSpaceCreateDeviceRGB() autorelease];
// init structures
#if PNG_LIBPNG_VER < 10500
// I don't think this was ever needed as png_create_info_struct()
// sets up the structure correctly and we rely on that in all other places.
png_info_init_3(&png_info, png_sizeof(png_info));
#endif
png_set_write_fn(png_struct, dc, opal_png_writer_func, NULL);
png_set_IHDR(png_struct, png_info, srcWidth, srcHeight, 8,
PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,