Changeset 15d3e8a in thomson for tools/gfx2mo5/libraw2mo5.c
- Timestamp:
- Mar 20, 2016, 10:04:25 PM (8 years ago)
- Branches:
- main
- Children:
- a8929a8
- Parents:
- 2366419
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gfx2mo5/libraw2mo5.c
r2366419 r15d3e8a 19 19 bool lfo = false; 20 20 uint8_t val; 21 static const int width = 320; 21 22 22 23 tmpBuffer = (unsigned char*)calloc(0x4000,1); … … 26 27 exit(4); 27 28 } 28 #define width 32029 29 30 30 for (y = 0; y < height; y++) … … 94 94 return tmpBuffer; 95 95 } 96 97 98 unsigned char *raw2bm16(unsigned char *input, int height) 99 { 100 unsigned char *tmpBuffer; 101 int x,y; 102 int p1 = 0; 103 int p2 = 0x2000; 104 static const int width = 160; 105 106 tmpBuffer = (unsigned char*)calloc(0x4000,1); 107 if (tmpBuffer == NULL) 108 { 109 printf("Allocation tmpBuffer raté\n"); 110 exit(4); 111 } 112 113 for (y = 0; y < height; y++) 114 for (x = 0; x < width; x+=4) { 115 int pix; 116 117 for(pix = 0; pix < 4; pix++) { 118 int nc = input[y*width+x+pix]; 119 if (nc > 15) printf("Color over limit!\n"); 120 121 switch(pix) { 122 case 0: 123 tmpBuffer[p1] = nc << 4; 124 break; 125 case 1: 126 tmpBuffer[p1++] |= nc; 127 break; 128 case 2: 129 tmpBuffer[p2] = nc << 4; 130 break; 131 case 3: 132 tmpBuffer[p2++] |= nc; 133 break; 134 } 135 } 136 } 137 138 return tmpBuffer; 139 }
Note:
See TracChangeset
for help on using the changeset viewer.