소스 검색

win32: shuffle bytes in GDI images to match what OpenGL supports.

legacy
Sam Hocevar sam 13 년 전
부모
커밋
d539f3b80c
1개의 변경된 파일14개의 추가작업 그리고 0개의 파일을 삭제
  1. +14
    -0
      src/image/codec/gdiplus-image.cpp

+ 14
- 0
src/image/codec/gdiplus-image.cpp 파일 보기

@@ -95,6 +95,20 @@ bool GdiPlusImageData::Open(char const *path)
return false;
}

/* FIXME: GDI+ doesn't know about RGBA, only ARGB. And OpenGL doesn't
* know about ARGB, only RGBA. So we swap bytes. We could also fix
* this in the shader. */
uint8_t *p = static_cast<uint8_t *>(bdata.Scan0);
for (int y = 0; y < size.y; y++)
for (int x = 0; x < size.x; x++)
{
uint8_t tmp = p[0];
*p++ = p[1];
*p++ = p[1];
*p++ = p[1];
*p++ = tmp;
}

return true;
}



||||||
x
 
000:0
불러오는 중...
취소
저장