Bug 1647167 - Run pre/post transaction triggers in BasicCanvasLayer::Paint. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D82116
This commit is contained in:
Jeff Gilbert 2020-07-02 22:55:48 +00:00
parent 411aa9b679
commit 017fc801d8
2 changed files with 7 additions and 5 deletions

View File

@ -143,7 +143,6 @@ class CanvasRenderer : public RefCounted<CanvasRenderer> {
std::shared_ptr<BorrowedSourceSurface> BorrowSnapshot(
bool requireAlphaPremult = true) const;
protected:
void FirePreTransactionCallback() const;
void FireDidTransactionCallback() const;
};

View File

@ -32,14 +32,15 @@ void BasicCanvasLayer::Paint(DrawTarget* aDT, const Point& aDeviceOffset,
if (IsHidden()) return;
// Ignore IsDirty().
const auto& cr = mCanvasRenderer;
MOZ_ASSERT(cr);
const auto snapshot = cr->BorrowSnapshot();
MOZ_ASSERT(mCanvasRenderer);
mCanvasRenderer->FirePreTransactionCallback();
const auto snapshot = mCanvasRenderer->BorrowSnapshot();
if (!snapshot) return;
const auto& surface = snapshot->mSurf;
Maybe<Matrix> oldTM;
if (!cr->YIsDown()) {
if (!mCanvasRenderer->YIsDown()) {
// y-flip
oldTM = Some(aDT->GetTransform());
aDT->SetTransform(Matrix(*oldTM)
@ -57,6 +58,8 @@ void BasicCanvasLayer::Paint(DrawTarget* aDT, const Point& aDeviceOffset,
aDT->SetTransform(*oldTM);
}
mCanvasRenderer->FireDidTransactionCallback();
Painted();
}