Changeset 1186
- Timestamp:
- 10/25/09 19:51:15 (5 months ago)
- Files:
-
- trunk/CommonUtils.c (modified) (2 diffs)
- trunk/Subtitles/SubImport.mm (modified) (2 diffs)
- trunk/TextSubCodec.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/CommonUtils.c
r1185 r1186 310 310 }; 311 311 312 static const CFStringRef defaultTransparentSubtitleList [] = {312 static const CFStringRef defaultTransparentSubtitleList_10_6[] = { 313 313 CFSTR("CoreMediaAuthoringSourcePropertyHelper"), 314 CFSTR("Front Row"), 315 CFSTR("QTPlayerHelper") 316 }; 317 318 static const CFStringRef defaultTransparentSubtitleList_10_5[] = { 314 319 CFSTR("Front Row") 315 320 }; … … 410 415 411 416 if(forced == -1) 412 forced = isApplicationNameInList(CFSTR("TransparentModeSubtitleAppList"), 413 defaultTransparentSubtitleList, 414 sizeof(defaultTransparentSubtitleList)/sizeof(defaultTransparentSubtitleList[0])); 417 { 418 long minorVersion; 419 Gestalt(gestaltSystemVersionMinor, &minorVersion); 420 421 if (minorVersion == 5) 422 forced = isApplicationNameInList(CFSTR("TransparentModeSubtitleAppList"), 423 defaultTransparentSubtitleList_10_5, 424 sizeof(defaultTransparentSubtitleList_10_5)/sizeof(defaultTransparentSubtitleList_10_5[0])); 425 else if (minorVersion == 6) 426 forced = isApplicationNameInList(CFSTR("TransparentModeSubtitleAppList"), 427 defaultTransparentSubtitleList_10_6, 428 sizeof(defaultTransparentSubtitleList_10_6)/sizeof(defaultTransparentSubtitleList_10_6[0])); 429 else 430 forced = 0; 431 } 432 415 433 return forced; 416 434 } trunk/Subtitles/SubImport.mm
r1185 r1186 81 81 } 82 82 83 //Use ugly transparency ("transparent" blend mode) for files imported in Front Row84 //At the moment it doesn't support graphicsModePreBlackAlpha85 static bool ShouldEngageFrontRowHack(void)86 {87 long minorVersion;88 Gestalt(gestaltSystemVersionMinor, &minorVersion);89 90 bool systemVersionCheck = minorVersion >= 5;91 bool appNameCheck = IsTransparentSubtitleHackEnabled();92 93 return systemVersionCheck && appNameCheck;94 }95 96 83 Track CreatePlaintextSubTrack(Movie theMovie, ImageDescriptionHandle imgDesc, 97 84 TimeScale timescale, Handle dataRef, OSType dataRefType, FourCharCode subType, Handle imageExtension, Rect movieBox) … … 125 112 MediaHandler mh = GetMediaHandler(theMedia); 126 113 127 if ( ShouldEngageFrontRowHack()) {114 if (IsTransparentSubtitleHackEnabled()) { 128 115 RGBColor blendColor = {0x0000, 0x0000, 0x0000}; 129 116 MediaSetGraphicsMode(mh, transparent, &blendColor); trunk/TextSubCodec.c
r1175 r1186 31 31 #include "PerianResourceIDs.h" 32 32 #include "SubATSUIRenderer.h" 33 #include "CommonUtils.h" 33 34 34 35 // Data structures … … 332 333 333 334 SubRenderPacket(glob->ssa,c,buf,myDrp->width,myDrp->height); 335 336 if (IsTransparentSubtitleHackEnabled()) { 337 // Map 8-bit alpha (graphicsModePreBlendAlpha) to 1-bit alpha (transparent) 338 // Pretty much this is just mapping all opaque black to (1,1,1,255) 339 // Leaves ugly borders where AAing turned into opaque colors, but that's harder to deal with 340 Ptr p = drp->baseAddr; 341 int y, x; 342 UInt32 alphaMask = EndianU32_BtoN((myDrp->pixelFormat == k32ARGBPixelFormat) ? 0xFF000000 : 0xFF), 343 replacement = EndianU32_BtoN((myDrp->pixelFormat == k32ARGBPixelFormat) ? 0xFF010101 : 0x010101FF); 344 345 for (y = 0; y < myDrp->height; y++) { 346 UInt32 *p32 = (UInt32*)p; 347 for (x = 0; x < myDrp->width; x++) { 348 UInt32 px = *p32; 349 350 // if px is black, and opaque (alpha == 255) 351 if (!(px & ~alphaMask) && (px & alphaMask == alphaMask)) { 352 // then set it to not-quite-black so it'll show up 353 *p32 = replacement; 354 } 355 356 p32++; 357 } 358 359 p += drp->rowBytes; 360 } 361 } 334 362 335 363 CFRelease(buf);
