602{
607 WORD *wcolormap_data;
608 DWORD *dwcolormap_data;
611 int depth, attribute_bitcount, attribute_type;
613
614 TRACE(
"(%p,%p)\n", iface, pIPalette);
615
616 if (!
This->colormap_length)
617 {
618 WARN(
"no colormap present in this file\n");
620 }
621
622 if (
This->header.colormap_firstentry +
This->header.colormap_length > 256)
623 {
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);
628 }
629
632
633 wcolormap_data = (
WORD*)colormap_data;
634 dwcolormap_data = (
DWORD*)colormap_data;
635
637
638 seek.QuadPart =
This->colormap_offset;
640
642 {
643 hr = IStream_Read(
This->stream, colormap_data,
This->colormap_length, &bytesread);
645 {
646 WARN(
"expected %i bytes in colormap, got %i\n",
This->colormap_length, bytesread);
648 }
649 }
650
652
654 {
656
657 if (attribute_bitcount &&
This->extension_area_offset)
658 attribute_type =
This->extension_area.attributes_type;
659 else if (attribute_bitcount)
661 else
663
666 {
669 }
670
671 memset(colors, 0,
sizeof(colors));
672
673 color = &colors[
This->header.colormap_firstentry];
674
675
677 {
678 case 16:
679 switch (attribute_type)
680 {
684 for (
i=0;
i<
This->header.colormap_length;
i++)
685 {
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);
694 }
695 break;
698 for (
i=0;
i<
This->header.colormap_length;
i++)
699 {
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);
708 }
709 break;
710 default:
711 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
713 }
714 break;
715 case 24:
716 for (
i=0;
i<
This->header.colormap_length;
i++)
717 {
718 *
color++=0xff000000 |
719 colormap_data[
i*3+2] |
720 colormap_data[
i*3+1] |
722 }
723 break;
724 case 32:
725 switch (attribute_type)
726 {
730 for (
i=0;
i<
This->header.colormap_length;
i++)
731 *
color++=dwcolormap_data[
i]|0xff000000;
732 break;
734 for (
i=0;
i<
This->header.colormap_length;
i++)
735 *
color++=dwcolormap_data[
i];
736 break;
738
739 default:
740 FIXME(
"Unhandled 16-bit attribute type %u\n", attribute_type);
742 }
743 break;
744 default:
745 FIXME(
"Unhandled truecolor depth %u\n",
This->header.depth);
747 }
748 }
749
751
753 hr = IWICPalette_InitializeCustom(pIPalette, colors, 256);
754
756}
#define HeapFree(x, y, z)
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