瀏覽代碼

update PNG image code.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@869 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong 14 年之前
父節點
當前提交
63917c7287
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      components/rtgui/common/image_png.c

+ 13 - 0
components/rtgui/common/image_png.c

@@ -54,6 +54,19 @@ static rt_bool_t rtgui_image_png_process(png_structp png_ptr, png_infop info_ptr
 
 
     switch (info_ptr->color_type)
     switch (info_ptr->color_type)
     {
     {
+		case PNG_COLOR_TYPE_RGB:
+			for (y = 0; y < info_ptr->height; y++)
+			{
+				png_read_row(png_ptr, row, png_bytep_NULL);
+				for (x = 0; x < info_ptr->width; x++)
+				{
+					data = &(row[x * 3]);
+
+					ptr[x+y*info_ptr->width] = RTGUI_RGB(data[0], data[1], data[2]);
+				}
+			}
+			break;
+
         case PNG_COLOR_TYPE_RGBA:
         case PNG_COLOR_TYPE_RGBA:
             for (y = 0; y < info_ptr->height; y++)
             for (y = 0; y < info_ptr->height; y++)
             {
             {