openbsd-ports/x11/qt3/patches/patch-src_kernel_qpngio_cpp
espie a30e3ddd6c regen patches.
handle utf8 encoding better.
2007-03-31 22:49:46 +00:00

26 lines
1.0 KiB
Plaintext

$OpenBSD: patch-src_kernel_qpngio_cpp,v 1.2 2007/03/31 22:49:46 espie Exp $
--- src/kernel/qpngio.cpp.orig Thu Oct 19 16:25:20 2006
+++ src/kernel/qpngio.cpp Sat Mar 31 14:51:24 2007
@@ -110,10 +110,18 @@ void CALLBACK_CALL_TYPE qpiw_flush_fn( png_structp png
static
void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr, float screen_gamma=0.0 )
{
- if ( screen_gamma != 0.0 && png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA) ) {
+ if ( 0.0 == screen_gamma )
+ // PNG docs say this is a good guess for a PC monitor
+ // in a dark room
+ screen_gamma = 2.2;
+ if ( png_get_valid(png_ptr, info_ptr, PNG_INFO_gAMA) ) {
+ // the file has a gAMA attribute
double file_gamma;
- png_get_gAMA(png_ptr, info_ptr, &file_gamma);
- png_set_gamma( png_ptr, screen_gamma, file_gamma );
+ if ( png_get_gAMA(png_ptr, info_ptr, &file_gamma))
+ png_set_gamma( png_ptr, screen_gamma, file_gamma );
+ } else {
+ // no file gamma, use a reasonable default
+ png_set_gamma( png_ptr, screen_gamma, 0.45455 );
}
png_uint_32 width;