... |
... |
@@ -119,15 +119,14 @@ gblender_set_gamma_table( double gamma_value, |
119
|
119
|
static void
|
120
|
120
|
gblender_clear( GBlender blender )
|
121
|
121
|
{
|
122
|
|
- int nn;
|
123
|
|
- GBlenderKey keys = blender->keys;
|
|
122
|
+ int nn;
|
124
|
123
|
|
125
|
124
|
if ( blender->channels )
|
126
|
125
|
{
|
127
|
126
|
GBlenderChanKey chan_keys = (GBlenderChanKey) blender->keys;
|
128
|
127
|
|
129
|
128
|
for ( nn = 0; nn < GBLENDER_KEY_COUNT * 3; nn++ )
|
130
|
|
- chan_keys[nn].index = -1;
|
|
129
|
+ chan_keys[nn].index = 0xFFFF;
|
131
|
130
|
|
132
|
131
|
blender->cache_r_back = 0;
|
133
|
132
|
blender->cache_r_fore = ~0U;
|
... |
... |
@@ -143,6 +142,8 @@ gblender_clear( GBlender blender ) |
143
|
142
|
}
|
144
|
143
|
else
|
145
|
144
|
{
|
|
145
|
+ GBlenderKey keys = blender->keys;
|
|
146
|
+
|
146
|
147
|
for ( nn = 0; nn < GBLENDER_KEY_COUNT; nn++ )
|
147
|
148
|
keys[nn].cells = NULL;
|
148
|
149
|
|
... |
... |
@@ -290,7 +291,7 @@ gblender_lookup( GBlender blender, |
290
|
291
|
NewNode:
|
291
|
292
|
key->background = background;
|
292
|
293
|
key->foreground = foreground;
|
293
|
|
- key->cells = blender->cells + idx * GBLENDER_SHADE_COUNT;
|
|
294
|
+ key->cells = blender->cells[idx];
|
294
|
295
|
|
295
|
296
|
gblender_reset_key( blender, key );
|
296
|
297
|
|
... |
... |
@@ -309,7 +310,8 @@ gblender_reset_channel_key( GBlender blender, |
309
|
310
|
{
|
310
|
311
|
unsigned int back = key->backfore & 255;
|
311
|
312
|
unsigned int fore = (key->backfore >> 8) & 255;
|
312
|
|
- unsigned char* gr = (unsigned char*)blender->cells + key->index;
|
|
313
|
+ unsigned char* gr = (unsigned char*)blender->cells +
|
|
314
|
+ key->index * GBLENDER_SHADE_COUNT;
|
313
|
315
|
unsigned int nn;
|
314
|
316
|
|
315
|
317
|
const unsigned char* gamma_ramp_inv = blender->gamma_ramp_inv;
|
... |
... |
@@ -340,7 +342,7 @@ gblender_lookup_channel( GBlender blender, |
340
|
342
|
unsigned int background,
|
341
|
343
|
unsigned int foreground )
|
342
|
344
|
{
|
343
|
|
- unsigned idx;
|
|
345
|
+ unsigned short idx;
|
344
|
346
|
unsigned short backfore = (unsigned short)((foreground << 8) | background);
|
345
|
347
|
GBlenderChanKey key;
|
346
|
348
|
|
... |
... |
@@ -353,7 +355,7 @@ gblender_lookup_channel( GBlender blender, |
353
|
355
|
|
354
|
356
|
key = (GBlenderChanKey)blender->keys + idx;
|
355
|
357
|
|
356
|
|
- if ( key->index < 0 )
|
|
358
|
+ if ( key->index == 0xFFFF )
|
357
|
359
|
goto NewNode;
|
358
|
360
|
|
359
|
361
|
if ( key->backfore == backfore )
|
... |
... |
@@ -365,7 +367,7 @@ gblender_lookup_channel( GBlender blender, |
365
|
367
|
|
366
|
368
|
NewNode:
|
367
|
369
|
key->backfore = backfore;
|
368
|
|
- key->index = (signed short)( idx * GBLENDER_SHADE_COUNT );
|
|
370
|
+ key->index = idx;
|
369
|
371
|
|
370
|
372
|
gblender_reset_channel_key( blender, key );
|
371
|
373
|
|
... |
... |
@@ -374,7 +376,7 @@ NewNode: |
374
|
376
|
#endif
|
375
|
377
|
|
376
|
378
|
Exit:
|
377
|
|
- return (unsigned char*)blender->cells + key->index;
|
|
379
|
+ return (unsigned char*)blender->cells + idx * GBLENDER_SHADE_COUNT;
|
378
|
380
|
}
|
379
|
381
|
|
380
|
382
|
|