зеркало из https://github.com/mozilla/gecko-dev.git
Bug 924194 - Make gfxQuartzNativeDrawing::BeginNativeDrawing able to handle DrawTargets with a different backend than BACKEND_COREGRAPHICS (e.g. BACKEND_CAIRO). r=jrmuizel
--HG-- extra : rebase_source : d284993fae8681854b73f4d9f935427b98731dfa
This commit is contained in:
Родитель
5abb1852ee
Коммит
6792ac37c1
|
@ -35,32 +35,37 @@ gfxQuartzNativeDrawing::BeginNativeDrawing()
|
|||
{
|
||||
NS_ASSERTION(!mQuartzSurface, "BeginNativeDrawing called when drawing already in progress");
|
||||
|
||||
gfxPoint deviceOffset;
|
||||
nsRefPtr<gfxASurface> surf;
|
||||
|
||||
if (!mContext->IsCairo()) {
|
||||
DrawTarget *dt = mContext->GetDrawTarget();
|
||||
if (mContext->GetDrawTarget()->IsDualDrawTarget()) {
|
||||
IntSize backingSize(NSToIntFloor(mNativeRect.width * mBackingScale),
|
||||
NSToIntFloor(mNativeRect.height * mBackingScale));
|
||||
if (dt->GetType() == BACKEND_COREGRAPHICS) {
|
||||
if (dt->IsDualDrawTarget()) {
|
||||
IntSize backingSize(NSToIntFloor(mNativeRect.width * mBackingScale),
|
||||
NSToIntFloor(mNativeRect.height * mBackingScale));
|
||||
|
||||
if (backingSize.IsEmpty())
|
||||
return nullptr;
|
||||
if (backingSize.IsEmpty())
|
||||
return nullptr;
|
||||
|
||||
mDrawTarget = Factory::CreateDrawTarget(BACKEND_COREGRAPHICS, backingSize, FORMAT_B8G8R8A8);
|
||||
mDrawTarget = Factory::CreateDrawTarget(BACKEND_COREGRAPHICS, backingSize, FORMAT_B8G8R8A8);
|
||||
|
||||
Matrix transform;
|
||||
transform.Scale(mBackingScale, mBackingScale);
|
||||
transform.Translate(-mNativeRect.x, -mNativeRect.y);
|
||||
Matrix transform;
|
||||
transform.Scale(mBackingScale, mBackingScale);
|
||||
transform.Translate(-mNativeRect.x, -mNativeRect.y);
|
||||
|
||||
mDrawTarget->SetTransform(transform);
|
||||
dt = mDrawTarget;
|
||||
mDrawTarget->SetTransform(transform);
|
||||
dt = mDrawTarget;
|
||||
}
|
||||
|
||||
mCGContext = mBorrowedContext.Init(dt);
|
||||
MOZ_ASSERT(mCGContext);
|
||||
return mCGContext;
|
||||
}
|
||||
|
||||
mCGContext = mBorrowedContext.Init(dt);
|
||||
MOZ_ASSERT(mCGContext);
|
||||
return mCGContext;
|
||||
surf = gfxPlatform::GetPlatform()->GetThebesSurfaceForDrawTarget(dt);
|
||||
} else {
|
||||
surf = mContext->CurrentSurface(&deviceOffset.x, &deviceOffset.y);
|
||||
}
|
||||
|
||||
gfxPoint deviceOffset;
|
||||
nsRefPtr<gfxASurface> surf = mContext->CurrentSurface(&deviceOffset.x, &deviceOffset.y);
|
||||
if (!surf || surf->CairoStatus())
|
||||
return nullptr;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче