--- plugins/bmp/xp/ie_impGraphic_BMP.cpp.png15	2012-02-27 15:39:39.258617605 -0500
+++ plugins/bmp/xp/ie_impGraphic_BMP.cpp	2012-02-27 15:48:37.830936901 -0500
@@ -191,7 +191,14 @@ UT_Error IE_ImpGraphic_BMP::_convertGrap
 
 	/* Clean Up Memory Used */
 		
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+	int num_palette;
+	png_colorp palette;
+	png_get_PLTE(m_pPNG, m_pPNGInfo, &palette, &num_palette);
+	FREEP(palette);
+#else
 	FREEP(m_pPNGInfo->palette);
+#endif
 	DELETEP(pBB);
 	png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);
    
@@ -313,7 +320,11 @@ UT_Error IE_ImpGraphic_BMP::Initialize_P
 	 * the normal method of doing things with libpng).  REQUIRED unless you
 	 * set up your own error handlers in the png_create_read_struct() earlier.
 	 */
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+	if (setjmp(png_jmpbuf(m_pPNG)))
+#else
 	if (setjmp(m_pPNG->jmpbuf))
+#endif
 	{
 		/* Free all of the memory associated with the png_ptr and info_ptr */
 		png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);
@@ -332,7 +343,11 @@ UT_Error IE_ImpGraphic_BMP::Initialize_P
 	UT_Error IE_ImpGraphic_BMP::Convert_BMP_Pallet(UT_ByteBuf* pBB)
 	{
 		/* Reset error handling for libpng */
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+		if (setjmp(png_jmpbuf(m_pPNG)))
+#else
 		if (setjmp(m_pPNG->jmpbuf))
+#endif
 		{
 			png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);
 			return UT_ERROR;
@@ -372,7 +387,11 @@ UT_Error IE_ImpGraphic_BMP::Initialize_P
 UT_Error IE_ImpGraphic_BMP::Convert_BMP(UT_ByteBuf* pBB)
 {
 	/* Reset error handling for libpng */
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+        if (setjmp(png_jmpbuf(m_pPNG)))
+#else
 	if (setjmp(m_pPNG->jmpbuf))
+#endif
 	{
 		png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);
 		return UT_ERROR;
--- plugins/garble/xp/abiword-garble-png.cpp.png15	2012-02-27 15:31:30.178868169 -0500
+++ plugins/garble/xp/abiword-garble-png.cpp	2012-02-27 15:36:17.795368497 -0500
@@ -79,7 +79,11 @@ bool abiword_document::garble_png( void*
 		png_set_strip_alpha( png_ptr );
 		png_set_interlace_handling( png_ptr );
 		png_set_bgr( png_ptr );
+#if (PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4) && defined(PNG_EASY_ACCESS_SUPPORTED)
+		rowbytes = png_get_rowbytes( png_ptr, info_ptr );
+#else
 		rowbytes = info_ptr->rowbytes;
+#endif
 		png_destroy_read_struct( &png_ptr, &info_ptr, NULL );
 	}
 
--- src/af/util/xp/ut_png.cpp.png15	2012-02-27 15:11:18.599397989 -0500
+++ src/af/util/xp/ut_png.cpp	2012-02-27 15:12:20.560859433 -0500
@@ -71,7 +71,11 @@ bool UT_PNG_getDimensions(const UT_ByteB
 	 * the normal method of doing things with libpng).  REQUIRED unless you
 	 * set up your own error handlers in the png_create_read_struct() earlier.
 	 */
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+	if (setjmp(png_jmpbuf(png_ptr)))
+#else
 	if (setjmp(png_ptr->jmpbuf))
+#endif
 	{
 		/* Free all of the memory associated with the png_ptr and info_ptr */
 		png_destroy_read_struct(&png_ptr, &info_ptr, static_cast<png_infopp>(NULL));
--- src/wp/impexp/gtk/ie_impGraphic_GdkPixbuf.cpp.png15	2012-02-27 15:24:23.959572417 -0500
+++ src/wp/impexp/gtk/ie_impGraphic_GdkPixbuf.cpp	2012-02-27 15:26:42.549367943 -0500
@@ -185,7 +185,11 @@ UT_Error IE_ImpGraphic_GdkPixbuf::import
 /** needed for the stejmp context */
 UT_Error IE_ImpGraphic_GdkPixbuf::_png_write(GdkPixbuf * pixbuf)
 {
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+	if (setjmp(png_jmpbuf(m_pPNG)))
+#else
 	if (setjmp(m_pPNG->jmpbuf))
+#endif
 	{
 		DELETEP(m_pPngBB);
 		png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);
@@ -446,7 +450,11 @@ UT_Error IE_ImpGraphic_GdkPixbuf::Initia
 	 * the normal method of doing things with libpng).  REQUIRED unless you
 	 * set up your own error handlers in the png_create_read_struct() earlier.
 	 */
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+	if (setjmp(png_jmpbuf(m_pPNG)))
+#else
 	if (setjmp(m_pPNG->jmpbuf))
+#endif
 	{
 		/* Free all of the memory associated with the png_ptr and info_ptr */
 		png_destroy_write_struct(&m_pPNG, &m_pPNGInfo);
