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
This commit is contained in:
Greg Daniel
2019-03-27 12:52:43 -04:00
parent 4d7990f458
commit 78b7ddc12e

View File

@@ -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