Changeset 1771 for libcaca/trunk/caca
- Timestamp:
- Jun 27, 2007, 3:06:18 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca/driver_cocoa.m
r1462 r1771 45 45 #define PRECACHE_WHOLE_COLOR_TABLE 1 46 46 47 #define USE_RGB12_FGBG 147 //#define USE_RGB12_FGBG 1 48 48 49 49 //#define USE_GLOBAL_AUTORELEASE_POOL 1 … … 268 268 attrs = _attrs + x + y * _w; 269 269 NSColor* color = nil; 270 270 #if USE_RGB12_FGBG 271 271 uint16_t bg = _cucul_attr_to_rgb12bg(*attrs); 272 272 if(bg) 273 273 { 274 #ifdef PRECACHE_WHOLE_COLOR_TABLE274 # ifdef PRECACHE_WHOLE_COLOR_TABLE 275 275 color = _colorCache[bg]; 276 #else276 # else 277 277 NSNumber* numberBg = [NSNumber numberWithInt:bg]; 278 278 color = [_colorCache objectForKey:numberBg]; … … 283 283 [_colorCache setObject:color forKey:numberBg]; 284 284 } 285 #endif285 # endif 286 286 } 287 287 #else 288 288 uint8_t argb[8]; 289 289 _cucul_attr_to_argb4(*attrs, argb); … … 292 292 blue:((float)argb[3]) / 15.0 293 293 alpha:1.0]; 294 294 #endif 295 295 if(color) 296 296 { … … 326 326 { 327 327 NSColor* color = nil; 328 328 #if USE_RGB12_FGBG 329 329 uint16_t fg = _cucul_attr_to_rgb12fg(*attrs); 330 #ifdef PRECACHE_WHOLE_COLOR_TABLE330 # ifdef PRECACHE_WHOLE_COLOR_TABLE 331 331 color = _colorCache[fg]; 332 #else // PRECACHE_WHOLE_COLOR_TABLE332 # else // PRECACHE_WHOLE_COLOR_TABLE 333 333 NSNumber* numberFg = [NSNumber numberWithInt:fg]; 334 334 color = [_colorCache objectForKey:numberFg]; … … 339 339 [_colorCache setObject:color forKey:numberFg]; 340 340 } 341 #endif // PRECACHE_WHOLE_COLOR_TABLE342 341 # endif // PRECACHE_WHOLE_COLOR_TABLE 342 #else // USE_RGB12_FGBG 343 343 uint8_t argb[8]; 344 344 _cucul_attr_to_argb4(*attrs, argb); … … 349 349 blue:((float)argb[7]) / 15.0 350 350 alpha:1.0]; 351 351 #endif // USE_RGB12_FGBG 352 352 353 353 if(color) … … 360 360 NSString* str = [[NSString alloc] initWithCharacters:&ch length:1]; 361 361 362 362 #ifdef USE_LOWLEVEL_COCOA 363 363 [[_textStorage mutableString] setString:str]; 364 364 [_textStorage setAttributes:attrDict range:NSMakeRange(0, 1)]; 365 365 [_layoutManager drawGlyphsForGlyphRange:NSMakeRange(0, 1) atPoint:r.origin]; 366 366 #else 367 367 [str drawInRect:r withAttributes:attrDict]; 368 368 #endif 369 369 [str release]; 370 370 }
Note: See TracChangeset
for help on using the changeset viewer.