зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1230686 - use RefPtr<DrawTarget>& instead of DrawTarget* to track changes in SurfaceFromElement. r=jmuizelaar
This commit is contained in:
Родитель
dbf3dec4da
Коммит
9a71f879e0
|
@ -1311,7 +1311,7 @@ public:
|
|||
if (!mPixelStore_PremultiplyAlpha)
|
||||
flags |= nsLayoutUtils::SFE_PREFER_NO_PREMULTIPLY_ALPHA;
|
||||
|
||||
gfx::DrawTarget* idealDrawTarget = nullptr; // Don't care for now.
|
||||
RefPtr<gfx::DrawTarget> idealDrawTarget = nullptr; // Don't care for now.
|
||||
return nsLayoutUtils::SurfaceFromElement(elem, flags, idealDrawTarget);
|
||||
}
|
||||
|
||||
|
|
|
@ -6889,7 +6889,7 @@ nsLayoutUtils::IsReallyFixedPos(nsIFrame* aFrame)
|
|||
nsLayoutUtils::SurfaceFromElementResult
|
||||
nsLayoutUtils::SurfaceFromOffscreenCanvas(OffscreenCanvas* aOffscreenCanvas,
|
||||
uint32_t aSurfaceFlags,
|
||||
DrawTarget* aTarget)
|
||||
RefPtr<DrawTarget>& aTarget)
|
||||
{
|
||||
SurfaceFromElementResult result;
|
||||
|
||||
|
@ -6904,7 +6904,7 @@ nsLayoutUtils::SurfaceFromOffscreenCanvas(OffscreenCanvas* aOffscreenCanvas,
|
|||
if (!result.mSourceSurface) {
|
||||
// If the element doesn't have a context then we won't get a snapshot. The canvas spec wants us to not error and just
|
||||
// draw nothing, so return an empty surface.
|
||||
DrawTarget *ref = aTarget ? aTarget : gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
||||
DrawTarget *ref = aTarget ? aTarget.get() : gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
||||
RefPtr<DrawTarget> dt = ref->CreateSimilarDrawTarget(IntSize(size.width, size.height),
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
if (dt) {
|
||||
|
@ -6927,7 +6927,7 @@ nsLayoutUtils::SurfaceFromOffscreenCanvas(OffscreenCanvas* aOffscreenCanvas,
|
|||
nsLayoutUtils::SurfaceFromElementResult
|
||||
nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent* aElement,
|
||||
uint32_t aSurfaceFlags,
|
||||
DrawTarget* aTarget)
|
||||
RefPtr<DrawTarget>& aTarget)
|
||||
{
|
||||
SurfaceFromElementResult result;
|
||||
nsresult rv;
|
||||
|
@ -7020,7 +7020,7 @@ nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent* aElement,
|
|||
nsLayoutUtils::SurfaceFromElementResult
|
||||
nsLayoutUtils::SurfaceFromElement(HTMLImageElement *aElement,
|
||||
uint32_t aSurfaceFlags,
|
||||
DrawTarget* aTarget)
|
||||
RefPtr<DrawTarget>& aTarget)
|
||||
{
|
||||
return SurfaceFromElement(static_cast<nsIImageLoadingContent*>(aElement),
|
||||
aSurfaceFlags, aTarget);
|
||||
|
@ -7029,7 +7029,7 @@ nsLayoutUtils::SurfaceFromElement(HTMLImageElement *aElement,
|
|||
nsLayoutUtils::SurfaceFromElementResult
|
||||
nsLayoutUtils::SurfaceFromElement(HTMLCanvasElement* aElement,
|
||||
uint32_t aSurfaceFlags,
|
||||
DrawTarget* aTarget)
|
||||
RefPtr<DrawTarget>& aTarget)
|
||||
{
|
||||
SurfaceFromElementResult result;
|
||||
|
||||
|
@ -7044,7 +7044,7 @@ nsLayoutUtils::SurfaceFromElement(HTMLCanvasElement* aElement,
|
|||
if (!result.mSourceSurface) {
|
||||
// If the element doesn't have a context then we won't get a snapshot. The canvas spec wants us to not error and just
|
||||
// draw nothing, so return an empty surface.
|
||||
DrawTarget *ref = aTarget ? aTarget : gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
||||
DrawTarget *ref = aTarget ? aTarget.get() : gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
||||
RefPtr<DrawTarget> dt = ref->CreateSimilarDrawTarget(IntSize(size.width, size.height),
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
if (dt) {
|
||||
|
@ -7072,7 +7072,7 @@ nsLayoutUtils::SurfaceFromElement(HTMLCanvasElement* aElement,
|
|||
nsLayoutUtils::SurfaceFromElementResult
|
||||
nsLayoutUtils::SurfaceFromElement(HTMLVideoElement* aElement,
|
||||
uint32_t aSurfaceFlags,
|
||||
DrawTarget* aTarget)
|
||||
RefPtr<DrawTarget>& aTarget)
|
||||
{
|
||||
SurfaceFromElementResult result;
|
||||
|
||||
|
@ -7132,7 +7132,7 @@ nsLayoutUtils::SurfaceFromElement(HTMLVideoElement* aElement,
|
|||
nsLayoutUtils::SurfaceFromElementResult
|
||||
nsLayoutUtils::SurfaceFromElement(dom::Element* aElement,
|
||||
uint32_t aSurfaceFlags,
|
||||
DrawTarget* aTarget)
|
||||
RefPtr<DrawTarget>& aTarget)
|
||||
{
|
||||
// If it's a <canvas>, we may be able to just grab its internal surface
|
||||
if (HTMLCanvasElement* canvas =
|
||||
|
|
|
@ -2119,26 +2119,39 @@ public:
|
|||
// This function can be called on any thread.
|
||||
static SurfaceFromElementResult
|
||||
SurfaceFromOffscreenCanvas(mozilla::dom::OffscreenCanvas *aOffscreenCanvas,
|
||||
uint32_t aSurfaceFlags = 0,
|
||||
DrawTarget *aTarget = nullptr);
|
||||
uint32_t aSurfaceFlags,
|
||||
RefPtr<DrawTarget>& aTarget);
|
||||
static SurfaceFromElementResult
|
||||
SurfaceFromOffscreenCanvas(mozilla::dom::OffscreenCanvas *aOffscreenCanvas,
|
||||
uint32_t aSurfaceFlags = 0) {
|
||||
RefPtr<DrawTarget> target = nullptr;
|
||||
return SurfaceFromOffscreenCanvas(aOffscreenCanvas, aSurfaceFlags, target);
|
||||
}
|
||||
|
||||
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::Element *aElement,
|
||||
uint32_t aSurfaceFlags = 0,
|
||||
DrawTarget *aTarget = nullptr);
|
||||
uint32_t aSurfaceFlags,
|
||||
RefPtr<DrawTarget>& aTarget);
|
||||
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::Element *aElement,
|
||||
uint32_t aSurfaceFlags = 0) {
|
||||
RefPtr<DrawTarget> target = nullptr;
|
||||
return SurfaceFromElement(aElement, aSurfaceFlags, target);
|
||||
}
|
||||
|
||||
static SurfaceFromElementResult SurfaceFromElement(nsIImageLoadingContent *aElement,
|
||||
uint32_t aSurfaceFlags = 0,
|
||||
DrawTarget *aTarget = nullptr);
|
||||
uint32_t aSurfaceFlags,
|
||||
RefPtr<DrawTarget>& aTarget);
|
||||
// Need an HTMLImageElement overload, because otherwise the
|
||||
// nsIImageLoadingContent and mozilla::dom::Element overloads are ambiguous
|
||||
// for HTMLImageElement.
|
||||
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLImageElement *aElement,
|
||||
uint32_t aSurfaceFlags = 0,
|
||||
DrawTarget *aTarget = nullptr);
|
||||
uint32_t aSurfaceFlags,
|
||||
RefPtr<DrawTarget>& aTarget);
|
||||
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLCanvasElement *aElement,
|
||||
uint32_t aSurfaceFlags = 0,
|
||||
DrawTarget *aTarget = nullptr);
|
||||
uint32_t aSurfaceFlags,
|
||||
RefPtr<DrawTarget>& aTarget);
|
||||
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLVideoElement *aElement,
|
||||
uint32_t aSurfaceFlags = 0,
|
||||
DrawTarget *aTarget = nullptr);
|
||||
uint32_t aSurfaceFlags,
|
||||
RefPtr<DrawTarget>& aTarget);
|
||||
|
||||
/**
|
||||
* When the document is editable by contenteditable attribute of its root
|
||||
|
|
Загрузка…
Ссылка в новой задаче