зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1604180: Use original surface for GetDataSurface after DrawTargetRecording::OptimizeSourceSurface. r=jrmuizel
We return a SourceSurfaceRecdording from OptimizeSourceSurface to represent the optimized surface. However, GetDataSurface might be called on this SourceSurfaceRecdording, so we hold the original SourceSurface we optimized in the SourceSurfaceRecdording to return its GetDataSurface. Differential Revision: https://phabricator.services.mozilla.com/D59712 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f982e8218f
Коммит
76aff2ff48
|
@ -58,8 +58,12 @@ class SourceSurfaceRecording : public SourceSurface {
|
|||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceRecording, override)
|
||||
|
||||
SourceSurfaceRecording(IntSize aSize, SurfaceFormat aFormat,
|
||||
DrawEventRecorderPrivate* aRecorder)
|
||||
: mSize(aSize), mFormat(aFormat), mRecorder(aRecorder) {
|
||||
DrawEventRecorderPrivate* aRecorder,
|
||||
SourceSurface* aOriginalSurface = nullptr)
|
||||
: mSize(aSize),
|
||||
mFormat(aFormat),
|
||||
mRecorder(aRecorder),
|
||||
mOriginalSurface(aOriginalSurface) {
|
||||
mRecorder->AddStoredObject(this);
|
||||
}
|
||||
|
||||
|
@ -73,12 +77,20 @@ class SourceSurfaceRecording : public SourceSurface {
|
|||
IntSize GetSize() const override { return mSize; }
|
||||
SurfaceFormat GetFormat() const override { return mFormat; }
|
||||
already_AddRefed<DataSourceSurface> GetDataSurface() override {
|
||||
if (mOriginalSurface) {
|
||||
return mOriginalSurface->GetDataSurface();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IntSize mSize;
|
||||
SurfaceFormat mFormat;
|
||||
RefPtr<DrawEventRecorderPrivate> mRecorder;
|
||||
// If a SourceSurfaceRecording is returned from an OptimizeSourceSurface call
|
||||
// we need GetDataSurface to work, so we hold the original surface we
|
||||
// optimized to return its GetDataSurface.
|
||||
RefPtr<SourceSurface> mOriginalSurface;
|
||||
};
|
||||
|
||||
class DataSourceSurfaceRecording : public DataSourceSurface {
|
||||
|
@ -516,7 +528,7 @@ already_AddRefed<SourceSurface> DrawTargetRecording::OptimizeSourceSurface(
|
|||
EnsureSurfaceStoredRecording(mRecorder, aSurface, "OptimizeSourceSurface");
|
||||
|
||||
RefPtr<SourceSurface> retSurf = new SourceSurfaceRecording(
|
||||
aSurface->GetSize(), aSurface->GetFormat(), mRecorder);
|
||||
aSurface->GetSize(), aSurface->GetFormat(), mRecorder, aSurface);
|
||||
|
||||
mRecorder->RecordEvent(
|
||||
RecordedOptimizeSourceSurface(aSurface, this, retSurf));
|
||||
|
|
Загрузка…
Ссылка в новой задаче