summaryrefslogtreecommitdiff
path: root/riscos/png.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2004-04-04 03:14:03 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2004-04-04 03:14:03 +0000
commitb43eb4f93367b1d4402f8578d190948e230cd8bd (patch)
treeb33c8166460101e04a20c5aefbad12ed9dd85539 /riscos/png.c
parent2f2cfbfe1632cde97c7f58e7117b74c3361e9a69 (diff)
downloadnetsurf-b43eb4f93367b1d4402f8578d190948e230cd8bd.tar.gz
netsurf-b43eb4f93367b1d4402f8578d190948e230cd8bd.tar.bz2
[project @ 2004-04-04 03:14:03 by jmb]
Take account of gAMA chunk svn path=/import/netsurf/; revision=717
Diffstat (limited to 'riscos/png.c')
-rw-r--r--riscos/png.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/riscos/png.c b/riscos/png.c
index fa57c2e9f..e6e6c3019 100644
--- a/riscos/png.c
+++ b/riscos/png.c
@@ -79,7 +79,8 @@ void nspng_process_data(struct content *c, char *data, unsigned long size)
void info_callback(png_structp png, png_infop info)
{
- int bit_depth, color_type, interlace;
+ int bit_depth, color_type, interlace, intent;
+ double gamma;
unsigned int rowbytes, sprite_size;
unsigned long width, height;
struct content *c = png_get_progressive_ptr(png);
@@ -134,6 +135,19 @@ void info_callback(png_structp png, png_infop info)
png_set_gray_to_rgb(png);
if (!(color_type & PNG_COLOR_MASK_ALPHA))
png_set_filler(png, 0xff, PNG_FILLER_AFTER);
+ /* gamma correction - we use 2.2 as our screen gamma
+ * this appears to be correct (at least in respect to !Browse)
+ * see http://www.w3.org/Graphics/PNG/all_seven.html for a test case
+ */
+ if (png_get_sRGB(png, info, &intent))
+ png_set_gamma(png, 2.2, 0.45455);
+ else {
+ if (png_get_gAMA(png, info, &gamma))
+ png_set_gamma(png, 2.2, gamma);
+ else
+ png_set_gamma(png, 2.2, 0.45455);
+ }
+
png_read_update_info(png, info);