Bug 1583432 - Set IDCompositionVisual interporation mode to Linear r=nical

Differential Revision: https://phabricator.services.mozilla.com/D46896

--HG--
extra : moz-landing-system : lando
This commit is contained in:
sotaro 2019-09-30 09:01:32 +00:00
Родитель 9664951311
Коммит b61f0ef673
2 изменённых файлов: 22 добавлений и 4 удалений

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

@ -49,16 +49,33 @@ bool DCLayerTree::Initialize(HWND aHwnd) {
hr = mCompositionDevice->CreateVisual(getter_AddRefs(mRootVisual));
if (FAILED(hr)) {
gfxCriticalNote << "Could not create DCompositionVisualt: "
<< gfx::hexa(hr);
gfxCriticalNote << "Failed to create DCompositionVisual: " << gfx::hexa(hr);
return false;
}
hr =
mCompositionDevice->CreateVisual(getter_AddRefs(mDefaultSwapChainVisual));
if (FAILED(hr)) {
gfxCriticalNote << "Failed to create DCompositionVisual: " << gfx::hexa(hr);
return false;
}
mCompositionTarget->SetRoot(mRootVisual);
// Set interporation mode to Linear.
// By default, a visual inherits the interpolation mode of the parent visual.
// If no visuals set the interpolation mode, the default for the entire visual
// tree is nearest neighbor interpolation.
mRootVisual->SetBitmapInterpolationMode(
DCOMPOSITION_BITMAP_INTERPOLATION_MODE_LINEAR);
return true;
}
void DCLayerTree::SetDefaultSwapChain(IDXGISwapChain1* aSwapChain) {
mRootVisual->SetContent(aSwapChain);
mCompositionTarget->SetRoot(mRootVisual);
mRootVisual->AddVisual(mDefaultSwapChainVisual, TRUE, nullptr);
mDefaultSwapChainVisual->SetContent(aSwapChain);
// Default SwapChain's visual does not need linear interporation.
mDefaultSwapChainVisual->SetBitmapInterpolationMode(
DCOMPOSITION_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR);
mCompositionDevice->Commit();
}

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

@ -39,6 +39,7 @@ class DCLayerTree {
RefPtr<IDCompositionDevice> mCompositionDevice;
RefPtr<IDCompositionTarget> mCompositionTarget;
RefPtr<IDCompositionVisual> mRootVisual;
RefPtr<IDCompositionVisual> mDefaultSwapChainVisual;
};
} // namespace wr