mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 1256572
- use SourceSurfaceRawData with custom deallocator in imgFrame. r=bas
We can prevent the memory copy in GuaranteePersistance() during painting.
This commit is contained in:
parent
cadb8c6cb7
commit
325dfdc8dd
@ -33,8 +33,6 @@ using namespace gfx;
|
||||
|
||||
namespace image {
|
||||
|
||||
static UserDataKey kVolatileBuffer;
|
||||
|
||||
static void
|
||||
VolatileBufferRelease(void* vbuf)
|
||||
{
|
||||
@ -58,14 +56,17 @@ CreateLockedSurface(VolatileBuffer* vbuf,
|
||||
MOZ_ASSERT(!vbufptr->WasBufferPurged(), "Expected image data!");
|
||||
|
||||
int32_t stride = VolatileSurfaceStride(size, format);
|
||||
|
||||
// The VolatileBufferPtr is held by this DataSourceSurface.
|
||||
RefPtr<DataSourceSurface> surf =
|
||||
Factory::CreateWrappingDataSourceSurface(*vbufptr, stride, size, format);
|
||||
Factory::CreateWrappingDataSourceSurface(*vbufptr, stride, size, format,
|
||||
&VolatileBufferRelease,
|
||||
static_cast<void*>(vbufptr));
|
||||
if (!surf) {
|
||||
delete vbufptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
surf->AddUserData(&kVolatileBuffer, vbufptr, VolatileBufferRelease);
|
||||
return surf.forget();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user