CColorConverter.cpp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #include "CColorConverter.h"
  5. #include "SColor.h"
  6. #include "os.h"
  7. #include "irrString.h"
  8. namespace irr
  9. {
  10. namespace video
  11. {
  12. //! converts a monochrome bitmap to A1R5G5B5 data
  13. void CColorConverter::convert1BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, s32 linepad, bool flip)
  14. {
  15. if (!in || !out)
  16. return;
  17. if (flip)
  18. out += width * height;
  19. for (s32 y=0; y<height; ++y)
  20. {
  21. s32 shift = 7;
  22. if (flip)
  23. out -= width;
  24. for (s32 x=0; x<width; ++x)
  25. {
  26. out[x] = *in>>shift & 0x01 ? (s16)0xffff : (s16)0x8000;
  27. if ((--shift)<0) // 8 pixel done
  28. {
  29. shift=7;
  30. ++in;
  31. }
  32. }
  33. if (shift != 7) // width did not fill last byte
  34. ++in;
  35. if (!flip)
  36. out += width;
  37. in += linepad;
  38. }
  39. }
  40. //! converts a 4 bit palettized image to A1R5G5B5
  41. void CColorConverter::convert4BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, const s32* palette, s32 linepad, bool flip)
  42. {
  43. if (!in || !out || !palette)
  44. return;
  45. if (flip)
  46. out += width*height;
  47. for (s32 y=0; y<height; ++y)
  48. {
  49. s32 shift = 4;
  50. if (flip)
  51. out -= width;
  52. for (s32 x=0; x<width; ++x)
  53. {
  54. out[x] = X8R8G8B8toA1R5G5B5(palette[(u8)((*in >> shift) & 0xf)]);
  55. if (shift==0)
  56. {
  57. shift = 4;
  58. ++in;
  59. }
  60. else
  61. shift = 0;
  62. }
  63. if (shift == 0) // odd width
  64. ++in;
  65. if (!flip)
  66. out += width;
  67. in += linepad;
  68. }
  69. }
  70. //! converts a 8 bit palettized image into A1R5G5B5
  71. void CColorConverter::convert8BitTo16Bit(const u8* in, s16* out, s32 width, s32 height, const s32* palette, s32 linepad, bool flip)
  72. {
  73. if (!in || !out || !palette)
  74. return;
  75. if (flip)
  76. out += width * height;
  77. for (s32 y=0; y<height; ++y)
  78. {
  79. if (flip)
  80. out -= width; // one line back
  81. for (s32 x=0; x<width; ++x)
  82. {
  83. out[x] = X8R8G8B8toA1R5G5B5(palette[(u8)(*in)]);
  84. ++in;
  85. }
  86. if (!flip)
  87. out += width;
  88. in += linepad;
  89. }
  90. }
  91. //! converts a 8 bit palettized or non palettized image (A8) into R8G8B8
  92. void CColorConverter::convert8BitTo24Bit(const u8* in, u8* out, s32 width, s32 height, const u8* palette, s32 linepad, bool flip)
  93. {
  94. if (!in || !out )
  95. return;
  96. const s32 lineWidth = 3 * width;
  97. if (flip)
  98. out += lineWidth * height;
  99. for (s32 y=0; y<height; ++y)
  100. {
  101. if (flip)
  102. out -= lineWidth; // one line back
  103. for (s32 x=0; x< lineWidth; x += 3)
  104. {
  105. if ( palette )
  106. {
  107. #ifdef __BIG_ENDIAN__
  108. out[x+0] = palette[ (in[0] << 2 ) + 0];
  109. out[x+1] = palette[ (in[0] << 2 ) + 1];
  110. out[x+2] = palette[ (in[0] << 2 ) + 2];
  111. #else
  112. out[x+0] = palette[ (in[0] << 2 ) + 2];
  113. out[x+1] = palette[ (in[0] << 2 ) + 1];
  114. out[x+2] = palette[ (in[0] << 2 ) + 0];
  115. #endif
  116. }
  117. else
  118. {
  119. out[x+0] = in[0];
  120. out[x+1] = in[0];
  121. out[x+2] = in[0];
  122. }
  123. ++in;
  124. }
  125. if (!flip)
  126. out += lineWidth;
  127. in += linepad;
  128. }
  129. }
  130. //! converts a 8 bit palettized or non palettized image (A8) into R8G8B8
  131. void CColorConverter::convert8BitTo32Bit(const u8* in, u8* out, s32 width, s32 height, const u8* palette, s32 linepad, bool flip)
  132. {
  133. if (!in || !out )
  134. return;
  135. const u32 lineWidth = 4 * width;
  136. if (flip)
  137. out += lineWidth * height;
  138. u32 x;
  139. register u32 c;
  140. for (u32 y=0; y < (u32) height; ++y)
  141. {
  142. if (flip)
  143. out -= lineWidth; // one line back
  144. if ( palette )
  145. {
  146. for (x=0; x < (u32) width; x += 1)
  147. {
  148. c = in[x];
  149. ((u32*)out)[x] = ((u32*)palette)[ c ];
  150. }
  151. }
  152. else
  153. {
  154. for (x=0; x < (u32) width; x += 1)
  155. {
  156. c = in[x];
  157. #ifdef __BIG_ENDIAN__
  158. ((u32*)out)[x] = c << 24 | c << 16 | c << 8 | 0x000000FF;
  159. #else
  160. ((u32*)out)[x] = 0xFF000000 | c << 16 | c << 8 | c;
  161. #endif
  162. }
  163. }
  164. if (!flip)
  165. out += lineWidth;
  166. in += width + linepad;
  167. }
  168. }
  169. //! converts 16bit data to 16bit data
  170. void CColorConverter::convert16BitTo16Bit(const s16* in, s16* out, s32 width, s32 height, s32 linepad, bool flip)
  171. {
  172. if (!in || !out)
  173. return;
  174. if (flip)
  175. out += width * height;
  176. for (s32 y=0; y<height; ++y)
  177. {
  178. if (flip)
  179. out -= width;
  180. #ifdef __BIG_ENDIAN__
  181. for (s32 x=0; x<width; ++x)
  182. out[x]=os::Byteswap::byteswap(in[x]);
  183. #else
  184. memcpy(out, in, width*sizeof(s16));
  185. #endif
  186. if (!flip)
  187. out += width;
  188. in += width;
  189. in += linepad;
  190. }
  191. }
  192. //! copies R8G8B8 24bit data to 24bit data
  193. void CColorConverter::convert24BitTo24Bit(const u8* in, u8* out, s32 width, s32 height, s32 linepad, bool flip, bool bgr)
  194. {
  195. if (!in || !out)
  196. return;
  197. const s32 lineWidth = 3 * width;
  198. if (flip)
  199. out += lineWidth * height;
  200. for (s32 y=0; y<height; ++y)
  201. {
  202. if (flip)
  203. out -= lineWidth;
  204. if (bgr)
  205. {
  206. for (s32 x=0; x<lineWidth; x+=3)
  207. {
  208. out[x+0] = in[x+2];
  209. out[x+1] = in[x+1];
  210. out[x+2] = in[x+0];
  211. }
  212. }
  213. else
  214. {
  215. memcpy(out,in,lineWidth);
  216. }
  217. if (!flip)
  218. out += lineWidth;
  219. in += lineWidth;
  220. in += linepad;
  221. }
  222. }
  223. //! Resizes the surface to a new size and converts it at the same time
  224. //! to an A8R8G8B8 format, returning the pointer to the new buffer.
  225. void CColorConverter::convert16bitToA8R8G8B8andResize(const s16* in, s32* out, s32 newWidth, s32 newHeight, s32 currentWidth, s32 currentHeight)
  226. {
  227. if (!newWidth || !newHeight)
  228. return;
  229. // note: this is very very slow. (i didn't want to write a fast version.
  230. // but hopefully, nobody wants to convert surfaces every frame.
  231. f32 sourceXStep = (f32)currentWidth / (f32)newWidth;
  232. f32 sourceYStep = (f32)currentHeight / (f32)newHeight;
  233. f32 sy;
  234. s32 t;
  235. for (s32 x=0; x<newWidth; ++x)
  236. {
  237. sy = 0.0f;
  238. for (s32 y=0; y<newHeight; ++y)
  239. {
  240. t = in[(s32)(((s32)sy)*currentWidth + x*sourceXStep)];
  241. t = (((t >> 15)&0x1)<<31) | (((t >> 10)&0x1F)<<19) |
  242. (((t >> 5)&0x1F)<<11) | (t&0x1F)<<3;
  243. out[(s32)(y*newWidth + x)] = t;
  244. sy+=sourceYStep;
  245. }
  246. }
  247. }
  248. //! copies X8R8G8B8 32 bit data
  249. void CColorConverter::convert32BitTo32Bit(const s32* in, s32* out, s32 width, s32 height, s32 linepad, bool flip)
  250. {
  251. if (!in || !out)
  252. return;
  253. if (flip)
  254. out += width * height;
  255. for (s32 y=0; y<height; ++y)
  256. {
  257. if (flip)
  258. out -= width;
  259. #ifdef __BIG_ENDIAN__
  260. for (s32 x=0; x<width; ++x)
  261. out[x]=os::Byteswap::byteswap(in[x]);
  262. #else
  263. memcpy(out, in, width*sizeof(s32));
  264. #endif
  265. if (!flip)
  266. out += width;
  267. in += width;
  268. in += linepad;
  269. }
  270. }
  271. void CColorConverter::convert_A1R5G5B5toR8G8B8(const void* sP, s32 sN, void* dP)
  272. {
  273. u16* sB = (u16*)sP;
  274. u8 * dB = (u8 *)dP;
  275. for (s32 x = 0; x < sN; ++x)
  276. {
  277. dB[2] = (*sB & 0x7c00) >> 7;
  278. dB[1] = (*sB & 0x03e0) >> 2;
  279. dB[0] = (*sB & 0x1f) << 3;
  280. sB += 1;
  281. dB += 3;
  282. }
  283. }
  284. void CColorConverter::convert_A1R5G5B5toB8G8R8(const void* sP, s32 sN, void* dP)
  285. {
  286. u16* sB = (u16*)sP;
  287. u8 * dB = (u8 *)dP;
  288. for (s32 x = 0; x < sN; ++x)
  289. {
  290. dB[0] = (*sB & 0x7c00) >> 7;
  291. dB[1] = (*sB & 0x03e0) >> 2;
  292. dB[2] = (*sB & 0x1f) << 3;
  293. sB += 1;
  294. dB += 3;
  295. }
  296. }
  297. void CColorConverter::convert_A1R5G5B5toR5G5B5A1(const void* sP, s32 sN, void* dP)
  298. {
  299. const u16* sB = (const u16*)sP;
  300. u16* dB = (u16*)dP;
  301. for (s32 x = 0; x < sN; ++x)
  302. {
  303. *dB = (*sB<<1)|(*sB>>15);
  304. ++sB; ++dB;
  305. }
  306. }
  307. void CColorConverter::convert_A1R5G5B5toA8R8G8B8(const void* sP, s32 sN, void* dP)
  308. {
  309. u16* sB = (u16*)sP;
  310. u32* dB = (u32*)dP;
  311. for (s32 x = 0; x < sN; ++x)
  312. *dB++ = A1R5G5B5toA8R8G8B8(*sB++);
  313. }
  314. void CColorConverter::convert_A1R5G5B5toA1R5G5B5(const void* sP, s32 sN, void* dP)
  315. {
  316. memcpy(dP, sP, sN * 2);
  317. }
  318. void CColorConverter::convert_A1R5G5B5toR5G6B5(const void* sP, s32 sN, void* dP)
  319. {
  320. u16* sB = (u16*)sP;
  321. u16* dB = (u16*)dP;
  322. for (s32 x = 0; x < sN; ++x)
  323. *dB++ = A1R5G5B5toR5G6B5(*sB++);
  324. }
  325. void CColorConverter::convert_A8R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP)
  326. {
  327. u8* sB = (u8*)sP;
  328. u8* dB = (u8*)dP;
  329. for (s32 x = 0; x < sN; ++x)
  330. {
  331. // sB[3] is alpha
  332. dB[0] = sB[2];
  333. dB[1] = sB[1];
  334. dB[2] = sB[0];
  335. sB += 4;
  336. dB += 3;
  337. }
  338. }
  339. void CColorConverter::convert_A8R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP)
  340. {
  341. u8* sB = (u8*)sP;
  342. u8* dB = (u8*)dP;
  343. for (s32 x = 0; x < sN; ++x)
  344. {
  345. // sB[3] is alpha
  346. dB[0] = sB[0];
  347. dB[1] = sB[1];
  348. dB[2] = sB[2];
  349. sB += 4;
  350. dB += 3;
  351. }
  352. }
  353. void CColorConverter::convert_A8R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP)
  354. {
  355. memcpy(dP, sP, sN * 4);
  356. }
  357. void CColorConverter::convert_A8R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP)
  358. {
  359. u32* sB = (u32*)sP;
  360. u16* dB = (u16*)dP;
  361. for (s32 x = 0; x < sN; ++x)
  362. *dB++ = A8R8G8B8toA1R5G5B5(*sB++);
  363. }
  364. void CColorConverter::convert_A8R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP)
  365. {
  366. u8 * sB = (u8 *)sP;
  367. u16* dB = (u16*)dP;
  368. for (s32 x = 0; x < sN; ++x)
  369. {
  370. s32 r = sB[2] >> 3;
  371. s32 g = sB[1] >> 2;
  372. s32 b = sB[0] >> 3;
  373. dB[0] = (r << 11) | (g << 5) | (b);
  374. sB += 4;
  375. dB += 1;
  376. }
  377. }
  378. void CColorConverter::convert_A8R8G8B8toR3G3B2(const void* sP, s32 sN, void* dP)
  379. {
  380. u8* sB = (u8*)sP;
  381. u8* dB = (u8*)dP;
  382. for (s32 x = 0; x < sN; ++x)
  383. {
  384. u8 r = sB[2] & 0xe0;
  385. u8 g = (sB[1] & 0xe0) >> 3;
  386. u8 b = (sB[0] & 0xc0) >> 6;
  387. dB[0] = (r | g | b);
  388. sB += 4;
  389. dB += 1;
  390. }
  391. }
  392. void CColorConverter::convert_R8G8B8toR8G8B8(const void* sP, s32 sN, void* dP)
  393. {
  394. memcpy(dP, sP, sN * 3);
  395. }
  396. void CColorConverter::convert_R8G8B8toA8R8G8B8(const void* sP, s32 sN, void* dP)
  397. {
  398. u8* sB = (u8* )sP;
  399. u32* dB = (u32*)dP;
  400. for (s32 x = 0; x < sN; ++x)
  401. {
  402. *dB = 0xff000000 | (sB[0]<<16) | (sB[1]<<8) | sB[2];
  403. sB += 3;
  404. ++dB;
  405. }
  406. }
  407. void CColorConverter::convert_R8G8B8toA1R5G5B5(const void* sP, s32 sN, void* dP)
  408. {
  409. u8 * sB = (u8 *)sP;
  410. u16* dB = (u16*)dP;
  411. for (s32 x = 0; x < sN; ++x)
  412. {
  413. s32 r = sB[0] >> 3;
  414. s32 g = sB[1] >> 3;
  415. s32 b = sB[2] >> 3;
  416. dB[0] = (0x8000) | (r << 10) | (g << 5) | (b);
  417. sB += 3;
  418. dB += 1;
  419. }
  420. }
  421. void CColorConverter::convert_B8G8R8toA8R8G8B8(const void* sP, s32 sN, void* dP)
  422. {
  423. u8* sB = (u8* )sP;
  424. u32* dB = (u32*)dP;
  425. for (s32 x = 0; x < sN; ++x)
  426. {
  427. *dB = 0xff000000 | (sB[2]<<16) | (sB[1]<<8) | sB[0];
  428. sB += 3;
  429. ++dB;
  430. }
  431. }
  432. void CColorConverter::convert_A8R8G8B8toR8G8B8A8(const void* sP, s32 sN, void* dP)
  433. {
  434. const u32* sB = (const u32*)sP;
  435. u32* dB = (u32*)dP;
  436. for (s32 x = 0; x < sN; ++x)
  437. {
  438. *dB++ = (*sB<<8) | (*sB>>24);
  439. ++sB;
  440. }
  441. }
  442. void CColorConverter::convert_A8R8G8B8toA8B8G8R8(const void* sP, s32 sN, void* dP)
  443. {
  444. const u32* sB = (const u32*)sP;
  445. u32* dB = (u32*)dP;
  446. for (s32 x = 0; x < sN; ++x)
  447. {
  448. *dB++ = (*sB&0xff00ff00)|((*sB&0x00ff0000)>>16)|((*sB&0x000000ff)<<16);
  449. ++sB;
  450. }
  451. }
  452. void CColorConverter::convert_B8G8R8A8toA8R8G8B8(const void* sP, s32 sN, void* dP)
  453. {
  454. u8* sB = (u8*)sP;
  455. u8* dB = (u8*)dP;
  456. for (s32 x = 0; x < sN; ++x)
  457. {
  458. dB[0] = sB[3];
  459. dB[1] = sB[2];
  460. dB[2] = sB[1];
  461. dB[3] = sB[0];
  462. sB += 4;
  463. dB += 4;
  464. }
  465. }
  466. void CColorConverter::convert_R8G8B8toB8G8R8(const void* sP, s32 sN, void* dP)
  467. {
  468. u8* sB = (u8*)sP;
  469. u8* dB = (u8*)dP;
  470. for (s32 x = 0; x < sN; ++x)
  471. {
  472. dB[2] = sB[0];
  473. dB[1] = sB[1];
  474. dB[0] = sB[2];
  475. sB += 3;
  476. dB += 3;
  477. }
  478. }
  479. void CColorConverter::convert_R8G8B8toR5G6B5(const void* sP, s32 sN, void* dP)
  480. {
  481. u8 * sB = (u8 *)sP;
  482. u16* dB = (u16*)dP;
  483. for (s32 x = 0; x < sN; ++x)
  484. {
  485. s32 r = sB[0] >> 3;
  486. s32 g = sB[1] >> 2;
  487. s32 b = sB[2] >> 3;
  488. dB[0] = (r << 11) | (g << 5) | (b);
  489. sB += 3;
  490. dB += 1;
  491. }
  492. }
  493. void CColorConverter::convert_R5G6B5toR5G6B5(const void* sP, s32 sN, void* dP)
  494. {
  495. memcpy(dP, sP, sN * 2);
  496. }
  497. void CColorConverter::convert_R5G6B5toR8G8B8(const void* sP, s32 sN, void* dP)
  498. {
  499. u16* sB = (u16*)sP;
  500. u8 * dB = (u8 *)dP;
  501. for (s32 x = 0; x < sN; ++x)
  502. {
  503. dB[0] = (*sB & 0xf800) >> 8;
  504. dB[1] = (*sB & 0x07e0) >> 3;
  505. dB[2] = (*sB & 0x001f) << 3;
  506. sB += 1;
  507. dB += 3;
  508. }
  509. }
  510. void CColorConverter::convert_R5G6B5toB8G8R8(const void* sP, s32 sN, void* dP)
  511. {
  512. u16* sB = (u16*)sP;
  513. u8 * dB = (u8 *)dP;
  514. for (s32 x = 0; x < sN; ++x)
  515. {
  516. dB[2] = (*sB & 0xf800) >> 8;
  517. dB[1] = (*sB & 0x07e0) >> 3;
  518. dB[0] = (*sB & 0x001f) << 3;
  519. sB += 1;
  520. dB += 3;
  521. }
  522. }
  523. void CColorConverter::convert_R5G6B5toA8R8G8B8(const void* sP, s32 sN, void* dP)
  524. {
  525. u16* sB = (u16*)sP;
  526. u32* dB = (u32*)dP;
  527. for (s32 x = 0; x < sN; ++x)
  528. *dB++ = R5G6B5toA8R8G8B8(*sB++);
  529. }
  530. void CColorConverter::convert_R5G6B5toA1R5G5B5(const void* sP, s32 sN, void* dP)
  531. {
  532. u16* sB = (u16*)sP;
  533. u16* dB = (u16*)dP;
  534. for (s32 x = 0; x < sN; ++x)
  535. *dB++ = R5G6B5toA1R5G5B5(*sB++);
  536. }
  537. void CColorConverter::convert_viaFormat(const void* sP, ECOLOR_FORMAT sF, s32 sN,
  538. void* dP, ECOLOR_FORMAT dF)
  539. {
  540. switch (sF)
  541. {
  542. case ECF_A1R5G5B5:
  543. switch (dF)
  544. {
  545. case ECF_A1R5G5B5:
  546. convert_A1R5G5B5toA1R5G5B5(sP, sN, dP);
  547. break;
  548. case ECF_R5G6B5:
  549. convert_A1R5G5B5toR5G6B5(sP, sN, dP);
  550. break;
  551. case ECF_A8R8G8B8:
  552. convert_A1R5G5B5toA8R8G8B8(sP, sN, dP);
  553. break;
  554. case ECF_R8G8B8:
  555. convert_A1R5G5B5toR8G8B8(sP, sN, dP);
  556. break;
  557. #ifndef _DEBUG
  558. default:
  559. break;
  560. #endif
  561. }
  562. break;
  563. case ECF_R5G6B5:
  564. switch (dF)
  565. {
  566. case ECF_A1R5G5B5:
  567. convert_R5G6B5toA1R5G5B5(sP, sN, dP);
  568. break;
  569. case ECF_R5G6B5:
  570. convert_R5G6B5toR5G6B5(sP, sN, dP);
  571. break;
  572. case ECF_A8R8G8B8:
  573. convert_R5G6B5toA8R8G8B8(sP, sN, dP);
  574. break;
  575. case ECF_R8G8B8:
  576. convert_R5G6B5toR8G8B8(sP, sN, dP);
  577. break;
  578. #ifndef _DEBUG
  579. default:
  580. break;
  581. #endif
  582. }
  583. break;
  584. case ECF_A8R8G8B8:
  585. switch (dF)
  586. {
  587. case ECF_A1R5G5B5:
  588. convert_A8R8G8B8toA1R5G5B5(sP, sN, dP);
  589. break;
  590. case ECF_R5G6B5:
  591. convert_A8R8G8B8toR5G6B5(sP, sN, dP);
  592. break;
  593. case ECF_A8R8G8B8:
  594. convert_A8R8G8B8toA8R8G8B8(sP, sN, dP);
  595. break;
  596. case ECF_R8G8B8:
  597. convert_A8R8G8B8toR8G8B8(sP, sN, dP);
  598. break;
  599. #ifndef _DEBUG
  600. default:
  601. break;
  602. #endif
  603. }
  604. break;
  605. case ECF_R8G8B8:
  606. switch (dF)
  607. {
  608. case ECF_A1R5G5B5:
  609. convert_R8G8B8toA1R5G5B5(sP, sN, dP);
  610. break;
  611. case ECF_R5G6B5:
  612. convert_R8G8B8toR5G6B5(sP, sN, dP);
  613. break;
  614. case ECF_A8R8G8B8:
  615. convert_R8G8B8toA8R8G8B8(sP, sN, dP);
  616. break;
  617. case ECF_R8G8B8:
  618. convert_R8G8B8toR8G8B8(sP, sN, dP);
  619. break;
  620. #ifndef _DEBUG
  621. default:
  622. break;
  623. #endif
  624. }
  625. break;
  626. default:
  627. break;
  628. }
  629. }
  630. } // end namespace video
  631. } // end namespace irr