From 37d15e2204fd54d0938e463436857117eff4e768 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Tue, 25 Jan 2011 18:48:26 +0000 Subject: Fixing bitmap functions to return BYTES and not bits per pixel for bitmap_get_bpp svn path=/trunk/netsurf/; revision=11487 --- cocoa/bitmap.m | 4 ++-- cocoa/thumbnail.m | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cocoa/bitmap.m b/cocoa/bitmap.m index eb791c46e..eb95c7c10 100644 --- a/cocoa/bitmap.m +++ b/cocoa/bitmap.m @@ -95,7 +95,7 @@ void bitmap_set_opaque(void *bitmap, bool opaque) bool bitmap_test_opaque(void *bitmap) { - NSCParameterAssert( bitmap_get_bpp( bitmap ) == BITS_PER_PIXEL ); + NSCParameterAssert( bitmap_get_bpp( bitmap ) == BYTES_PER_PIXEL ); unsigned char *buf = bitmap_get_buffer( bitmap ); @@ -133,7 +133,7 @@ size_t bitmap_get_bpp(void *bitmap) { NSCParameterAssert( NULL != bitmap ); NSBitmapImageRep *bmp = (NSBitmapImageRep *)bitmap; - return [bmp bitsPerPixel]; + return [bmp bitsPerPixel] / 8; } bool bitmap_save(void *bitmap, const char *path, unsigned flags) diff --git a/cocoa/thumbnail.m b/cocoa/thumbnail.m index b6df608eb..290009e1e 100644 --- a/cocoa/thumbnail.m +++ b/cocoa/thumbnail.m @@ -30,7 +30,7 @@ bool thumbnail_create(struct hlcache_handle *content, struct bitmap *bitmap, CGColorSpaceRef cspace = CGColorSpaceCreateWithName( kCGColorSpaceGenericRGB ); CGContextRef bitmapContext = CGBitmapContextCreate( bitmap_get_buffer( bitmap ), bitmap_get_width( bitmap ), bitmap_get_height( bitmap ), - bitmap_get_bpp( bitmap ) / 4, + bitmap_get_bpp( bitmap ) * 8 / 4, bitmap_get_rowstride( bitmap ), cspace, kCGImageAlphaNoneSkipLast ); CGColorSpaceRelease( cspace ); -- cgit v1.2.3