mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-08 00:07:30 +09:00
[gfx][Skia] Hold mutex while accessing shared SkImage data.
This commit is contained in:
parent
2924d30a83
commit
3cac4d852d
3 changed files with 54 additions and 17 deletions
|
|
@ -40,6 +40,25 @@ SourceSurfaceSkia::GetFormat() const
|
|||
return mFormat;
|
||||
}
|
||||
|
||||
sk_sp<SkImage>
|
||||
SourceSurfaceSkia::GetImage(Maybe<MutexAutoLock>* aLock) {
|
||||
// If we were provided a lock object, we can let the caller access
|
||||
// a shared SkImage and we know it won't go away while the lock is held.
|
||||
if (aLock) {
|
||||
// We are locked, so now we can check mDrawTarget.
|
||||
// If it's null, then we're not shared and we can unlock eagerly.
|
||||
if (!mDrawTarget) {
|
||||
aLock->reset();
|
||||
}
|
||||
} else {
|
||||
// Otherwise we need to call DrawTargetWillChange to ensure we have our
|
||||
// own copy of the SkImage.
|
||||
DrawTargetWillChange();
|
||||
}
|
||||
sk_sp<SkImage> image = mImage;
|
||||
return image;
|
||||
}
|
||||
|
||||
static sk_sp<SkData>
|
||||
MakeSkData(unsigned char* aData, const IntSize& aSize, int32_t aStride)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue