mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
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:
parent
b37f4cce7c
commit
2d12d37e18
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user