... |
... |
@@ -237,31 +237,31 @@ |
237
|
237
|
grColor color )
|
238
|
238
|
{
|
239
|
239
|
int x, y;
|
240
|
|
- unsigned int shift;
|
241
|
|
- unsigned char* read;
|
242
|
|
- unsigned char* write;
|
243
|
|
-
|
244
|
|
- read = blit->read + (blit->xread >> 3);
|
245
|
|
- write = blit->write + blit->xwrite;
|
246
|
|
- shift = blit->xread & 7;
|
|
240
|
+ unsigned char* write = blit->write + blit->xwrite;
|
|
241
|
+ unsigned char* read = blit->read + ( blit->xread >> 3 );
|
|
242
|
+ unsigned int mask = 0x80 >> ( blit->xread & 7 );
|
247
|
243
|
|
248
|
244
|
y = blit->height;
|
249
|
245
|
do
|
250
|
246
|
{
|
251
|
|
- unsigned char* _read = read;
|
252
|
247
|
unsigned char* _write = write;
|
253
|
|
- unsigned long val = ((unsigned long)*_read++ | 0x100) << shift;
|
|
248
|
+ unsigned char* _read = read;
|
|
249
|
+ unsigned int _mask = mask;
|
|
250
|
+ unsigned int val = *_read;
|
254
|
251
|
|
255
|
252
|
x = blit->width;
|
256
|
253
|
do
|
257
|
254
|
{
|
258
|
|
- if (val & 0x10000)
|
259
|
|
- val = *_read++ | 0x100;
|
|
255
|
+ if ( !_mask )
|
|
256
|
+ {
|
|
257
|
+ val = *++_read;
|
|
258
|
+ _mask = 0x80;
|
|
259
|
+ }
|
260
|
260
|
|
261
|
|
- if ( val & 0x80 )
|
|
261
|
+ if ( val & _mask )
|
262
|
262
|
*_write = (unsigned char)color.value;
|
263
|
263
|
|
264
|
|
- val <<= 1;
|
|
264
|
+ _mask >>= 1;
|
265
|
265
|
_write++;
|
266
|
266
|
|
267
|
267
|
} while ( --x > 0 );
|
... |
... |
@@ -283,47 +283,37 @@ |
283
|
283
|
void blit_mono_to_pal4( grBlitter* blit,
|
284
|
284
|
grColor color )
|
285
|
285
|
{
|
286
|
|
- int x, y, phase;
|
287
|
|
- unsigned int shift;
|
288
|
|
- unsigned char* read;
|
289
|
|
- unsigned char* write;
|
290
|
|
- unsigned int col;
|
291
|
|
-
|
292
|
|
-
|
293
|
|
- col = color.value & 15;
|
294
|
|
- read = blit->read + (blit->xread >> 3);
|
295
|
|
- write = blit->write + (blit->xwrite >> 1);
|
296
|
|
-
|
297
|
|
- /* now begin blit */
|
298
|
|
- shift = blit->xread & 7;
|
299
|
|
- phase = blit->xwrite & 1;
|
|
286
|
+ int x, y;
|
|
287
|
+ unsigned char* write = blit->write + ( blit->xwrite >> 1 );
|
|
288
|
+ unsigned int phase = blit->xwrite & 1 ? 0x0F : 0xF0;
|
|
289
|
+ unsigned char* read = blit->read + ( blit->xread >> 3 );
|
|
290
|
+ unsigned int mask = 0x80 >> ( blit->xread & 7 );
|
|
291
|
+ unsigned int col = color.value | ( color.value << 4 );
|
300
|
292
|
|
301
|
293
|
y = blit->height;
|
302
|
294
|
do
|
303
|
295
|
{
|
304
|
|
- unsigned char* _read = read;
|
305
|
296
|
unsigned char* _write = write;
|
306
|
|
- int _phase = phase;
|
307
|
|
- unsigned long val = ((unsigned long)*_read++ | 0x100) << shift;
|
|
297
|
+ unsigned int _phase = phase;
|
|
298
|
+ unsigned char* _read = read;
|
|
299
|
+ unsigned int _mask = mask;
|
|
300
|
+ unsigned int val = *_read;
|
308
|
301
|
|
309
|
302
|
x = blit->width;
|
310
|
303
|
do
|
311
|
304
|
{
|
312
|
|
- if (val & 0x10000)
|
313
|
|
- val = *_read++ | 0x100;
|
314
|
|
-
|
315
|
|
- if ( val & 0x80 )
|
|
305
|
+ if ( !_mask )
|
316
|
306
|
{
|
317
|
|
- if ( _phase )
|
318
|
|
- *_write = (unsigned char)((*_write & 0xF0) | col);
|
319
|
|
- else
|
320
|
|
- *_write = (unsigned char)((*_write & 0x0F) | (col << 4));
|
|
307
|
+ val = *++_read;
|
|
308
|
+ _mask = 0x80;
|
321
|
309
|
}
|
322
|
310
|
|
323
|
|
- val <<= 1;
|
|
311
|
+ if ( val & _mask )
|
|
312
|
+ *_write = (unsigned char)( (col & _phase) | (*_write & ~_phase) );
|
324
|
313
|
|
325
|
|
- _write += _phase;
|
326
|
|
- _phase ^= 1;
|
|
314
|
+ _mask >>= 1;
|
|
315
|
+ _write += _phase & 1;
|
|
316
|
+ _phase = ~_phase;
|
327
|
317
|
x--;
|
328
|
318
|
} while ( x > 0 );
|
329
|
319
|
|
... |
... |
@@ -345,32 +335,32 @@ |
345
|
335
|
grColor color )
|
346
|
336
|
{
|
347
|
337
|
int x, y;
|
348
|
|
- unsigned int shift;
|
349
|
|
- unsigned char* read;
|
350
|
|
- unsigned char* write;
|
351
|
|
-
|
352
|
|
- read = blit->read + (blit->xread >> 3);
|
353
|
|
- write = blit->write + blit->xwrite*2;
|
354
|
|
- shift = blit->xread & 7;
|
|
338
|
+ unsigned char* write = blit->write + blit->xwrite * 2;
|
|
339
|
+ unsigned char* read = blit->read + ( blit->xread >> 3 );
|
|
340
|
+ unsigned int mask = 0x80 >> ( blit->xread & 7 );
|
355
|
341
|
|
356
|
342
|
y = blit->height;
|
357
|
343
|
do
|
358
|
344
|
{
|
|
345
|
+ unsigned short* _write = (unsigned short*)write;
|
359
|
346
|
unsigned char* _read = read;
|
360
|
|
- unsigned char* _write = write;
|
361
|
|
- unsigned long val = ((unsigned long)*_read++ | 0x100) << shift;
|
|
347
|
+ unsigned int _mask = mask;
|
|
348
|
+ unsigned int val = *_read;
|
362
|
349
|
|
363
|
350
|
x = blit->width;
|
364
|
351
|
do
|
365
|
352
|
{
|
366
|
|
- if (val & 0x10000)
|
367
|
|
- val = *_read++ | 0x100;
|
|
353
|
+ if ( !_mask )
|
|
354
|
+ {
|
|
355
|
+ val = *++_read;
|
|
356
|
+ _mask = 0x80;
|
|
357
|
+ }
|
368
|
358
|
|
369
|
|
- if ( val & 0x80 )
|
370
|
|
- *(short*)_write = (short)color.value;
|
|
359
|
+ if ( val & _mask )
|
|
360
|
+ *_write = (unsigned short)color.value;
|
371
|
361
|
|
372
|
|
- val <<= 1;
|
373
|
|
- _write +=2;
|
|
362
|
+ _mask >>= 1;
|
|
363
|
+ _write++;
|
374
|
364
|
x--;
|
375
|
365
|
} while ( x > 0 );
|
376
|
366
|
|
... |
... |
@@ -392,35 +382,35 @@ |
392
|
382
|
grColor color )
|
393
|
383
|
{
|
394
|
384
|
int x, y;
|
395
|
|
- unsigned int shift;
|
396
|
|
- unsigned char* read;
|
397
|
|
- unsigned char* write;
|
398
|
|
-
|
399
|
|
- read = blit->read + (blit->xread >> 3);
|
400
|
|
- write = blit->write + blit->xwrite*3;
|
401
|
|
- shift = blit->xread & 7;
|
|
385
|
+ unsigned char* write = blit->write + blit->xwrite * 3;
|
|
386
|
+ unsigned char* read = blit->read + ( blit->xread >> 3 );
|
|
387
|
+ unsigned int mask = 0x80 >> ( blit->xread & 7 );
|
402
|
388
|
|
403
|
389
|
y = blit->height;
|
404
|
390
|
do
|
405
|
391
|
{
|
406
|
|
- unsigned char* _read = read;
|
407
|
392
|
unsigned char* _write = write;
|
408
|
|
- unsigned long val = ((unsigned long)*_read++ | 0x100) << shift;
|
|
393
|
+ unsigned char* _read = read;
|
|
394
|
+ unsigned int _mask = mask;
|
|
395
|
+ unsigned int val = *_read;
|
409
|
396
|
|
410
|
397
|
x = blit->width;
|
411
|
398
|
do
|
412
|
399
|
{
|
413
|
|
- if (val & 0x10000)
|
414
|
|
- val = *_read++ | 0x100;
|
|
400
|
+ if ( !_mask )
|
|
401
|
+ {
|
|
402
|
+ val = *++_read;
|
|
403
|
+ _mask = 0x80;
|
|
404
|
+ }
|
415
|
405
|
|
416
|
|
- if ( val & 0x80 )
|
|
406
|
+ if ( val & _mask )
|
417
|
407
|
{
|
418
|
408
|
_write[0] = color.chroma[0];
|
419
|
409
|
_write[1] = color.chroma[1];
|
420
|
410
|
_write[2] = color.chroma[2];
|
421
|
411
|
}
|
422
|
412
|
|
423
|
|
- val <<= 1;
|
|
413
|
+ _mask >>= 1;
|
424
|
414
|
_write += 3;
|
425
|
415
|
x--;
|
426
|
416
|
} while ( x > 0 );
|
... |
... |
@@ -443,31 +433,31 @@ |
443
|
433
|
grColor color )
|
444
|
434
|
{
|
445
|
435
|
int x, y;
|
446
|
|
- unsigned int shift;
|
447
|
|
- unsigned char* read;
|
448
|
|
- unsigned char* write;
|
449
|
|
-
|
450
|
|
- read = blit->read + ( blit->xread >> 3 );
|
451
|
|
- write = blit->write + blit->xwrite*4;
|
452
|
|
- shift = blit->xread & 7;
|
|
436
|
+ unsigned char* write = blit->write + blit->xwrite * 4;
|
|
437
|
+ unsigned char* read = blit->read + ( blit->xread >> 3 );
|
|
438
|
+ unsigned int mask = 0x80 >> ( blit->xread & 7 );
|
453
|
439
|
|
454
|
440
|
y = blit->height;
|
455
|
441
|
do
|
456
|
442
|
{
|
457
|
|
- unsigned char* _read = read;
|
458
|
443
|
uint32_t* _write = (uint32_t*)write;
|
459
|
|
- unsigned long val = ((unsigned long)*_read++ | 0x100L ) << shift;
|
|
444
|
+ unsigned char* _read = read;
|
|
445
|
+ unsigned int _mask = mask;
|
|
446
|
+ unsigned int val = *_read;
|
460
|
447
|
|
461
|
448
|
x = blit->width;
|
462
|
449
|
do
|
463
|
450
|
{
|
464
|
|
- if ( val & 0x10000 )
|
465
|
|
- val = *_read++ | 0x100L;
|
|
451
|
+ if ( !_mask )
|
|
452
|
+ {
|
|
453
|
+ val = *++_read;
|
|
454
|
+ _mask = 0x80;
|
|
455
|
+ }
|
466
|
456
|
|
467
|
|
- if ( val & 0x80 )
|
|
457
|
+ if ( val & _mask )
|
468
|
458
|
*_write = color.value;
|
469
|
459
|
|
470
|
|
- val <<= 1;
|
|
460
|
+ _mask >>= 1;
|
471
|
461
|
_write++;
|
472
|
462
|
x--;
|
473
|
463
|
|