Skip to content

Instantly share code, notes, and snippets.

@keiya
Created November 6, 2011 13:12
Show Gist options
  • Select an option

  • Save keiya/1342857 to your computer and use it in GitHub Desktop.

Select an option

Save keiya/1342857 to your computer and use it in GitHub Desktop.
patch file of psp library graphics.c ()
--- graphics.c 2007-11-13 15:26:28.000000000 +0900
+++ graphics_modified.c 2011-11-06 22:01:43.000000000 +0900
@@ -1,8 +1,10 @@
+// modified by keiyac
+
#include <stdlib.h>
#include <malloc.h>
#include <pspdisplay.h>
#include <psputils.h>
-#include <png.h>
+#include "png.h"
#include <pspgu.h>
#include "graphics.h"
@@ -11,7 +13,9 @@
#define IS_ALPHA(color) (((color)&0xff000000)==0xff000000?0:1)
#define FRAMEBUFFER_SIZE (PSP_LINE_SIZE*SCREEN_HEIGHT*4)
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
-
+#define png_infopp_NULL NULL
+#define int_p_NULL NULL
+#define png_bytep_NULL NULL
typedef struct
{
unsigned short u, v;
@@ -96,7 +100,7 @@
png_set_strip_16(png_ptr);
png_set_packing(png_ptr);
if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr);
- if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
+ if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
image->data = (Color*) memalign(16, image->textureWidth * image->textureHeight * sizeof(Color));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment