summaryrefslogtreecommitdiff
path: root/libs/hwui/HardwareBitmapUploader.cpp
diff options
context:
space:
mode:
author Greg Daniel <egdaniel@google.com> 2019-03-27 12:52:43 -0400
committer Greg Daniel <egdaniel@google.com> 2019-03-27 12:52:43 -0400
commit78b7ddc12e512771177eeca43dc0b0e247f7abbc (patch)
tree2c25e0653be5cb92098dcaeeb372f0989b294c0d /libs/hwui/HardwareBitmapUploader.cpp
parent4d7990f458625eeac4147e382dadb515ae97e7a4 (diff)
Couple fixes to HardwareBitmapUploader.
When we had to make a copy SkBitmap for an unsupported format, we were dropping the color space information. Added a null check in terminate. Test: manual build and running on blueline Change-Id: I3cf386231e76b7505a691d006585918d343f6c96
Diffstat (limited to 'libs/hwui/HardwareBitmapUploader.cpp')
-rw-r--r--libs/hwui/HardwareBitmapUploader.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/hwui/HardwareBitmapUploader.cpp b/libs/hwui/HardwareBitmapUploader.cpp
index 8f7e8142e735..9bb6031b76ac 100644
--- a/libs/hwui/HardwareBitmapUploader.cpp
+++ b/libs/hwui/HardwareBitmapUploader.cpp
@@ -349,8 +349,7 @@ static SkBitmap makeHwCompatible(const FormatInfo& format, const SkBitmap& sourc
} else {
SkBitmap bitmap;
const SkImageInfo& info = source.info();
- bitmap.allocPixels(
- SkImageInfo::MakeN32(info.width(), info.height(), info.alphaType(), nullptr));
+ bitmap.allocPixels(info.makeColorType(kN32_SkColorType));
SkCanvas canvas(bitmap);
canvas.drawColor(0);
@@ -416,7 +415,9 @@ void HardwareBitmapUploader::initialize() {
}
void HardwareBitmapUploader::terminate() {
- sUploader->destroy();
+ if (sUploader) {
+ sUploader->destroy();
+ }
}
} // namespace android::uirenderer