mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1623254 - Re-create DrawTarget of CanvasRenderingContext2D when the DrawTarget becomes invalid r=nical
Differential Revision: https://phabricator.services.mozilla.com/D67274 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
89848fa4f9
commit
b7a705dcef
@ -1296,7 +1296,7 @@ bool CanvasRenderingContext2D::EnsureTarget(const gfx::Rect* aCoveredRect,
|
||||
RestoreClipsAndTransformToTarget();
|
||||
}
|
||||
|
||||
if (mTarget) {
|
||||
if (mTarget && mTarget->IsValid()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -90,6 +90,9 @@ DrawTargetD2D1::~DrawTargetD2D1() {
|
||||
}
|
||||
|
||||
bool DrawTargetD2D1::IsValid() const {
|
||||
if (mInitState != InitState::Uninitialized && !IsDeviceContextValid()) {
|
||||
return false;
|
||||
}
|
||||
if (NS_IsMainThread()) {
|
||||
// Uninitialized DTs are considered valid.
|
||||
return mInitState != InitState::Failure;
|
||||
@ -2274,7 +2277,7 @@ void DrawTargetD2D1::PushD2DLayer(ID2D1DeviceContext* aDC,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
bool DrawTargetD2D1::IsDeviceContextValid() {
|
||||
bool DrawTargetD2D1::IsDeviceContextValid() const {
|
||||
uint32_t seqNo;
|
||||
return mDC && Factory::GetD2D1Device(&seqNo) && seqNo == mDeviceSeq;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ class DrawTargetD2D1 : public DrawTarget {
|
||||
|
||||
// This function is used to determine if the mDC is still valid; if it is
|
||||
// stale, we should avoid using it to execute any draw commands.
|
||||
bool IsDeviceContextValid();
|
||||
bool IsDeviceContextValid() const;
|
||||
|
||||
IntSize mSize;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user