store SkAlphaType inside SkBitmap, on road to support unpremul
BUG=
R=bsalomon@google.com, scroggo@google.com
Review URL: https://codereview.chromium.org/25275004
git-svn-id: http://skia.googlecode.com/svn/trunk@11877 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/images/SkImageDecoder_libjpeg.cpp b/src/images/SkImageDecoder_libjpeg.cpp
index 52c7483..67b1782 100644
--- a/src/images/SkImageDecoder_libjpeg.cpp
+++ b/src/images/SkImageDecoder_libjpeg.cpp
@@ -543,9 +543,9 @@
#endif
if (1 == sampleSize && SkImageDecoder::kDecodeBounds_Mode == mode) {
- bm->setConfig(config, cinfo.image_width, cinfo.image_height);
- bm->setIsOpaque(config != SkBitmap::kA8_Config);
- return true;
+ return bm->setConfig(config, cinfo.image_width, cinfo.image_height, 0,
+ SkBitmap::kA8_Config == config ?
+ kPremul_SkAlphaType : kOpaque_SkAlphaType);
}
/* image_width and image_height are the original dimensions, available
@@ -565,9 +565,9 @@
if (SkImageDecoder::kDecodeBounds_Mode == mode && valid_output_dimensions(cinfo)) {
SkScaledBitmapSampler smpl(cinfo.output_width, cinfo.output_height,
recompute_sampleSize(sampleSize, cinfo));
- bm->setConfig(config, smpl.scaledWidth(), smpl.scaledHeight());
- bm->setIsOpaque(config != SkBitmap::kA8_Config);
- return true;
+ return bm->setConfig(config, smpl.scaledWidth(), smpl.scaledHeight(),
+ 0, SkBitmap::kA8_Config == config ?
+ kPremul_SkAlphaType : kOpaque_SkAlphaType);
} else {
return return_false(cinfo, *bm, "start_decompress");
}
@@ -580,8 +580,8 @@
}
SkScaledBitmapSampler sampler(cinfo.output_width, cinfo.output_height, sampleSize);
- bm->setConfig(config, sampler.scaledWidth(), sampler.scaledHeight());
- bm->setIsOpaque(config != SkBitmap::kA8_Config);
+ bm->setConfig(config, sampler.scaledWidth(), sampler.scaledHeight(), 0,
+ SkBitmap::kA8_Config != config ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return true;
}
@@ -801,8 +801,8 @@
SkScaledBitmapSampler sampler(width, height, skiaSampleSize);
SkBitmap bitmap;
- bitmap.setConfig(config, sampler.scaledWidth(), sampler.scaledHeight());
- bitmap.setIsOpaque(true);
+ bitmap.setConfig(config, sampler.scaledWidth(), sampler.scaledHeight(), 0,
+ kOpaque_SkAlphaType);
// Check ahead of time if the swap(dest, src) is possible or not.
// If yes, then we will stick to AllocPixelRef since it's cheaper with the