mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1315212: Allow for failed call to wrapped DrawTarget in DrawTargetRecording::CreateSimilarDrawTarget. r=bas
MozReview-Commit-ID: 4SMixY4Nook
This commit is contained in:
parent
c4a371a6ce
commit
7593d137fb
@ -300,12 +300,13 @@ DrawTargetRecording::DrawTargetRecording(DrawEventRecorder *aRecorder, DrawTarge
|
||||
}
|
||||
|
||||
DrawTargetRecording::DrawTargetRecording(const DrawTargetRecording *aDT,
|
||||
const IntSize &aSize,
|
||||
SurfaceFormat aFormat)
|
||||
DrawTarget *aSimilarDT)
|
||||
: mRecorder(aDT->mRecorder)
|
||||
, mFinalDT(aDT->mFinalDT->CreateSimilarDrawTarget(aSize, aFormat))
|
||||
, mFinalDT(aSimilarDT)
|
||||
{
|
||||
mRecorder->RecordEvent(RecordedCreateSimilarDrawTarget(this, aSize, aFormat));
|
||||
mRecorder->RecordEvent(RecordedCreateSimilarDrawTarget(this,
|
||||
mFinalDT->GetSize(),
|
||||
mFinalDT->GetFormat()));
|
||||
mFormat = mFinalDT->GetFormat();
|
||||
}
|
||||
|
||||
@ -641,7 +642,14 @@ DrawTargetRecording::CreateSourceSurfaceFromNativeSurface(const NativeSurface &a
|
||||
already_AddRefed<DrawTarget>
|
||||
DrawTargetRecording::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const
|
||||
{
|
||||
return MakeAndAddRef<DrawTargetRecording>(this, aSize, aFormat);
|
||||
RefPtr<DrawTarget> similarDT =
|
||||
mFinalDT->CreateSimilarDrawTarget(aSize, aFormat);
|
||||
if (!similarDT) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
similarDT = new DrawTargetRecording(this, similarDT);
|
||||
return similarDT.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<PathBuilder>
|
||||
|
@ -19,16 +19,6 @@ public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(DrawTargetRecording, override)
|
||||
DrawTargetRecording(DrawEventRecorder *aRecorder, DrawTarget *aDT, bool aHasData = false);
|
||||
|
||||
/**
|
||||
* Used for creating a DrawTargetRecording for a CreateSimilarDrawTarget call.
|
||||
*
|
||||
* @param aDT DrawTargetRecording on which CreateSimilarDrawTarget was called
|
||||
* @param aSize size for the similar DrawTarget
|
||||
* @param aFormat format for the similar DrawTarget
|
||||
*/
|
||||
DrawTargetRecording(const DrawTargetRecording *aDT, const IntSize &aSize,
|
||||
SurfaceFormat aFormat);
|
||||
|
||||
~DrawTargetRecording();
|
||||
|
||||
virtual DrawTargetType GetType() const override { return mFinalDT->GetType(); }
|
||||
@ -322,6 +312,17 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* Used for creating a DrawTargetRecording for a CreateSimilarDrawTarget call.
|
||||
* We have to call CreateSimilarDrawTarget on mFinalDT up front and pass it in
|
||||
* as it can fail.
|
||||
*
|
||||
* @param aDT DrawTargetRecording on which CreateSimilarDrawTarget was called
|
||||
* @param aSimilarDT Similar DrawTarget created from aDT.mFinalDT.
|
||||
*/
|
||||
DrawTargetRecording(const DrawTargetRecording *aDT,
|
||||
DrawTarget *aSimilarDT);
|
||||
|
||||
Path *GetPathForPathRecording(const Path *aPath) const;
|
||||
already_AddRefed<PathRecording> EnsurePathStored(const Path *aPath);
|
||||
void EnsurePatternDependenciesStored(const Pattern &aPattern);
|
||||
|
Loading…
Reference in New Issue
Block a user