Allow zero stride
For some pixel formats, stride has no meaning. Take this into account and use buffer width instead. Bug: 143470518 Change-Id: I728b40803e80c4e534504c5b9db55921bb5e7dbc Merged-In: I728b40803e80c4e534504c5b9db55921bb5e7dbc Test: android.graphics.cts.ImageDecoderTest#testConserveMemoryPlusHardware
This commit is contained in:
committed by
John Reck
parent
e7194bfdfc
commit
d2ba4f36c7
@@ -219,7 +219,7 @@ Bitmap::Bitmap(void* address, int fd, size_t mappedSize, const SkImageInfo& info
|
||||
|
||||
Bitmap::Bitmap(GraphicBuffer* buffer, const SkImageInfo& info, BitmapPalette palette)
|
||||
: SkPixelRef(info.width(), info.height(), nullptr,
|
||||
bytesPerPixel(buffer->getPixelFormat()) * buffer->getStride())
|
||||
bytesPerPixel(buffer->getPixelFormat()) * (buffer->getStride() > 0 ? buffer->getStride() : buffer->getWidth()))
|
||||
, mInfo(validateAlpha(info))
|
||||
, mPixelStorageType(PixelStorageType::Hardware)
|
||||
, mPalette(palette)
|
||||
|
||||
Reference in New Issue
Block a user