diff --git a/gfx/2d/DataSurfaceHelpers.h b/gfx/2d/DataSurfaceHelpers.h index 93ddbc02c64c..4ae5e0773c90 100644 --- a/gfx/2d/DataSurfaceHelpers.h +++ b/gfx/2d/DataSurfaceHelpers.h @@ -27,33 +27,28 @@ ConvertBGRXToBGRA(uint8_t* aData, const IntSize &aSize, int32_t aStride) } } -/* +/** * Convert aSurface to a packed buffer in BGRA format. The pixel data is * returned in a buffer allocated with new uint8_t[]. */ inline uint8_t * -SurfaceToPackedBGRA(SourceSurface *aSurface) +SurfaceToPackedBGRA(DataSourceSurface *aSurface) { - RefPtr data = aSurface->GetDataSurface(); - if (!data) { - return nullptr; - } - - SurfaceFormat format = data->GetFormat(); + SurfaceFormat format = aSurface->GetFormat(); if (format != SurfaceFormat::B8G8R8A8 && format != SurfaceFormat::B8G8R8X8) { return nullptr; } - IntSize size = data->GetSize(); + IntSize size = aSurface->GetSize(); uint8_t* imageBuffer = new (std::nothrow) uint8_t[size.width * size.height * sizeof(uint32_t)]; if (!imageBuffer) { return nullptr; } - size_t stride = data->Stride(); + size_t stride = aSurface->Stride(); - uint32_t* src = reinterpret_cast(data->GetData()); + uint32_t* src = reinterpret_cast(aSurface->GetData()); uint32_t* dst = reinterpret_cast(imageBuffer); if (stride == size.width * sizeof(uint32_t)) {