598{
603 WORD *wcolormap_data;
604 DWORD *dwcolormap_data;
607 int depth, attribute_bitcount, attribute_type;
609
610 TRACE(
"(%p,%p)\n", iface, pIPalette);
611
612 if (!
This->colormap_length)
613 {
614 WARN(
"no colormap present in this file\n");
616 }
617
618 if (
This->header.colormap_firstentry +
This->header.colormap_length > 256)
619 {
620 FIXME(
"cannot read colormap with %i entries starting at %i\n",
621 This->header.colormap_firstentry +
This->header.colormap_length,
622 This->header.colormap_firstentry);
624 }
625
626 colormap_data =
malloc(
This->colormap_length);
628
629 wcolormap_data = (
WORD*)colormap_data;
630 dwcolormap_data = (
DWORD*)colormap_data;
631
633
634 seek.QuadPart =
This->colormap_offset;
636
638 {
639 hr = IStream_Read(
This->stream, colormap_data,
This->colormap_length, &bytesread);
641 {
642 WARN(
"expected %li bytes in colormap, got %li\n",
This->colormap_length, bytesread);
644 }
645 }
646
648
650 {
652
653 if (attribute_bitcount &&
This->extension_area_offset)
654 attribute_type =
This->extension_area.attributes_type;
655 else if (attribute_bitcount)
657 else
659
662 {
665 }
666
667 memset(colors, 0,
sizeof(colors));
668
669 color = &colors[
This->header.colormap_firstentry];
670
671
673 {
674 case 16:
675 switch (attribute_type)
676 {
680 for (
i=0;
i<
This->header.colormap_length;
i++)
681 {
682 WORD srcval = wcolormap_data[
i];
683 *
color++=0xff000000 |
684 ((srcval << 9) & 0xf80000) |
685 ((srcval << 4) & 0x070000) |
686 ((srcval << 6) & 0x00f800) |
687 ((srcval << 1) & 0x000700) |
688 ((srcval << 3) & 0x0000f8) |
689 ((srcval >> 2) & 0x000007);
690 }
691 break;
694 for (
i=0;
i<
This->header.colormap_length;
i++)
695 {
696 WORD srcval = wcolormap_data[
i];
697 *
color++=((srcval & 0x8000) ? 0xff000000 : 0) |
698 ((srcval << 9) & 0xf80000) |
699 ((srcval << 4) & 0x070000) |
700 ((srcval << 6) & 0x00f800) |
701 ((srcval << 1) & 0x000700) |
702 ((srcval << 3) & 0x0000f8) |
703 ((srcval >> 2) & 0x000007);
704 }
705 break;
706 default:
707 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
709 }
710 break;
711 case 24:
712 for (
i=0;
i<
This->header.colormap_length;
i++)
713 {
714 *
color++=0xff000000 |
715 colormap_data[
i*3+2] |
716 colormap_data[
i*3+1] |
718 }
719 break;
720 case 32:
721 switch (attribute_type)
722 {
726 for (
i=0;
i<
This->header.colormap_length;
i++)
727 *
color++=dwcolormap_data[
i]|0xff000000;
728 break;
730 for (
i=0;
i<
This->header.colormap_length;
i++)
731 *
color++=dwcolormap_data[
i];
732 break;
734
735 default:
736 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
738 }
739 break;
740 default:
741 FIXME(
"Unhandled truecolor depth %u\n",
This->header.depth);
743 }
744 }
745
747
749 hr = IWICPalette_InitializeCustom(pIPalette, colors, 256);
750
752}
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
int seek(void *fd, ulong off, int mode)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define WINCODEC_ERR_PALETTEUNAVAILABLE