diff options
author | Moonchild <moonchild@palemoon.org> | 2020-11-20 09:47:03 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-11-20 09:47:03 +0000 |
commit | 5165ed02285315cc0bed7977c7bac6d0a90ca43c (patch) | |
tree | 9b761a21eb924915e51c2d803208e6c01b505a45 /gfx/2d/SourceSurfaceSkia.cpp | |
parent | e1db27e19989db11fef70f439cf95821316535b3 (diff) | |
parent | ca9abcdf1702c37bf00048dab3f460b2252873a3 (diff) | |
download | UXP-8dd3f67b8431f42fd367a7f64a1c14ba7ba708ec.tar UXP-8dd3f67b8431f42fd367a7f64a1c14ba7ba708ec.tar.gz UXP-8dd3f67b8431f42fd367a7f64a1c14ba7ba708ec.tar.lz UXP-8dd3f67b8431f42fd367a7f64a1c14ba7ba708ec.tar.xz UXP-8dd3f67b8431f42fd367a7f64a1c14ba7ba708ec.zip |
Merge branch 'redwood' into releaseRELBASE_20201124RELBASE_20201120RC_20201120
Diffstat (limited to 'gfx/2d/SourceSurfaceSkia.cpp')
-rw-r--r-- | gfx/2d/SourceSurfaceSkia.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gfx/2d/SourceSurfaceSkia.cpp b/gfx/2d/SourceSurfaceSkia.cpp index 14cbf6a84..0738f3d39 100644 --- a/gfx/2d/SourceSurfaceSkia.cpp +++ b/gfx/2d/SourceSurfaceSkia.cpp @@ -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) { |