607 WORD *wcolormap_data;
608 DWORD *dwcolormap_data;
611 int depth, attribute_bitcount, attribute_type;
614 TRACE(
"(%p,%p)\n", iface, pIPalette);
616 if (!
This->colormap_length)
618 WARN(
"no colormap present in this file\n");
622 if (
This->header.colormap_firstentry +
This->header.colormap_length > 256)
624 FIXME(
"cannot read colormap with %i entries starting at %i\n",
625 This->header.colormap_firstentry +
This->header.colormap_length,
626 This->header.colormap_firstentry);
633 wcolormap_data = (
WORD*)colormap_data;
634 dwcolormap_data = (
DWORD*)colormap_data;
638 seek.QuadPart =
This->colormap_offset;
643 hr = IStream_Read(
This->stream, colormap_data,
This->colormap_length, &bytesread);
646 WARN(
"expected %i bytes in colormap, got %i\n",
This->colormap_length, bytesread);
657 if (attribute_bitcount &&
This->extension_area_offset)
658 attribute_type =
This->extension_area.attributes_type;
659 else if (attribute_bitcount)
671 memset(colors, 0,
sizeof(colors));
673 color = &colors[
This->header.colormap_firstentry];
679 switch (attribute_type)
684 for (
i=0;
i<
This->header.colormap_length;
i++)
686 WORD srcval = wcolormap_data[
i];
687 *
color++=0xff000000 |
688 ((srcval << 9) & 0xf80000) |
689 ((srcval << 4) & 0x070000) |
690 ((srcval << 6) & 0x00f800) |
691 ((srcval << 1) & 0x000700) |
692 ((srcval << 3) & 0x0000f8) |
693 ((srcval >> 2) & 0x000007);
698 for (
i=0;
i<
This->header.colormap_length;
i++)
700 WORD srcval = wcolormap_data[
i];
701 *
color++=((srcval & 0x8000) ? 0xff000000 : 0) |
702 ((srcval << 9) & 0xf80000) |
703 ((srcval << 4) & 0x070000) |
704 ((srcval << 6) & 0x00f800) |
705 ((srcval << 1) & 0x000700) |
706 ((srcval << 3) & 0x0000f8) |
707 ((srcval >> 2) & 0x000007);
711 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
716 for (
i=0;
i<
This->header.colormap_length;
i++)
718 *
color++=0xff000000 |
719 colormap_data[
i*3+2] |
720 colormap_data[
i*3+1] |
725 switch (attribute_type)
730 for (
i=0;
i<
This->header.colormap_length;
i++)
731 *
color++=dwcolormap_data[
i]|0xff000000;
734 for (
i=0;
i<
This->header.colormap_length;
i++)
735 *
color++=dwcolormap_data[
i];
740 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
745 FIXME(
"Unhandled truecolor depth %u\n",
This->header.depth);
753 hr = IWICPalette_InitializeCustom(pIPalette, colors, 256);
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define WINCODEC_ERR_PALETTEUNAVAILABLE
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int seek(void *fd, ulong off, int mode)
GLint GLint GLsizei GLsizei GLsizei depth
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)