mirror of
				https://github.com/webmproject/libwebp.git
				synced 2025-10-31 18:35:41 +01:00 
			
		
		
		
	Extend MakeARGB32() to accept Alpha channel.
Change-Id: I31b8e2d085000e2e3687a373401e4f655f11fc42
This commit is contained in:
		| @@ -28,8 +28,8 @@ static const union { | |||||||
| } test_endian = { 0xff000000u }; | } test_endian = { 0xff000000u }; | ||||||
| #define ALPHA_IS_LAST (test_endian.bytes[3] == 0xff) | #define ALPHA_IS_LAST (test_endian.bytes[3] == 0xff) | ||||||
|  |  | ||||||
| static WEBP_INLINE uint32_t MakeARGB32(int r, int g, int b) { | static WEBP_INLINE uint32_t MakeARGB32(int a, int r, int g, int b) { | ||||||
|   return (0xff000000u | (r << 16) | (g << 8) | b); |   return (((uint32_t)a << 24) | (r << 16) | (g << 8) | b); | ||||||
| } | } | ||||||
|  |  | ||||||
| //------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ | ||||||
| @@ -353,14 +353,8 @@ static int Import(WebPPicture* const picture, | |||||||
|     int x; |     int x; | ||||||
|     for (x = 0; x < width; ++x) { |     for (x = 0; x < width; ++x) { | ||||||
|       const int offset = step * x + y * rgb_stride; |       const int offset = step * x + y * rgb_stride; | ||||||
|       if (!import_alpha) { |       dst[x] = MakeARGB32(import_alpha ? a_ptr[offset] : 0xff, | ||||||
|         dst[x] = MakeARGB32(r_ptr[offset], g_ptr[offset], b_ptr[offset]); |                           r_ptr[offset], g_ptr[offset], b_ptr[offset]); | ||||||
|       } else { |  | ||||||
|         dst[x] = ((uint32_t)a_ptr[offset] << 24) | |  | ||||||
|                            (r_ptr[offset] << 16) | |  | ||||||
|                            (g_ptr[offset] <<  8) | |  | ||||||
|                            (b_ptr[offset]); |  | ||||||
|       } |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   return 1; |   return 1; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user