Commit e5a53bb9 authored by Miko Mynttinen's avatar Miko Mynttinen
Browse files

Bug 1662484 - Do not allow wrapping SourceSurfaceOffset around null surfaces. r=mstange, a=RyanVM

Differential Revision: https://phabricator.services.mozilla.com/D89006
parent 13e2267a
......@@ -180,8 +180,14 @@ void DrawTargetOffset::PushLayer(bool aOpaque, Float aOpacity,
already_AddRefed<SourceSurface> DrawTargetOffset::IntoLuminanceSource(
LuminanceType aLuminanceType, float aOpacity) {
return MakeAndAddRef<SourceSurfaceOffset>(
mDrawTarget->IntoLuminanceSource(aLuminanceType, aOpacity), mOrigin);
RefPtr<SourceSurface> surface =
mDrawTarget->IntoLuminanceSource(aLuminanceType, aOpacity);
if (!surface) {
return nullptr;
}
return MakeAndAddRef<SourceSurfaceOffset>(surface, mOrigin);
}
void DrawTargetOffset::PushLayerWithBlend(bool aOpaque, Float aOpacity,
......
......@@ -22,7 +22,10 @@ namespace gfx {
class SourceSurfaceOffset : public SourceSurface {
public:
SourceSurfaceOffset(RefPtr<SourceSurface> aSurface, IntPoint aOffset)
: mSurface(aSurface), mOffset(aOffset) {}
: mSurface(aSurface), mOffset(aOffset) {
MOZ_RELEASE_ASSERT(mSurface);
}
virtual SurfaceType GetType() const override { return SurfaceType::OFFSET; }
virtual IntSize GetSize() const override { return mSurface->GetSize(); }
virtual IntRect GetRect() const override {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment