diff options
| author | 2020-01-08 21:54:07 +0100 | |
|---|---|---|
| committer | 2020-01-09 23:28:56 +0000 | |
| commit | d2ba4f36c7100aae7695dbd06ec22f7431e8ec1a (patch) | |
| tree | 05b8179428ba246f710421f6f59682a5f8e13f50 | |
| parent | e7194bfdfcb9eac9d0005ae6fb46b2d229fb4723 (diff) | |
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
| -rw-r--r-- | libs/hwui/hwui/Bitmap.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/hwui/hwui/Bitmap.cpp b/libs/hwui/hwui/Bitmap.cpp index 219d04055eae..c21bdca3db77 100644 --- a/libs/hwui/hwui/Bitmap.cpp +++ b/libs/hwui/hwui/Bitmap.cpp @@ -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) |