Bug 944412 - Fix an issue with the stride in SourceSurfaceSkia::InitFromData. r=gal

After calling SkBitmap::copyTo, the InitFromData method assumed
that the stride of the destination SkBitmap was now the same as the
stride of the source bitmap. This was, however, not the case. Now
the stride is read back out of the destination bitmap.

This was causing a crash due to memory corruption for FORMAT_B8G8R8X8
surfaces.
This commit is contained in:
Kevin Simons 2013-12-02 11:03:13 -05:00
Родитель b37f4cce7c
Коммит 2d12d37e18
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -75,7 +75,7 @@ SourceSurfaceSkia::InitFromData(unsigned char* aData,
if (aFormat == FORMAT_B8G8R8X8) {
mBitmap.lockPixels();
// We have to manually set the A channel to be 255 as Skia doesn't understand BGRX
ConvertBGRXToBGRA(reinterpret_cast<unsigned char*>(mBitmap.getPixels()), aSize, aStride);
ConvertBGRXToBGRA(reinterpret_cast<unsigned char*>(mBitmap.getPixels()), aSize, mBitmap.rowBytes());
mBitmap.unlockPixels();
mBitmap.notifyPixelsChanged();
mBitmap.setIsOpaque(true);
@ -83,7 +83,7 @@ SourceSurfaceSkia::InitFromData(unsigned char* aData,
mSize = aSize;
mFormat = aFormat;
mStride = aStride;
mStride = mBitmap.rowBytes();
return true;
}