Bug 1562091 - Partial backout of bug 1521027. r=aosmond

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Silva 2019-08-19 11:16:27 +00:00
parent 043a970708
commit bd9e647162
3 changed files with 8 additions and 14 deletions

View File

@ -1102,8 +1102,7 @@ already_AddRefed<SourceSurface> VectorImage::CreateSurface(
auto frame = MakeNotNull<RefPtr<imgFrame>>(); auto frame = MakeNotNull<RefPtr<imgFrame>>();
nsresult rv = frame->InitWithDrawable( nsresult rv = frame->InitWithDrawable(
aSVGDrawable, aParams.size, SurfaceFormat::B8G8R8A8, aSVGDrawable, aParams.size, SurfaceFormat::B8G8R8A8,
SamplingFilter::POINT, aParams.flags, backend, SamplingFilter::POINT, aParams.flags, backend);
aParams.context ? aParams.context->GetDrawTarget() : nullptr);
// If we couldn't create the frame, it was probably because it would end // If we couldn't create the frame, it was probably because it would end
// up way too big. Generally it also wouldn't fit in the cache, but the prefs // up way too big. Generally it also wouldn't fit in the cache, but the prefs

View File

@ -358,7 +358,7 @@ nsresult imgFrame::InitForDecoderRecycle(const AnimationParams& aAnimParams) {
nsresult imgFrame::InitWithDrawable( nsresult imgFrame::InitWithDrawable(
gfxDrawable* aDrawable, const nsIntSize& aSize, const SurfaceFormat aFormat, gfxDrawable* aDrawable, const nsIntSize& aSize, const SurfaceFormat aFormat,
SamplingFilter aSamplingFilter, uint32_t aImageFlags, SamplingFilter aSamplingFilter, uint32_t aImageFlags,
gfx::BackendType aBackend, DrawTarget* aTargetDT) { gfx::BackendType aBackend) {
// Assert for properties that should be verified by decoders, // Assert for properties that should be verified by decoders,
// warn for properties related to bad content. // warn for properties related to bad content.
if (!SurfaceCache::IsLegalSize(aSize)) { if (!SurfaceCache::IsLegalSize(aSize)) {
@ -407,16 +407,12 @@ nsresult imgFrame::InitWithDrawable(
// the documentation for this method. // the documentation for this method.
MOZ_ASSERT(!mOptSurface, "Called imgFrame::InitWithDrawable() twice?"); MOZ_ASSERT(!mOptSurface, "Called imgFrame::InitWithDrawable() twice?");
if (aTargetDT && !gfxVars::UseWebRender()) { if (gfxPlatform::GetPlatform()->SupportsAzureContentForType(aBackend)) {
target = aTargetDT->CreateSimilarDrawTarget(mImageSize, mFormat); target = gfxPlatform::GetPlatform()->CreateDrawTargetForBackend(
aBackend, mImageSize, mFormat);
} else { } else {
if (gfxPlatform::GetPlatform()->SupportsAzureContentForType(aBackend)) { target = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
target = gfxPlatform::GetPlatform()->CreateDrawTargetForBackend( mImageSize, mFormat);
aBackend, mImageSize, mFormat);
} else {
target = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(
mImageSize, mFormat);
}
} }
} }

View File

@ -81,8 +81,7 @@ class imgFrame {
nsresult InitWithDrawable(gfxDrawable* aDrawable, const nsIntSize& aSize, nsresult InitWithDrawable(gfxDrawable* aDrawable, const nsIntSize& aSize,
const SurfaceFormat aFormat, const SurfaceFormat aFormat,
SamplingFilter aSamplingFilter, SamplingFilter aSamplingFilter,
uint32_t aImageFlags, gfx::BackendType aBackend, uint32_t aImageFlags, gfx::BackendType aBackend);
DrawTarget* aTarget);
DrawableFrameRef DrawableRef(); DrawableFrameRef DrawableRef();