зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1746356 - Null-check the result of CreateSimilarDrawTarget. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D148512
This commit is contained in:
Родитель
f022993bb3
Коммит
a45bacf0d2
|
@ -208,5 +208,19 @@ void DrawTargetOffset::PopLayer() {
|
|||
SetPermitSubpixelAA(mDrawTarget->GetPermitSubpixelAA());
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> DrawTargetOffset::CreateClippedDrawTarget(
|
||||
const Rect& aBounds, SurfaceFormat aFormat) {
|
||||
RefPtr<DrawTarget> result;
|
||||
RefPtr<DrawTarget> dt =
|
||||
mDrawTarget->CreateClippedDrawTarget(aBounds, aFormat);
|
||||
if (dt) {
|
||||
result = gfx::Factory::CreateOffsetDrawTarget(dt, mOrigin);
|
||||
if (result) {
|
||||
result->SetTransform(mTransform);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -164,14 +164,7 @@ class DrawTargetOffset : public DrawTarget {
|
|||
return mDrawTarget->CanCreateSimilarDrawTarget(aSize, aFormat);
|
||||
}
|
||||
virtual RefPtr<DrawTarget> CreateClippedDrawTarget(
|
||||
const Rect& aBounds, SurfaceFormat aFormat) override {
|
||||
RefPtr<DrawTarget> dt =
|
||||
mDrawTarget->CreateClippedDrawTarget(aBounds, aFormat);
|
||||
RefPtr<DrawTarget> result =
|
||||
gfx::Factory::CreateOffsetDrawTarget(dt, mOrigin);
|
||||
result->SetTransform(mTransform);
|
||||
return result;
|
||||
}
|
||||
const Rect& aBounds, SurfaceFormat aFormat) override;
|
||||
|
||||
virtual already_AddRefed<PathBuilder> CreatePathBuilder(
|
||||
FillRule aFillRule = FillRule::FILL_WINDING) const override {
|
||||
|
|
|
@ -1596,9 +1596,13 @@ RefPtr<DrawTarget> DrawTargetSkia::CreateClippedDrawTarget(
|
|||
if (mCanvas->getDeviceClipBounds(&clipBounds)) {
|
||||
RefPtr<DrawTarget> dt = CreateSimilarDrawTarget(
|
||||
IntSize(clipBounds.width(), clipBounds.height()), aFormat);
|
||||
result = gfx::Factory::CreateOffsetDrawTarget(
|
||||
dt, IntPoint(clipBounds.x(), clipBounds.y()));
|
||||
result->SetTransform(mTransform);
|
||||
if (dt) {
|
||||
result = gfx::Factory::CreateOffsetDrawTarget(
|
||||
dt, IntPoint(clipBounds.x(), clipBounds.y()));
|
||||
if (result) {
|
||||
result->SetTransform(mTransform);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Everything is clipped but we still want some kind of surface
|
||||
result = CreateSimilarDrawTarget(IntSize(1, 1), aFormat);
|
||||
|
|
Загрузка…
Ссылка в новой задаче