Bug 1728205 - Remove DrawTargetDual. r=jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D123978
This commit is contained in:
Andrew Osmond 2021-08-30 22:55:32 +00:00
Родитель 45dbaa8381
Коммит 82c2f97a8e
13 изменённых файлов: 5 добавлений и 612 удалений

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

@ -1600,7 +1600,6 @@ class DrawTarget : public external::AtomicRefCounted<DrawTarget> {
*/
virtual void* GetNativeSurface(NativeSurfaceType aType) { return nullptr; }
virtual bool IsDualDrawTarget() const { return false; }
virtual bool IsTiledDrawTarget() const { return false; }
virtual bool SupportsRegionClipping() const { return true; }
@ -1857,20 +1856,6 @@ class GFX2D_API Factory {
public:
static void PurgeAllCaches();
static already_AddRefed<DrawTarget> CreateDualDrawTarget(DrawTarget* targetA,
DrawTarget* targetB);
static already_AddRefed<SourceSurface> CreateDualSourceSurface(
SourceSurface* sourceA, SourceSurface* sourceB);
/*
* This creates a new tiled DrawTarget. When a tiled drawtarget is used the
* drawing is distributed over number of tiles which may each hold an
* individual offset. The tiles in the set must each have the same backend
* and format.
*/
static already_AddRefed<DrawTarget> CreateTiledDrawTarget(
const TileSet& aTileSet);
static already_AddRefed<DrawTarget> CreateOffsetDrawTarget(
DrawTarget* aDrawTarget, IntPoint aTileOrigin);

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

@ -2148,8 +2148,7 @@ bool BorrowedXlibDrawable::Init(DrawTarget* aDT) {
mDrawable = X11None;
# ifdef CAIRO_HAS_XLIB_SURFACE
if (aDT->GetBackendType() != BackendType::CAIRO || aDT->IsDualDrawTarget() ||
aDT->IsTiledDrawTarget()) {
if (aDT->GetBackendType() != BackendType::CAIRO || aDT->IsTiledDrawTarget()) {
return false;
}

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

@ -11,7 +11,6 @@
#include "FilterNodeSoftware.h"
#include "GradientStopsD2D.h"
#include "SourceSurfaceD2D1.h"
#include "SourceSurfaceDual.h"
#include "ConicGradientEffectD2D1.h"
#include "RadialGradientEffectD2D1.h"
@ -2222,21 +2221,6 @@ already_AddRefed<ID2D1Image> DrawTargetD2D1::GetImageForSurface(
image = surf->GetImage();
AddDependencyOnSource(surf);
} break;
case SurfaceType::DUAL_DT: {
// Sometimes we have a dual drawtarget but the underlying targets
// are d2d surfaces. Let's not readback and reupload in those cases.
SourceSurfaceDual* dualSurface =
static_cast<SourceSurfaceDual*>(surface.get());
SourceSurface* first = dualSurface->GetFirstSurface();
if (first->GetType() == SurfaceType::D2D1_1_IMAGE) {
MOZ_ASSERT(dualSurface->SameSurfaceTypes());
SourceSurfaceD2D1* d2dSurface = static_cast<SourceSurfaceD2D1*>(first);
image = d2dSurface->GetImage();
AddDependencyOnSource(d2dSurface);
break;
}
// Otherwise fall through
}
default: {
RefPtr<DataSourceSurface> dataSurf = surface->GetDataSurface();
if (!dataSurf) {

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

@ -1,215 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DrawTargetDual.h"
#include "Tools.h"
#include "Logging.h"
namespace mozilla {
namespace gfx {
class DualSurface {
public:
inline explicit DualSurface(SourceSurface* aSurface) {
if (!aSurface) {
mA = mB = nullptr;
return;
}
if (aSurface->GetType() != SurfaceType::DUAL_DT) {
mA = mB = aSurface;
return;
}
SourceSurfaceDual* ssDual = static_cast<SourceSurfaceDual*>(aSurface);
mA = ssDual->mA;
mB = ssDual->mB;
}
SourceSurface* mA;
SourceSurface* mB;
};
/* This only needs to split patterns up for SurfacePatterns. Only in that
* case can we be dealing with a 'dual' source (SourceSurfaceDual) and do
* we need to pass separate patterns into our destination DrawTargets.
*/
class DualPattern final {
public:
inline explicit DualPattern(const Pattern& aPattern)
: mPatternsInitialized(false) {
if (aPattern.GetType() != PatternType::SURFACE) {
mA = mB = &aPattern;
return;
}
const SurfacePattern* surfPat =
static_cast<const SurfacePattern*>(&aPattern);
if (surfPat->mSurface->GetType() != SurfaceType::DUAL_DT) {
mA = mB = &aPattern;
return;
}
const SourceSurfaceDual* ssDual =
static_cast<const SourceSurfaceDual*>(surfPat->mSurface.get());
mA = new (mSurfPatA.addr())
SurfacePattern(ssDual->mA, surfPat->mExtendMode, surfPat->mMatrix,
surfPat->mSamplingFilter);
mB = new (mSurfPatB.addr())
SurfacePattern(ssDual->mB, surfPat->mExtendMode, surfPat->mMatrix,
surfPat->mSamplingFilter);
mPatternsInitialized = true;
}
inline ~DualPattern() {
if (mPatternsInitialized) {
mA->~Pattern();
mB->~Pattern();
}
}
ClassStorage<SurfacePattern> mSurfPatA;
ClassStorage<SurfacePattern> mSurfPatB;
const Pattern* mA;
const Pattern* mB;
bool mPatternsInitialized;
};
void DrawTargetDual::DetachAllSnapshots() {
mA->DetachAllSnapshots();
mB->DetachAllSnapshots();
}
void DrawTargetDual::DrawSurface(SourceSurface* aSurface, const Rect& aDest,
const Rect& aSource,
const DrawSurfaceOptions& aSurfOptions,
const DrawOptions& aOptions) {
DualSurface surface(aSurface);
mA->DrawSurface(surface.mA, aDest, aSource, aSurfOptions, aOptions);
mB->DrawSurface(surface.mB, aDest, aSource, aSurfOptions, aOptions);
}
void DrawTargetDual::DrawSurfaceWithShadow(SourceSurface* aSurface,
const Point& aDest,
const DeviceColor& aColor,
const Point& aOffset, Float aSigma,
CompositionOp aOp) {
DualSurface surface(aSurface);
mA->DrawSurfaceWithShadow(surface.mA, aDest, aColor, aOffset, aSigma, aOp);
mB->DrawSurfaceWithShadow(surface.mB, aDest, aColor, aOffset, aSigma, aOp);
}
void DrawTargetDual::MaskSurface(const Pattern& aSource, SourceSurface* aMask,
Point aOffset, const DrawOptions& aOptions) {
DualPattern source(aSource);
DualSurface mask(aMask);
mA->MaskSurface(*source.mA, mask.mA, aOffset, aOptions);
mB->MaskSurface(*source.mB, mask.mB, aOffset, aOptions);
}
void DrawTargetDual::ClearRect(const Rect& aRect) {
mA->FillRect(aRect, ColorPattern(DeviceColor::MaskOpaqueBlack()));
mB->FillRect(aRect, ColorPattern(DeviceColor::MaskOpaqueWhite()));
}
void DrawTargetDual::CopySurface(SourceSurface* aSurface,
const IntRect& aSourceRect,
const IntPoint& aDestination) {
DualSurface surface(aSurface);
mA->CopySurface(surface.mA, aSourceRect, aDestination);
mB->CopySurface(surface.mB, aSourceRect, aDestination);
}
void DrawTargetDual::FillRect(const Rect& aRect, const Pattern& aPattern,
const DrawOptions& aOptions) {
DualPattern pattern(aPattern);
mA->FillRect(aRect, *pattern.mA, aOptions);
mB->FillRect(aRect, *pattern.mB, aOptions);
}
void DrawTargetDual::StrokeRect(const Rect& aRect, const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
const DrawOptions& aOptions) {
DualPattern pattern(aPattern);
mA->StrokeRect(aRect, *pattern.mA, aStrokeOptions, aOptions);
mB->StrokeRect(aRect, *pattern.mB, aStrokeOptions, aOptions);
}
void DrawTargetDual::StrokeLine(const Point& aStart, const Point& aEnd,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
const DrawOptions& aOptions) {
DualPattern pattern(aPattern);
mA->StrokeLine(aStart, aEnd, *pattern.mA, aStrokeOptions, aOptions);
mB->StrokeLine(aStart, aEnd, *pattern.mB, aStrokeOptions, aOptions);
}
void DrawTargetDual::Stroke(const Path* aPath, const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
const DrawOptions& aOptions) {
DualPattern pattern(aPattern);
mA->Stroke(aPath, *pattern.mA, aStrokeOptions, aOptions);
mB->Stroke(aPath, *pattern.mB, aStrokeOptions, aOptions);
}
void DrawTargetDual::Fill(const Path* aPath, const Pattern& aPattern,
const DrawOptions& aOptions) {
DualPattern pattern(aPattern);
mA->Fill(aPath, *pattern.mA, aOptions);
mB->Fill(aPath, *pattern.mB, aOptions);
}
void DrawTargetDual::FillGlyphs(ScaledFont* aScaledFont,
const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const DrawOptions& aOptions) {
DualPattern pattern(aPattern);
mA->FillGlyphs(aScaledFont, aBuffer, *pattern.mA, aOptions);
mB->FillGlyphs(aScaledFont, aBuffer, *pattern.mB, aOptions);
}
void DrawTargetDual::Mask(const Pattern& aSource, const Pattern& aMask,
const DrawOptions& aOptions) {
DualPattern source(aSource);
DualPattern mask(aMask);
mA->Mask(*source.mA, *mask.mA, aOptions);
mB->Mask(*source.mB, *mask.mB, aOptions);
}
void DrawTargetDual::PushLayer(bool aOpaque, Float aOpacity,
SourceSurface* aMask,
const Matrix& aMaskTransform,
const IntRect& aBounds, bool aCopyBackground) {
DualSurface mask(aMask);
mA->PushLayer(aOpaque, aOpacity, mask.mA, aMaskTransform, aBounds,
aCopyBackground);
mB->PushLayer(aOpaque, aOpacity, mask.mB, aMaskTransform, aBounds,
aCopyBackground);
}
already_AddRefed<DrawTarget> DrawTargetDual::CreateSimilarDrawTarget(
const IntSize& aSize, SurfaceFormat aFormat) const {
/* Now that we have PushLayer there a very few cases where a user of
* DrawTargetDual wants to have a DualTarget when creating a similar one. */
return mA->CreateSimilarDrawTarget(aSize, aFormat);
}
RefPtr<DrawTarget> DrawTargetDual::CreateClippedDrawTarget(
const Rect& aBounds, SurfaceFormat aFormat) {
/* The user probably doesn't want a DualDrawTarget here. */
return mA->CreateClippedDrawTarget(aBounds, aFormat);
}
bool DrawTargetDual::CanCreateSimilarDrawTarget(const IntSize& aSize,
SurfaceFormat aFormat) const {
return mA->CanCreateSimilarDrawTarget(aSize, aFormat);
}
} // namespace gfx
} // namespace mozilla

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

@ -1,198 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_GFX_DRAWTARGETDUAL_H_
#define MOZILLA_GFX_DRAWTARGETDUAL_H_
#include <vector>
#include <sstream>
#include "SourceSurfaceDual.h"
#include "2D.h"
#include "Filters.h"
namespace mozilla {
namespace gfx {
#define FORWARD_FUNCTION(funcName) \
virtual void funcName() override { \
mA->funcName(); \
mB->funcName(); \
}
#define FORWARD_FUNCTION1(funcName, var1Type, var1Name) \
virtual void funcName(var1Type var1Name) override { \
mA->funcName(var1Name); \
mB->funcName(var1Name); \
}
/* This is a special type of DrawTarget. It duplicates all drawing calls
* accross two drawtargets. An exception to this is when a snapshot of another
* dual DrawTarget is used as the source for any surface data. In this case
* the snapshot of the first source DrawTarget is used as a source for the call
* to the first destination DrawTarget (mA) and the snapshot of the second
* source DrawTarget is used at the source for the second destination
* DrawTarget (mB). This class facilitates black-background/white-background
* drawing for per-component alpha extraction for backends which do not support
* native component alpha.
*/
class DrawTargetDual : public DrawTarget {
public:
virtual bool IsValid() const override {
return mA->IsValid() && mB->IsValid();
};
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawTargetDual, override)
DrawTargetDual(DrawTarget* aA, DrawTarget* aB) : mA(aA), mB(aB) {
mFormat = aA->GetFormat();
}
virtual DrawTargetType GetType() const override { return mA->GetType(); }
virtual BackendType GetBackendType() const override {
return mA->GetBackendType();
}
virtual already_AddRefed<SourceSurface> Snapshot() override {
return MakeAndAddRef<SourceSurfaceDual>(mA, mB);
}
virtual IntSize GetSize() const override { return mA->GetSize(); }
virtual void DetachAllSnapshots() override;
FORWARD_FUNCTION(Flush)
FORWARD_FUNCTION1(PushClip, const Path*, aPath)
FORWARD_FUNCTION1(PushClipRect, const Rect&, aRect)
FORWARD_FUNCTION(PopClip)
FORWARD_FUNCTION(PopLayer)
virtual void SetTransform(const Matrix& aTransform) override {
mTransform = aTransform;
mA->SetTransform(aTransform);
mB->SetTransform(aTransform);
}
virtual bool SupportsRegionClipping() const override {
return mA->SupportsRegionClipping() && mB->SupportsRegionClipping();
}
virtual void DrawSurface(SourceSurface* aSurface, const Rect& aDest,
const Rect& aSource,
const DrawSurfaceOptions& aSurfOptions,
const DrawOptions& aOptions) override;
virtual void DrawFilter(
FilterNode* aNode, const Rect& aSourceRect, const Point& aDestPoint,
const DrawOptions& aOptions = DrawOptions()) override {
mA->DrawFilter(aNode, aSourceRect, aDestPoint, aOptions);
mB->DrawFilter(aNode, aSourceRect, aDestPoint, aOptions);
}
virtual void MaskSurface(
const Pattern& aSource, SourceSurface* aMask, Point aOffset,
const DrawOptions& aOptions = DrawOptions()) override;
virtual void DrawSurfaceWithShadow(SourceSurface* aSurface,
const Point& aDest,
const DeviceColor& aColor,
const Point& aOffset, Float aSigma,
CompositionOp aOp) override;
virtual void ClearRect(const Rect& aRect) override;
virtual void CopySurface(SourceSurface* aSurface, const IntRect& aSourceRect,
const IntPoint& aDestination) override;
virtual void FillRect(const Rect& aRect, const Pattern& aPattern,
const DrawOptions& aOptions) override;
virtual void StrokeRect(const Rect& aRect, const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
const DrawOptions& aOptions) override;
virtual void StrokeLine(const Point& aStart, const Point& aEnd,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
const DrawOptions& aOptions) override;
virtual void Stroke(const Path* aPath, const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
const DrawOptions& aOptions) override;
virtual void Fill(const Path* aPath, const Pattern& aPattern,
const DrawOptions& aOptions) override;
virtual void FillGlyphs(ScaledFont* aScaledFont, const GlyphBuffer& aBuffer,
const Pattern& aPattern,
const DrawOptions& aOptions) override;
virtual void Mask(const Pattern& aSource, const Pattern& aMask,
const DrawOptions& aOptions) override;
virtual void PushLayer(bool aOpaque, Float aOpacity, SourceSurface* aMask,
const Matrix& aMaskTransform,
const IntRect& aBounds = IntRect(),
bool aCopyBackground = false) override;
virtual bool Unrotate(IntPoint aRotation) override {
return mA->Unrotate(aRotation) && mB->Unrotate(aRotation);
}
virtual already_AddRefed<SourceSurface> CreateSourceSurfaceFromData(
unsigned char* aData, const IntSize& aSize, int32_t aStride,
SurfaceFormat aFormat) const override {
return mA->CreateSourceSurfaceFromData(aData, aSize, aStride, aFormat);
}
virtual already_AddRefed<SourceSurface> OptimizeSourceSurface(
SourceSurface* aSurface) const override {
return mA->OptimizeSourceSurface(aSurface);
}
virtual already_AddRefed<SourceSurface> CreateSourceSurfaceFromNativeSurface(
const NativeSurface& aSurface) const override {
return mA->CreateSourceSurfaceFromNativeSurface(aSurface);
}
virtual already_AddRefed<DrawTarget> CreateSimilarDrawTarget(
const IntSize& aSize, SurfaceFormat aFormat) const override;
virtual bool CanCreateSimilarDrawTarget(const IntSize& aSize,
SurfaceFormat aFormat) const override;
virtual RefPtr<DrawTarget> CreateClippedDrawTarget(
const Rect& aBounds, SurfaceFormat aFormat) override;
virtual already_AddRefed<PathBuilder> CreatePathBuilder(
FillRule aFillRule = FillRule::FILL_WINDING) const override {
return mA->CreatePathBuilder(aFillRule);
}
virtual already_AddRefed<GradientStops> CreateGradientStops(
GradientStop* aStops, uint32_t aNumStops,
ExtendMode aExtendMode = ExtendMode::CLAMP) const override {
return mA->CreateGradientStops(aStops, aNumStops, aExtendMode);
}
virtual already_AddRefed<FilterNode> CreateFilter(FilterType aType) override {
return mA->CreateFilter(aType);
}
virtual void* GetNativeSurface(NativeSurfaceType aType) override {
return nullptr;
}
virtual bool IsDualDrawTarget() const override { return true; }
virtual bool IsCurrentGroupOpaque() override {
return mA->IsCurrentGroupOpaque();
}
private:
RefPtr<DrawTarget> mA;
RefPtr<DrawTarget> mB;
};
} // namespace gfx
} // namespace mozilla
#endif /* MOZILLA_GFX_DRAWTARGETDUAL_H_ */

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

@ -52,7 +52,6 @@
# include "nsWindowsHelpers.h"
#endif
#include "DrawTargetDual.h"
#include "DrawTargetOffset.h"
#include "DrawTargetWrapAndRecord.h"
#include "DrawTargetRecording.h"
@ -599,30 +598,6 @@ already_AddRefed<ScaledFont> Factory::CreateScaledFontForFreeTypeFont(
}
#endif
already_AddRefed<DrawTarget> Factory::CreateDualDrawTarget(
DrawTarget* targetA, DrawTarget* targetB) {
MOZ_ASSERT(targetA && targetB);
RefPtr<DrawTarget> newTarget = new DrawTargetDual(targetA, targetB);
RefPtr<DrawTarget> retVal = newTarget;
if (mRecorder) {
retVal = new DrawTargetWrapAndRecord(mRecorder, retVal);
}
return retVal.forget();
}
already_AddRefed<SourceSurface> Factory::CreateDualSourceSurface(
SourceSurface* sourceA, SourceSurface* sourceB) {
MOZ_ASSERT(sourceA && sourceB);
RefPtr<SourceSurface> newSource = new SourceSurfaceDual(sourceA, sourceB);
return newSource.forget();
}
void Factory::SetBGRSubpixelOrder(bool aBGR) { mBGRSubpixelOrder = aBGR; }
bool Factory::GetBGRSubpixelOrder() { return mBGRSubpixelOrder; }

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

@ -146,10 +146,9 @@ D2D1_CHANNEL_SELECTOR D2DChannelSelector(uint32_t aMode) {
already_AddRefed<ID2D1Image> GetImageForSourceSurface(DrawTarget* aDT,
SourceSurface* aSurface) {
if (aDT->IsTiledDrawTarget() || aDT->IsDualDrawTarget()) {
if (aDT->IsTiledDrawTarget()) {
gfxDevCrash(LogReason::FilterNodeD2D1Target)
<< "Incompatible draw target type! " << (int)aDT->IsTiledDrawTarget()
<< " " << (int)aDT->IsDualDrawTarget();
<< "Incompatible draw target type! " << (int)aDT->IsTiledDrawTarget();
return nullptr;
}
switch (aDT->GetBackendType()) {

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

@ -673,9 +673,6 @@ class Log final {
case SurfaceType::SKIA:
mMessage << "SurfaceType::SKIA";
break;
case SurfaceType::DUAL_DT:
mMessage << "SurfaceType::DUAL_DT";
break;
case SurfaceType::D2D1_1_IMAGE:
mMessage << "SurfaceType::D2D1_1_IMAGE";
break;
@ -685,9 +682,6 @@ class Log final {
case SurfaceType::WRAP_AND_RECORD:
mMessage << "SurfaceType::WRAP_AND_RECORD";
break;
case SurfaceType::TILED:
mMessage << "SurfaceType::TILED";
break;
case SurfaceType::DATA_SHARED:
mMessage << "SurfaceType::DATA_SHARED";
break;

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

@ -1,57 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_GFX_SOURCESURFACEDUAL_H_
#define MOZILLA_GFX_SOURCESURFACEDUAL_H_
#include "2D.h"
namespace mozilla {
namespace gfx {
class DualSurface;
class DualPattern;
class SourceSurfaceDual : public SourceSurface {
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceDual, override)
SourceSurfaceDual(DrawTarget* aDTA, DrawTarget* aDTB)
: mA(aDTA->Snapshot()), mB(aDTB->Snapshot()) {}
SourceSurfaceDual(SourceSurface* aSourceA, SourceSurface* aSourceB)
: mA(aSourceA), mB(aSourceB) {}
virtual SurfaceType GetType() const override { return SurfaceType::DUAL_DT; }
virtual IntSize GetSize() const override { return mA->GetSize(); }
virtual SurfaceFormat GetFormat() const override { return mA->GetFormat(); }
// TODO: This is probably wrong as this was originally only
// used for debugging purposes, but now has legacy relying on
// giving the first type only.
virtual already_AddRefed<DataSourceSurface> GetDataSurface() override {
return mA->GetDataSurface();
}
SourceSurface* GetFirstSurface() {
MOZ_ASSERT(mA->GetType() == mB->GetType());
return mA;
}
bool SameSurfaceTypes() { return mA->GetType() == mB->GetType(); }
private:
friend class DualSurface;
friend class DualPattern;
RefPtr<SourceSurface> mA;
RefPtr<SourceSurface> mB;
};
} // namespace gfx
} // namespace mozilla
#endif /* MOZILLA_GFX_SOURCESURFACEDUAL_H_ */

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

@ -32,11 +32,9 @@ enum class SurfaceType : int8_t {
COREGRAPHICS_IMAGE, /* Surface wrapping a CoreGraphics Image */
COREGRAPHICS_CGCONTEXT, /* Surface wrapping a CG context */
SKIA, /* Surface wrapping a Skia bitmap */
DUAL_DT, /* Snapshot of a dual drawtarget */
D2D1_1_IMAGE, /* A D2D 1.1 ID2D1Image SourceSurface */
RECORDING, /* Surface used for recording */
WRAP_AND_RECORD, /* Surface used for wrap and record */
TILED, /* Surface from a tiled DrawTarget */
DATA_SHARED, /* Data surface using shared memory */
DATA_RECYCLING_SHARED, /* Data surface using shared memory */
OFFSET, /* Offset */

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

@ -165,7 +165,6 @@ UNIFIED_SOURCES += [
"DrawEventRecorder.cpp",
"DrawTarget.cpp",
"DrawTargetCairo.cpp",
"DrawTargetDual.cpp",
"DrawTargetOffset.cpp",
"DrawTargetRecording.cpp",
"DrawTargetWrapAndRecord.cpp",

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

@ -835,76 +835,6 @@ class MOZ_RAII TextureClientAutoLock {
bool mSucceeded;
};
// Automatically locks and unlocks two texture clients, and exposes them as a
// a single draw target dual. Since texture locking is fallible, Succeeded()
// must be checked on the guard object before proceeding.
class MOZ_RAII DualTextureClientAutoLock {
public:
DualTextureClientAutoLock(TextureClient* aTexture,
TextureClient* aTextureOnWhite, OpenMode aMode)
: mTarget(nullptr), mTexture(aTexture), mTextureOnWhite(aTextureOnWhite) {
if (!mTexture->Lock(aMode)) {
return;
}
mTarget = mTexture->BorrowDrawTarget();
if (!mTarget) {
mTexture->Unlock();
return;
}
if (!mTextureOnWhite) {
return;
}
if (!mTextureOnWhite->Lock(aMode)) {
mTarget = nullptr;
mTexture->Unlock();
return;
}
RefPtr<gfx::DrawTarget> targetOnWhite = mTextureOnWhite->BorrowDrawTarget();
if (!targetOnWhite) {
mTarget = nullptr;
mTexture->Unlock();
mTextureOnWhite->Unlock();
return;
}
mTarget = gfx::Factory::CreateDualDrawTarget(mTarget, targetOnWhite);
if (!mTarget) {
mTarget = nullptr;
mTexture->Unlock();
mTextureOnWhite->Unlock();
}
}
~DualTextureClientAutoLock() {
if (Succeeded()) {
mTarget = nullptr;
mTexture->Unlock();
if (mTextureOnWhite) {
mTextureOnWhite->Unlock();
}
}
}
bool Succeeded() const { return !!mTarget; }
operator gfx::DrawTarget*() const { return mTarget; }
gfx::DrawTarget* operator->() const { return mTarget; }
RefPtr<gfx::DrawTarget> mTarget;
private:
RefPtr<TextureClient> mTexture;
RefPtr<TextureClient> mTextureOnWhite;
};
class KeepAlive {
public:
virtual ~KeepAlive() = default;

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

@ -19,8 +19,8 @@ CGContextRef gfxQuartzNativeDrawing::BeginNativeDrawing() {
"BeginNativeDrawing called when drawing already in progress");
DrawTarget* dt = mDrawTarget;
if (dt->IsDualDrawTarget() || dt->IsTiledDrawTarget() ||
dt->GetBackendType() != BackendType::SKIA || dt->IsRecording()) {
if (dt->IsTiledDrawTarget() || dt->GetBackendType() != BackendType::SKIA ||
dt->IsRecording()) {
// We need a DrawTarget that we can get a CGContextRef from:
Matrix transform = dt->GetTransform();