Merge "AImageDecoder: Suppress log messages" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-04-03 15:10:44 +00:00
committed by Android (Google) Code Review
2 changed files with 3 additions and 9 deletions

View File

@@ -50,10 +50,8 @@ ImageDecoder::ImageDecoder(std::unique_ptr<SkAndroidCodec> codec, sk_sp<SkPngChu
}
SkAlphaType ImageDecoder::getOutAlphaType() const {
// While an SkBitmap may want to use kOpaque_SkAlphaType for a performance
// optimization, this class just outputs raw pixels. Using either
// premultiplication choice has no effect on decoding an opaque encoded image.
return mUnpremultipliedRequired ? kUnpremul_SkAlphaType : kPremul_SkAlphaType;
return opaque() ? kOpaque_SkAlphaType
: mUnpremultipliedRequired ? kUnpremul_SkAlphaType : kPremul_SkAlphaType;
}
bool ImageDecoder::setTargetSize(int width, int height) {
@@ -82,8 +80,7 @@ bool ImageDecoder::setTargetSize(int width, int height) {
SkISize targetSize = { width, height }, decodeSize = targetSize;
int sampleSize = mCodec->computeSampleSize(&decodeSize);
if (decodeSize != targetSize && mUnpremultipliedRequired
&& !mCodec->getInfo().isOpaque()) {
if (decodeSize != targetSize && mUnpremultipliedRequired && !opaque()) {
return false;
}

View File

@@ -305,9 +305,6 @@ static jobject ImageDecoder_nDecodeBitmap(JNIEnv* env, jobject /*clazz*/, jlong
}
SkImageInfo bitmapInfo = decoder->getOutputInfo();
if (decoder->opaque()) {
bitmapInfo = bitmapInfo.makeAlphaType(kOpaque_SkAlphaType);
}
if (asAlphaMask && colorType == kGray_8_SkColorType) {
bitmapInfo = bitmapInfo.makeColorType(kAlpha_8_SkColorType);
}