diff --git a/gfx/2d/SourceSurfaceSkia.cpp b/gfx/2d/SourceSurfaceSkia.cpp index 27f92a212a10..58e52101da9e 100644 --- a/gfx/2d/SourceSurfaceSkia.cpp +++ b/gfx/2d/SourceSurfaceSkia.cpp @@ -74,14 +74,14 @@ SourceSurfaceSkia::InitFromData(unsigned char* aData, int32_t aStride, SurfaceFormat aFormat) { - mBitmap.setConfig(GfxFormatToSkiaConfig(aFormat), aSize.width, aSize.height, aStride); - if (!mBitmap.allocPixels()) { + SkBitmap temp; + temp.setConfig(GfxFormatToSkiaConfig(aFormat), aSize.width, aSize.height, aStride); + temp.setPixels(aData); + + if (!temp.copyTo(&mBitmap, GfxFormatToSkiaConfig(aFormat))) { return false; } - if (!mBitmap.copyPixelsFrom(aData, mBitmap.getSafeSize(), aStride)) { - return false; - } mSize = aSize; mFormat = aFormat; mStride = aStride;