Bug 1154322 - Always use DrawTargetCG when painting directly into a window on OS X (unaccelerated drawRect rendering). r=jrmuizel

This also gets rid of the code path that allowed us to test DrawTargetCairo for OS X content rendering. As far as I know, nobody has made use of it in the past 12 months.

This change makes us not crash if SupportsAzureContentForType(BackendType::COREGRAPHICS) returns false, which will be the case if you flip the azure content pref to a supported non-"cg" value.
This commit is contained in:
Markus Stange 2015-04-14 11:40:53 -04:00
Родитель 965b4acedf
Коммит 533712e3b1
1 изменённых файлов: 7 добавлений и 23 удалений

Просмотреть файл

@ -3443,29 +3443,13 @@ NSEvent* gLastDragMouseDownEvent = nil;
// Create Cairo objects.
nsRefPtr<gfxQuartzSurface> targetSurface;
nsRefPtr<gfxContext> targetContext;
if (gfxPlatform::GetPlatform()->SupportsAzureContentForType(gfx::BackendType::COREGRAPHICS)) {
RefPtr<gfx::DrawTarget> dt =
gfx::Factory::CreateDrawTargetForCairoCGContext(aContext,
gfx::IntSize(backingSize.width,
backingSize.height));
MOZ_ASSERT(dt); // see implementation
dt->AddUserData(&gfxContext::sDontUseAsSourceKey, dt, nullptr);
targetContext = new gfxContext(dt);
} else if (gfxPlatform::GetPlatform()->SupportsAzureContentForType(gfx::BackendType::CAIRO)) {
// This is dead code unless you mess with prefs, but keep it around for
// debugging.
targetSurface = new gfxQuartzSurface(aContext, backingSize);
targetSurface->SetAllowUseAsSource(false);
RefPtr<gfx::DrawTarget> dt =
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(targetSurface,
gfx::IntSize(backingSize.width,
backingSize.height));
dt->AddUserData(&gfxContext::sDontUseAsSourceKey, dt, nullptr);
targetContext = new gfxContext(dt);
} else {
MOZ_ASSERT_UNREACHABLE("COREGRAPHICS is the only supported backed");
}
RefPtr<gfx::DrawTarget> dt =
gfx::Factory::CreateDrawTargetForCairoCGContext(aContext,
gfx::IntSize(backingSize.width,
backingSize.height));
MOZ_ASSERT(dt); // see implementation
dt->AddUserData(&gfxContext::sDontUseAsSourceKey, dt, nullptr);
nsRefPtr<gfxContext> targetContext = new gfxContext(dt);
// Set up the clip region.
nsIntRegionRectIterator iter(region);